wok-6.x view postfix/receipt @ rev 15183

cherokee: new init script
author Richard Dunbar <mojo@slitaz.org>
date Wed Aug 21 14:06:05 2013 +0000 (2013-08-21)
parents e9130cce9043
children 51a1ebbda768
line source
1 # SliTaz package receipt.
3 PACKAGE="postfix"
4 VERSION="2.10.1"
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 TAZPANEL_DAEMON="man|edit::/etc/postfix/main.cf|options|web::$WEB_SITE"
12 CONFIG_FILES="/etc/postfix"
14 DEPENDS="libdb libldap pcre libssl slitaz-base-files libsasl libkrb5 \
15 libcomerr3 libmysqlclient"
16 BUILD_DEPENDS="db-dev openldap-dev pcre-dev openssl-dev perl mysql-dev \
17 cyrus-sasl-dev libsasl"
19 # Rules to configure and make the package.
20 compile_rules()
21 {
22 cd $src
23 make makefiles \
24 CCARGS='-DHAS_DB -DHAS_LDAP \
25 -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I /usr/include/sasl \
26 -DHAS_MYSQL -I/usr/include/mysql \
27 -DDEF_DAEMON_DIR=\"/usr/lib/postfix\" \
28 -DDEF_MANPAGE_DIR=\"/usr/share/man\"' \
29 AUXLIBS="-ldb -lldap -llber -lsasl2 \
30 -L/usr/lib/mysql -lmysqlclient -lz -lm " &&
31 make
32 install_root=$WOK/$PACKAGE/install \
33 sh postfix-install -non-interactive
34 }
36 # Rules to gen a SliTaz package suitable for Tazpkg.
37 genpkg_rules()
38 {
39 mkdir -p $fs/usr/share/licenses/
40 cp -a $install/usr/lib $fs/usr
41 cp -a $install/usr/bin $fs/usr
42 cp -a $install/usr/sbin $fs/usr
43 cp -a $install/etc $fs
45 awk 'BEGIN {n=0} /MUST/ {n++} /ALIASES/ {n++} { if (n==1) print }' \
46 < $install/etc/postfix/aliases > $fs/etc/postfix/aliases
47 while read keyword data; do
48 grep -q ^$keyword $fs/etc/postfix/main.cf && continue
49 mv $fs/etc/postfix/main.cf $fs/etc/postfix/main.cf.$$
50 awk "BEGIN { scan=1 } /^#$keyword / { if (scan) { print \"$keyword $data\" ; scan=0 } } { print }" \
51 < $fs/etc/postfix/main.cf.$$ > $fs/etc/postfix/main.cf
52 rm -f $fs/etc/postfix/main.cf.$$
53 done << EOF
54 mydomain = localdomain
55 myorigin = localhost
56 mydestination = localhost, localhost.\$mydomain
57 mynetworks = 127.0.0.0/8
58 alias_maps = hash:/etc/postfix/aliases
59 EOF
60 cp -a $stuff/etc $fs
61 cp -a $install/var $fs
62 mv $fs/etc/postfix/TLS_LICENSE $fs/usr/share/licenses/POSTFIX_TLS_LICENSE
63 mv $fs/etc/postfix/LICENSE $fs/usr/share/licenses/POSTFIX_LICENSE
64 cp -a $stuff/etc/init.d $fs/etc
65 rm -f $fs/usr/lib/postfix/post* $fs/usr/lib/postfix/*.cf
66 strip -s $fs/usr/lib/postfix/*
67 }
69 # Pre and post install commands for Tazpkg.
70 post_install()
71 {
73 local user
74 local group
76 user=postfix
77 group=postdrop
79 if ! grep -q $user $1/etc/passwd; then
80 echo -n "Adding user/group $user..."
81 chroot $1/ addgroup -S $user
82 chroot $1/ adduser -S -D -H -G $user $user
83 chroot $1/ addgroup -S $group
84 status
85 fi
87 # addgroup postdrop if needed
88 if ! grep -q postdrop $1/etc/group; then
89 echo -n "Adding group ${group}..."
90 chroot $1/ addgroup -S $group
91 status
92 fi
94 chroot $1/ chown ${user} /var/spool/postfix/* /var/lib/postfix
95 chroot $1/ chgrp ${group} /var/spool/postfix/maildrop \
96 /var/spool/postfix/public /usr/sbin/postdrop /usr/sbin/postqueue
97 chmod 2755 $1/usr/sbin/postdrop $1/usr/sbin/postqueue
98 chmod 2710 $1/var/spool/postfix/public
99 chmod 1730 $1/var/spool/postfix/maildrop
100 chroot $1/ postalias /etc/postfix/aliases
101 cat <<EOF
103 ----
104 Warning: you still need to edit myorigin/mydestination/mynetworks
105 parameter settings in /etc/postfix/main.cf.
106 See also http://www.postfix.org/STANDARD_CONFIGURATION_README.html
108 To start $PACKAGE server you can run :
110 /etc/init.d/$PACKAGE start
112 Or add $PACKAGE to RUN_DAEMONS in /etc/rcS.conf
113 ----
114 EOF
115 }
117 # Overlap busybox
118 pre_install()
119 {
120 rm -f $1/usr/sbin/sendmail
121 }
123 post_remove()
124 {
125 deluser postfix
126 delgroup postdrop
127 ln -s /bin/busybox /usr/sbin/sendmail
128 }