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