wok view postfix/receipt @ rev 23607

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