wok-next view postfix/receipt @ rev 21020

Cleaning is almost finished... I should proceed to upgrades.
author Aleksej Bobylev <al.bobylev@gmail.com>
date Fri Nov 02 14:15:08 2018 +0200 (2018-11-02)
parents e6615350078d
children
line source
1 # SliTaz package receipt v2.
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"
13 BUILD_DEPENDS="db-dev openldap-dev pcre-dev openssl-dev perl mysql-dev \
14 cyrus-sasl-dev libsasl"
15 SPLIT="$PACKAGE-mysql"
17 compile_rules() {
18 make makefiles \
19 CCARGS='-DHAS_DB -DHAS_LDAP \
20 -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I /usr/include/sasl \
21 -DHAS_MYSQL -I/usr/include/mysql \
22 -DDEF_DAEMON_DIR=\"/usr/lib/postfix\" \
23 -DUSE_TLS \
24 -DDEF_MANPAGE_DIR=\"/usr/share/man\"' \
25 AUXLIBS="-ldb -lldap -llber -lsasl2 -lssl -lcrypto -lpthread \
26 -L/usr/lib/mysql -lmysqlclient -lz -lm " &&
27 make &&
28 install_root=$WOK/$PACKAGE/install \
29 sh postfix-install -non-interactive
30 }
32 genpkg_rules() {
33 case $PACKAGE in
34 postfix)
35 TAZPANEL_DAEMON="man|edit::/etc/postfix/main.cf|options|web::$WEB_SITE"
36 CONFIG_FILES="/etc/postfix"
37 PROVIDE="sendmail"
38 DEPENDS="libdb libldap pcre openssl slitaz-base-files libsasl \
39 libkrb5 libcomerr3 libmysqlclient"
40 mkdir -p $fs/usr/share/licenses/
41 cp -a $install/usr/lib $fs/usr
42 cp -a $install/usr/bin $fs/usr
43 cp -a $install/usr/sbin $fs/usr
44 cp -a $install/etc $fs
46 awk 'BEGIN {n=0} /MUST/ {n++} /ALIASES/ {n++} { if (n==1) print }' \
47 < $install/etc/postfix/aliases > $fs/etc/postfix/aliases
48 while read keyword data; do
49 grep -q ^$keyword $fs/etc/postfix/main.cf && continue
50 mv $fs/etc/postfix/main.cf $fs/etc/postfix/main.cf.$$
51 awk "BEGIN { scan=1 } /^#$keyword / { if (scan) { print \"$keyword $data\"; scan=0 } } { print }" \
52 < $fs/etc/postfix/main.cf.$$ > $fs/etc/postfix/main.cf
53 rm -f $fs/etc/postfix/main.cf.$$
54 done << EOF
55 mydomain = localdomain
56 myorigin = localhost
57 mydestination = localhost, localhost.\$mydomain
58 mynetworks = 127.0.0.0/8
59 alias_maps = hash:/etc/postfix/aliases
60 EOF
61 cat >> $fs/etc/postfix/main.cf <<EOF
63 # Unsafe, see CVE-2014-3566 POODLE
64 smtpd_tls_mandatory_protocols = !SSLv2, !SSLv3
65 EOF
66 cp -a $stuff/etc $fs
67 cp -a $install/var $fs
68 mv $fs/etc/postfix/TLS_LICENSE $fs/usr/share/licenses/POSTFIX_TLS_LICENSE
69 mv $fs/etc/postfix/LICENSE $fs/usr/share/licenses/POSTFIX_LICENSE
70 cp -a $stuff/etc/init.d $fs/etc
71 rm -f $fs/usr/lib/postfix/post* $fs/usr/lib/postfix/*.cf
72 strip -s $fs/usr/lib/postfix/*
73 ;;
74 *-mysql)
75 CAT="network|postfix support"
76 DEPENDS="postfix libmysqlclient"
77 mkdir -p $fs/usr/lib/postfix/
78 cp -a $src/src/global/dict_mysql.o $fs/usr/lib/postfix
79 ;;
80 esac
81 }
83 post_install_postfix() {
84 local user
85 local group
87 user=postfix
88 group=postdrop
90 if ! grep -q $user "$1/etc/passwd"; then
91 echo -n "Adding user/group $user..."
92 chroot "$1/" addgroup -S $user
93 chroot "$1/" adduser -S -D -H -G $user $user
94 chroot "$1/" addgroup -S $group
95 status
96 fi
98 # addgroup postdrop if needed
99 if ! grep -q postdrop "$1/etc/group"; then
100 echo -n "Adding group $group..."
101 chroot "$1/" addgroup -S $group
102 status
103 fi
105 chroot "$1/" chown $user /var/spool/postfix/* /var/lib/postfix
106 chroot "$1/" chgrp $group /var/spool/postfix/maildrop \
107 /var/spool/postfix/public /usr/sbin/postdrop /usr/sbin/postqueue
108 chmod 2755 "$1/usr/sbin/postdrop" "$1/usr/sbin/postqueue"
109 chmod 2710 "$1/var/spool/postfix/public"
110 chmod 1730 "$1/var/spool/postfix/maildrop"
111 chroot "$1/" postalias /etc/postfix/aliases
112 cat <<EOF
114 .-----------------------------------------------------------.
115 | WARNING: |
116 | you still need to edit myorigin/mydestination/mynetworks |
117 | parameter settings in /etc/postfix/main.cf. |
118 | See also: |
119 | http://www.postfix.org/STANDARD_CONFIGURATION_README.html |
120 |-----------------------------------------------------------|
121 | To start postfix server you can run: |
122 | |
123 | /etc/init.d/$PACKAGE start |
124 | |
125 | or add postfix to RUN_DAEMONS in /etc/rcS.conf |
126 '-----------------------------------------------------------'
127 EOF
128 }
130 # Overlap busybox
131 pre_install_postfix() {
132 rm -f "$1/usr/sbin/sendmail"
133 }
135 post_remove_postfix() {
136 deluser postfix
137 delgroup postdrop
138 ln -s /bin/busybox /usr/sbin/sendmail
139 }