wok view postfix/receipt @ rev 20319

Up tazlito (501)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun May 20 13:28:18 2018 +0200 (22 months ago)
parents 7da4e0fcfa8c
children 8b06244cfb19
line source
1 # SliTaz package receipt.
3 PACKAGE="postfix"
4 VERSION="3.2.0"
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://mir1.ovh.net/ftp.postfix.org/postfix-release/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 export install_root=$DESTDIR
35 sh postfix-install -non-interactive 2>&1 | grep -v warning:
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
88 echo -n "Adding user/group $user..."
89 chroot "$1/" addgroup -S $user
90 chroot "$1/" adduser -S -D -H -G $user $user
91 chroot "$1/" addgroup -S $group
92 status
93 fi
95 # addgroup postdrop if needed
96 if ! grep -q postdrop "$1/etc/group"; then
97 echo
98 echo -n "Adding group ${group}..."
99 chroot "$1/" addgroup -S $group
100 status
101 fi
103 chroot "$1/" chown ${user} /var/spool/postfix/* /var/lib/postfix
104 chroot "$1/" chgrp ${group} /var/spool/postfix/maildrop \
105 /var/spool/postfix/public /usr/sbin/postdrop /usr/sbin/postqueue
106 chmod 2755 "$1/usr/sbin/postdrop" "$1/usr/sbin/postqueue"
107 chmod 2710 "$1/var/spool/postfix/public"
108 chmod 1730 "$1/var/spool/postfix/maildrop"
109 chroot "$1/" postalias /etc/postfix/aliases
110 cat <<EOF
112 ----
113 Warning: you still need to edit myorigin/mydestination/mynetworks
114 parameter settings in /etc/postfix/main.cf.
115 See also http://www.postfix.org/STANDARD_CONFIGURATION_README.html
117 To start $PACKAGE server you can run :
119 /etc/init.d/$PACKAGE start
121 Or add $PACKAGE to RUN_DAEMONS in /etc/rcS.conf
122 ----
123 EOF
124 }
126 # Overlap busybox
127 pre_install()
128 {
129 rm -f "$1/usr/sbin/sendmail"
130 }
132 post_remove()
133 {
134 deluser postfix
135 delgroup postdrop
136 ln -s /bin/busybox /usr/sbin/sendmail
137 }