wok-6.x rev 12040

postfix: Improve receipt + fix addgroup command
author Eric Joseph-Alexandre <erjo@slitaz.org>
date Wed Mar 07 16:30:58 2012 +0100 (2012-03-07)
parents 184b534ff76f
children 9724eaf37b53
files postfix/receipt
line diff
     1.1 --- a/postfix/receipt	Wed Mar 07 13:55:33 2012 +0100
     1.2 +++ b/postfix/receipt	Wed Mar 07 16:30:58 2012 +0100
     1.3 @@ -9,8 +9,7 @@
     1.4  WEB_SITE="http://www.postfix.org/"
     1.5  WGET_URL="ftp://ftp.cs.tu-berlin.de/pub/net/mail/postfix/official/$TARBALL"
     1.6  BUILD_DEPENDS="db-dev openldap-dev pcre-dev openssl-dev perl mysql-dev libsasl"
     1.7 -DEPENDS="libdb libldap pcre libssl slitaz-base-files libsasl \
     1.8 -libkrb5 libcomerr3"
     1.9 +DEPENDS="libdb libldap pcre libssl slitaz-base-files libsasl libkrb5 libcomerr3"
    1.10  CONFIG_FILES="/etc/postfix"
    1.11  
    1.12  # Rules to configure and make the package.
    1.13 @@ -25,23 +24,21 @@
    1.14  	AUXLIBS="-ldb -lldap -llber \
    1.15  		-L/usr/lib/mysql -lmysqlclient -lz -lm " &&
    1.16  	make
    1.17 -	install_root=$PWD/_pkg \
    1.18 +	install_root=$WOK/$PACKAGE/install \
    1.19  		sh postfix-install -non-interactive
    1.20 -#	install_root=$install \
    1.21 -#		sh postfix-install -non-interactive
    1.22  }
    1.23  
    1.24  # Rules to gen a SliTaz package suitable for Tazpkg.
    1.25  genpkg_rules()
    1.26  {
    1.27  	mkdir -p $fs/usr/share/licenses/
    1.28 -	cp -a $_pkg/usr/lib $fs/usr
    1.29 -	cp -a $_pkg/usr/bin $fs/usr
    1.30 -	cp -a $_pkg/usr/sbin $fs/usr
    1.31 -	cp -a $_pkg/etc $fs
    1.32 +	cp -a $install/usr/lib $fs/usr
    1.33 +	cp -a $install/usr/bin $fs/usr
    1.34 +	cp -a $install/usr/sbin $fs/usr
    1.35 +	cp -a $install/etc $fs
    1.36  
    1.37  	awk 'BEGIN {n=0} /MUST/ {n++} /ALIASES/ {n++} { if (n==1) print }' \
    1.38 -		< $_pkg/etc/postfix/aliases > $fs/etc/postfix/aliases
    1.39 +		< $install/etc/postfix/aliases > $fs/etc/postfix/aliases
    1.40  	while read keyword data; do
    1.41  		grep -q ^$keyword $fs/etc/postfix/main.cf && continue
    1.42  		mv $fs/etc/postfix/main.cf $fs/etc/postfix/main.cf.$$
    1.43 @@ -56,7 +53,7 @@
    1.44  alias_maps = hash:/etc/postfix/aliases
    1.45  EOF
    1.46  	cp -a $stuff/etc $fs
    1.47 -	cp -a $_pkg/var $fs
    1.48 +	cp -a $install/var $fs
    1.49  	mv $fs/etc/postfix/TLS_LICENSE $fs/usr/share/licenses/POSTFIX_TLS_LICENSE
    1.50  	mv $fs/etc/postfix/LICENSE $fs/usr/share/licenses/POSTFIX_LICENSE
    1.51  	cp -a $stuff/etc/init.d $fs/etc
    1.52 @@ -67,27 +64,37 @@
    1.53  # Pre and post install commands for Tazpkg.
    1.54  post_install()
    1.55  {
    1.56 -    # adduser postfix if needed
    1.57 -	if ! grep -q postfix $1/etc/passwd; then
    1.58 -		echo -n "Adding user Postfix..."
    1.59 -		chroot $1/ adduser -s /bin/false -h /dev/null \
    1.60 -			-g "Postfix Daemon user" -u 75 -H -D postfix
    1.61 +
    1.62 +	local user
    1.63 +	local group
    1.64 +	
    1.65 +	user=postfix
    1.66 +	group=postdrop
    1.67 +	
    1.68 +	if ! grep -q $user $1/etc/passwd; then
    1.69 +		echo -n "Adding user/group $user..."
    1.70 +		chroot $1/ addgroup -S $user
    1.71 +		chroot $1/ adduser -S -D -H -G $user $user
    1.72 +		chroot $1/ addgroup -S $group
    1.73  		status
    1.74  	fi
    1.75 +
    1.76  	# addgroup postdrop if needed
    1.77  	if ! grep -q postdrop $1/etc/group; then
    1.78 -		echo -n "Adding group postdrop..."
    1.79 -		chroot $1/ addgroup -u 73 postdrop
    1.80 +		echo -n "Adding group ${group}..."
    1.81 +		chroot $1/ addgroup -S $group
    1.82  		status
    1.83  	fi
    1.84 -	chroot $1/ sh -c 'chown postfix /var/spool/postfix/* /var/lib/postfix'
    1.85 -	chroot $1/ chgrp postdrop /var/spool/postfix/maildrop \
    1.86 +
    1.87 +	chroot $1/ chown ${user} /var/spool/postfix/* /var/lib/postfix
    1.88 +	chroot $1/ chgrp ${group} /var/spool/postfix/maildrop \
    1.89  		/var/spool/postfix/public /usr/sbin/postdrop /usr/sbin/postqueue
    1.90  	chmod 2755 $1/usr/sbin/postdrop $1/usr/sbin/postqueue
    1.91  	chmod 2710 $1/var/spool/postfix/public
    1.92  	chmod 1730 $1/var/spool/postfix/maildrop
    1.93  	chroot $1/ postalias /etc/postfix/aliases
    1.94  	cat <<EOF
    1.95 +	
    1.96  ----
    1.97  Warning: you still need to edit myorigin/mydestination/mynetworks
    1.98  parameter settings in /etc/postfix/main.cf.