wok-stable view postfix/receipt @ rev 12040
postfix: Improve receipt + fix addgroup command
author | Eric Joseph-Alexandre <erjo@slitaz.org> |
---|---|
date | Wed Mar 07 16:30:58 2012 +0100 (2012-03-07) |
parents | 576174991e05 |
children | cd2f1773baed |
line source
1 # SliTaz package receipt.
3 PACKAGE="postfix"
4 VERSION="2.8.3"
5 CATEGORY="network"
6 SHORT_DESC="fast, easy to administer, and secure mailer."
7 MAINTAINER="pascal.bellard@slitaz.org"
8 TARBALL="$PACKAGE-$VERSION.tar.gz"
9 WEB_SITE="http://www.postfix.org/"
10 WGET_URL="ftp://ftp.cs.tu-berlin.de/pub/net/mail/postfix/official/$TARBALL"
11 BUILD_DEPENDS="db-dev openldap-dev pcre-dev openssl-dev perl mysql-dev libsasl"
12 DEPENDS="libdb libldap pcre libssl slitaz-base-files libsasl libkrb5 libcomerr3"
13 CONFIG_FILES="/etc/postfix"
15 # Rules to configure and make the package.
16 compile_rules()
17 {
18 cd $src
19 make makefiles \
20 CCARGS='-DHAS_DB -DHAS_LDAP \
21 -DHAS_MYSQL -I/usr/include/mysql \
22 -DDEF_DAEMON_DIR=\"/usr/lib/postfix\" \
23 -DDEF_MANPAGE_DIR=\"/usr/share/man\"' \
24 AUXLIBS="-ldb -lldap -llber \
25 -L/usr/lib/mysql -lmysqlclient -lz -lm " &&
26 make
27 install_root=$WOK/$PACKAGE/install \
28 sh postfix-install -non-interactive
29 }
31 # Rules to gen a SliTaz package suitable for Tazpkg.
32 genpkg_rules()
33 {
34 mkdir -p $fs/usr/share/licenses/
35 cp -a $install/usr/lib $fs/usr
36 cp -a $install/usr/bin $fs/usr
37 cp -a $install/usr/sbin $fs/usr
38 cp -a $install/etc $fs
40 awk 'BEGIN {n=0} /MUST/ {n++} /ALIASES/ {n++} { if (n==1) print }' \
41 < $install/etc/postfix/aliases > $fs/etc/postfix/aliases
42 while read keyword data; do
43 grep -q ^$keyword $fs/etc/postfix/main.cf && continue
44 mv $fs/etc/postfix/main.cf $fs/etc/postfix/main.cf.$$
45 awk "BEGIN { scan=1 } /^#$keyword / { if (scan) { print \"$keyword $data\" ; scan=0 } } { print }" \
46 < $fs/etc/postfix/main.cf.$$ > $fs/etc/postfix/main.cf
47 rm -f $fs/etc/postfix/main.cf.$$
48 done << EOF
49 mydomain = localdomain
50 myorigin = localhost
51 mydestination = localhost, localhost.\$mydomain
52 mynetworks = 127.0.0.0/8
53 alias_maps = hash:/etc/postfix/aliases
54 EOF
55 cp -a $stuff/etc $fs
56 cp -a $install/var $fs
57 mv $fs/etc/postfix/TLS_LICENSE $fs/usr/share/licenses/POSTFIX_TLS_LICENSE
58 mv $fs/etc/postfix/LICENSE $fs/usr/share/licenses/POSTFIX_LICENSE
59 cp -a $stuff/etc/init.d $fs/etc
60 rm -f $fs/usr/lib/postfix/post* $fs/usr/lib/postfix/*.cf
61 strip -s $fs/usr/lib/postfix/*
62 }
64 # Pre and post install commands for Tazpkg.
65 post_install()
66 {
68 local user
69 local group
71 user=postfix
72 group=postdrop
74 if ! grep -q $user $1/etc/passwd; then
75 echo -n "Adding user/group $user..."
76 chroot $1/ addgroup -S $user
77 chroot $1/ adduser -S -D -H -G $user $user
78 chroot $1/ addgroup -S $group
79 status
80 fi
82 # addgroup postdrop if needed
83 if ! grep -q postdrop $1/etc/group; then
84 echo -n "Adding group ${group}..."
85 chroot $1/ addgroup -S $group
86 status
87 fi
89 chroot $1/ chown ${user} /var/spool/postfix/* /var/lib/postfix
90 chroot $1/ chgrp ${group} /var/spool/postfix/maildrop \
91 /var/spool/postfix/public /usr/sbin/postdrop /usr/sbin/postqueue
92 chmod 2755 $1/usr/sbin/postdrop $1/usr/sbin/postqueue
93 chmod 2710 $1/var/spool/postfix/public
94 chmod 1730 $1/var/spool/postfix/maildrop
95 chroot $1/ postalias /etc/postfix/aliases
96 cat <<EOF
98 ----
99 Warning: you still need to edit myorigin/mydestination/mynetworks
100 parameter settings in /etc/postfix/main.cf.
101 See also http://www.postfix.org/STANDARD_CONFIGURATION_README.html
103 To start $PACKAGE server you can run :
105 /etc/init.d/$PACKAGE start
107 Or add $PACKAGE to RUN_DAEMONS in /etc/rcS.conf
108 ----
109 EOF
110 }
112 # Overlap busybox
113 pre_install()
114 {
115 rm -f $1/usr/sbin/sendmail
116 }
118 post_remove()
119 {
120 deluser postfix
121 delgroup postdrop
122 ln -s /bin/busybox /usr/sbin/sendmail
123 }