wok view postfix/receipt @ rev 19515

linld: multi initrd support
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Nov 22 21:19:01 2016 +0100 (2016-11-22)
parents 9e01bc6321ea
children 6b06abdea831
line source
1 # SliTaz package receipt.
3 PACKAGE="postfix"
4 VERSION="2.10.2"
5 CATEGORY="network"
6 SHORT_DESC="fast, easy to administer, and secure mailer."
7 MAINTAINER="pascal.bellard@slitaz.org"
8 LICENSE="other"
9 TARBALL="$PACKAGE-$VERSION.tar.gz"
10 WEB_SITE="http://www.postfix.org/"
11 WGET_URL="ftp://ftp.cs.tu-berlin.de/pub/net/mail/postfix/official/$TARBALL"
12 TAZPANEL_DAEMON="man|edit::/etc/postfix/main.cf|options|web::$WEB_SITE"
13 CONFIG_FILES="/etc/postfix"
14 PROVIDE="sendmail"
16 DEPENDS="libdb libldap pcre libssl slitaz-base-files libsasl libkrb5 \
17 libcomerr3 libmysqlclient"
18 BUILD_DEPENDS="db-dev openldap-dev pcre-dev openssl-dev perl mysql-dev \
19 cyrus-sasl-dev libsasl"
21 # Rules to configure and make the package.
22 compile_rules()
23 {
24 make makefiles \
25 CCARGS='-DHAS_DB -DHAS_LDAP \
26 -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I /usr/include/sasl \
27 -DHAS_MYSQL -I/usr/include/mysql \
28 -DDEF_DAEMON_DIR=\"/usr/lib/postfix\" \
29 -DUSE_TLS \
30 -DDEF_MANPAGE_DIR=\"/usr/share/man\"' \
31 AUXLIBS="-ldb -lldap -llber -lsasl2 -lssl -lcrypto -lpthread \
32 -L/usr/lib/mysql -lmysqlclient -lz -lm " &&
33 make
34 install_root=$WOK/$PACKAGE/install \
35 sh postfix-install -non-interactive
36 }
38 # Rules to gen a SliTaz package suitable for Tazpkg.
39 genpkg_rules()
40 {
41 mkdir -p $fs/usr/share/licenses/
42 cp -a $install/usr/lib $fs/usr
43 cp -a $install/usr/bin $fs/usr
44 cp -a $install/usr/sbin $fs/usr
45 cp -a $install/etc $fs
47 awk 'BEGIN {n=0} /MUST/ {n++} /ALIASES/ {n++} { if (n==1) print }' \
48 < $install/etc/postfix/aliases > $fs/etc/postfix/aliases
49 while read keyword data; do
50 grep -q ^$keyword $fs/etc/postfix/main.cf && continue
51 mv $fs/etc/postfix/main.cf $fs/etc/postfix/main.cf.$$
52 awk "BEGIN { scan=1 } /^#$keyword / { if (scan) { print \"$keyword $data\" ; scan=0 } } { print }" \
53 < $fs/etc/postfix/main.cf.$$ > $fs/etc/postfix/main.cf
54 rm -f $fs/etc/postfix/main.cf.$$
55 done << EOF
56 mydomain = localdomain
57 myorigin = localhost
58 mydestination = localhost, localhost.\$mydomain
59 mynetworks = 127.0.0.0/8
60 alias_maps = hash:/etc/postfix/aliases
61 EOF
62 cat >> $fs/etc/postfix/main.cf <<EOF
64 # Unsafe, see CVE-2014-3566 POODLE
65 smtpd_tls_mandatory_protocols = !SSLv2, !SSLv3
66 EOF
67 cp -a $stuff/etc $fs
68 cp -a $install/var $fs
69 mv $fs/etc/postfix/TLS_LICENSE $fs/usr/share/licenses/POSTFIX_TLS_LICENSE
70 mv $fs/etc/postfix/LICENSE $fs/usr/share/licenses/POSTFIX_LICENSE
71 cp -a $stuff/etc/init.d $fs/etc
72 rm -f $fs/usr/lib/postfix/post* $fs/usr/lib/postfix/*.cf
73 strip -s $fs/usr/lib/postfix/*
74 }
76 # Pre and post install commands for Tazpkg.
77 post_install()
78 {
80 local user
81 local group
83 user=postfix
84 group=postdrop
86 if ! grep -q $user "$1/etc/passwd"; then
87 echo -n "Adding user/group $user..."
88 chroot "$1/" addgroup -S $user
89 chroot "$1/" adduser -S -D -H -G $user $user
90 chroot "$1/" addgroup -S $group
91 status
92 fi
94 # addgroup postdrop if needed
95 if ! grep -q postdrop "$1/etc/group"; then
96 echo -n "Adding group ${group}..."
97 chroot "$1/" addgroup -S $group
98 status
99 fi
101 chroot "$1/" chown ${user} /var/spool/postfix/* /var/lib/postfix
102 chroot "$1/" chgrp ${group} /var/spool/postfix/maildrop \
103 /var/spool/postfix/public /usr/sbin/postdrop /usr/sbin/postqueue
104 chmod 2755 "$1/usr/sbin/postdrop" "$1/usr/sbin/postqueue"
105 chmod 2710 "$1/var/spool/postfix/public"
106 chmod 1730 "$1/var/spool/postfix/maildrop"
107 chroot "$1/" postalias /etc/postfix/aliases
108 cat <<EOF
110 ----
111 Warning: you still need to edit myorigin/mydestination/mynetworks
112 parameter settings in /etc/postfix/main.cf.
113 See also http://www.postfix.org/STANDARD_CONFIGURATION_README.html
115 To start $PACKAGE server you can run :
117 /etc/init.d/$PACKAGE start
119 Or add $PACKAGE to RUN_DAEMONS in /etc/rcS.conf
120 ----
121 EOF
122 }
124 # Overlap busybox
125 pre_install()
126 {
127 rm -f "$1/usr/sbin/sendmail"
128 }
130 post_remove()
131 {
132 deluser postfix
133 delgroup postdrop
134 ln -s /bin/busybox /usr/sbin/sendmail
135 }