updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / netqmail / qmail.install
blob037c2cf563edd3214c7c305398181eab38c4937f
1 #!/bin/sh
3 _add_group() {
4 getent group $1 >/dev/null || groupadd -g $2 $1
7 _add_user() {
8 getent passwd $1 >/dev/null || useradd -u $2 -g $4 -s /bin/false -d $3 $1
11 add_users() {
12 _add_group nofiles 200
13 _add_group qmail 201
14 _add_user alias 200 /var/qmail/alias nofiles
15 _add_user qmaild 201 /var/qmail nofiles
16 _add_user qmaill 202 /var/qmail nofiles
17 _add_user qmailp 203 /var/qmail nofiles
18 _add_user qmailq 204 /var/qmail qmail
19 _add_user qmailr 205 /var/qmail qmail
20 _add_user qmails 206 /var/qmail qmail
23 post_install() {
24 add_users
25 post_upgrade
28 _chownmod() {
29 _own=$1
30 _mod=$2
31 shift 2
32 chown $_own "$@"
33 chmod $_mod "$@"
36 _change_bin_perms() {
37 _chownmod root:qmail 755 \
38 $_bindir/{datemail,elq,forward,maildir2mbox,mailsubj,pinq} \
39 $_bindir/{predate,qail,qmail-{inject,qmqpc,showctl},sendmail} \
40 $_bindir/{bouncesaying,condredirect,config-fast,except,preline,qbiff} \
41 $_bindir/qmail-{pop3d,qmqpd,qmtpd,qread,qstat,smtpd,tcpok,tcpto} \
42 $_bindir/{qreceipt,qsmhook,tcp-env}
43 _chownmod root:qmail 711 \
44 $_bindir/qmail-{clean,getpw,local,popup,pw2u,remote,rspawn,send} \
45 $_bindir/splogger
46 _chownmod root:qmail 700 \
47 $_bindir/qmail-{lspawn,newmrh,newu,start}
48 _chownmod qmailq:qmail 4711 \
49 $_bindir/qmail-queue
52 post_upgrade() {
53 _bindir=/usr/bin
54 _confdir=/etc/qmail
55 _vardir=/var/qmail
57 chown root:qmail \
58 $_confdir/{,control,users} $_vardir
59 chown alias:qmail \
60 $_confdir/alias
62 _change_bin_perms
65 pre_remove() {
66 userdel alias >& /dev/null
67 userdel qmaild >& /dev/null
68 userdel qmaill >& /dev/null
69 userdel qmailp >& /dev/null
70 userdel qmailq >& /dev/null
71 userdel qmailr >& /dev/null
72 userdel qmails >& /dev/null
73 groupdel nofiles >& /dev/null
74 groupdel qmail >& /dev/null
77 _op=$1
78 shift
80 $_op "$@"