wok-next view postfix/receipt @ rev 12223

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