wok-backports annotate postfix/receipt @ rev 55

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