wok view postfix/receipt @ rev 1203

postfix: set default localhost
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Aug 08 16:47:03 2008 +0000 (2008-08-08)
parents df33f077f61a
children 189b54af540e
line source
1 # SliTaz package receipt.
3 PACKAGE="postfix"
4 VERSION="2.5.2"
5 CATEGORY="network"
6 SHORT_DESC="fast, easy to administer, and secure mailer."
7 MAINTAINER="pascal.bellard@slitaz.org"
8 TARBALL="$PACKAGE-$VERSION.tar.gz"
9 WEB_SITE="http://www.postfix.org/"
10 WGET_URL="ftp://mir1.ovh.net/ftp.postfix.org/postfix-release/official/$TARBALL"
11 BUILD_DEPENDS="db-dev openldap-dev pcre-dev openssl-dev"
12 DEPENDS="libdb libldap pcre openssl"
13 CONFIG_FILES="/etc/postfix"
15 # Rules to configure and make the package.
16 compile_rules()
17 {
19 cd $src
20 make makefiles CCARGS="-DHAS_DB -DHAS_LDAP" AUXLIBS="-ldb -lldap -llber"
21 make
22 install_root=/home/slitaz/wok/postfix/postfix-2.5.2/_pkg \
23 sh postfix-install -non-interactive
24 }
26 # Rules to gen a SliTaz package suitable for Tazpkg.
27 genpkg_rules()
28 {
29 mkdir -p $fs/usr/share/licenses/
30 cp -a $_pkg/usr/libexec $fs/usr
31 cp -a $_pkg/usr/bin $fs/usr
32 cp -a $_pkg/usr/sbin $fs/usr
33 cp -a $_pkg/etc $fs
34 awk 'BEGIN {n=0} /MUST/ {n++} /ALIASES/ {n++} { if (n==1) print }' \
35 < $_pkg/etc/postfix/aliases > $fs/etc/postfix/aliases
36 while read keyword data; do
37 grep -q ^$keyword $fs/etc/postfix/main.cf && continue
38 mv $fs/etc/postfix/main.cf $fs/etc/postfix/main.cf.$$
39 awk "BEGIN { scan=1 } /^#$keyword / { if (scan) { print \"$keyword $data\" ; scan=0 } } { print }" \
40 < $fs/etc/postfix/main.cf.$$ > $fs/etc/postfix/main.cf
41 rm -f $fs/etc/postfix/main.cf.$$
42 done << EOF
43 mydomain = localdomain
44 myorigin = localhost
45 mydestination = localhost, localhost.\$mydomain
46 mynetworks = 127.0.0.0/8
47 alias_maps = hash:/etc/postfix/aliases
48 EOF
49 cp -a stuff/etc $fs
50 cp -a $_pkg/var $fs
51 mv $fs/etc/postfix/TLS_LICENSE $fs/usr/share/licenses/POSTFIX_TLS_LICENSE
52 mv $fs/etc/postfix/LICENSE $fs/usr/share/licenses/POSTFIX_LICENSE
53 cp -a stuff/etc/init.d $fs/etc
54 chmod 2755 $fs/usr/sbin/postdrop $fs/usr/sbin/postqueue
55 rm -f $fs/etc/postfix/post-install $fs/etc/postfix/postfix-files \
56 $fs/etc/postfix/postfix-script
57 }
59 # Pre and post install commands for Tazpkg.
60 post_install()
61 {
62 ( cd $1/ ; cpio -o -H newc | gzip -9 ) > \
63 $1/$INSTALLED/$PACKAGE/volatile.cpio.gz <<EOT
64 $(cd $1/ ; find etc/postfix -type f)
65 EOT
66 # adduser postfix if needed
67 if ! grep -q postfix $1/etc/passwd; then
68 echo -n "Adding user postfix..."
69 chroot $1/ adduser postfix -D -H -S -h /dev/null
70 status
71 fi
72 # addgroup postfix if needed
73 if ! grep -q postfix $1/etc/group; then
74 echo -n "Adding group postfix..."
75 chroot $1/ addgroup postfix && addgroup postfix postfix
76 status
77 fi
78 # addgroup postdrop if needed
79 if ! grep -q postdrop $1/etc/group; then
80 echo -n "Adding group postdrop..."
81 chroot $1/ addgroup postdrop
82 status
83 fi
84 chown postfix /var/spool/postfix/* /var/lib/postfix
85 chgrp postdrop /var/spool/postfix/maildrop /var/spool/postfix/public \
86 /usr/sbin/postdrop /usr/sbin/postqueue
87 postalias /etc/postfix/aliases
88 cat <<EOF
89 ----
90 Warning: you still need to edit myorigin/mydestination/mynetworks
91 parameter settings in /etc/postfix/main.cf.
92 See also http://www.postfix.org/STANDARD_CONFIGURATION_README.html
94 To start $PACKAGE server you can run :
96 /etc/init.d/$PACKAGE start
98 Or add $PACKAGE to RUN_DAEMONS in /etc/rcS.conf
99 ----
100 EOF
101 }
103 post_remove()
104 {
105 deluser postfix
106 delgroup postfix
107 delgroup postdrop
108 }
110 repack_cleanup()
111 {
112 zcat $INSTALLED/$PACKAGE/volatile.cpio.gz | ( cd $1 ; cpio -id )
113 }