wok annotate postfix/receipt @ rev 24015

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