wok-next annotate postfix/receipt @ rev 9672

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