wok-backports rev 11

Add:Postfix
author Eric Joseph-Alexandre <erjo@slitaz.org>
date Sun Dec 22 22:11:30 2013 +0100 (2013-12-22)
parents fa2b4a5a32ec
children 3c61144dc012
files postfix/receipt postfix/stuff/etc/init.d/postfix
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/postfix/receipt	Sun Dec 22 22:11:30 2013 +0100
     1.3 @@ -0,0 +1,130 @@
     1.4 +# SliTaz package receipt.
     1.5 +
     1.6 +PACKAGE="postfix"
     1.7 +VERSION="2.10.2"
     1.8 +CATEGORY="network"
     1.9 +SHORT_DESC="fast, easy to administer, and secure mailer."
    1.10 +MAINTAINER="pascal.bellard@slitaz.org"
    1.11 +LICENSE="other"
    1.12 +TARBALL="$PACKAGE-$VERSION.tar.gz"
    1.13 +WEB_SITE="http://www.postfix.org/"
    1.14 +WGET_URL="ftp://ftp.cs.tu-berlin.de/pub/net/mail/postfix/official/$TARBALL"
    1.15 +TAZPANEL_DAEMON="man|edit::/etc/postfix/main.cf|options|web::$WEB_SITE"
    1.16 +CONFIG_FILES="/etc/postfix"
    1.17 +
    1.18 +DEPENDS="libdb libldap pcre libssl slitaz-base-files libsasl libkrb5 \
    1.19 +libcomerr3 libmysqlclient"
    1.20 +BUILD_DEPENDS="db-dev openldap-dev pcre-dev openssl-dev perl mysql-dev \
    1.21 +cyrus-sasl-dev libsasl"
    1.22 +
    1.23 +# Rules to configure and make the package.
    1.24 +compile_rules()
    1.25 +{
    1.26 +	cd $src
    1.27 +	make makefiles \
    1.28 +	CCARGS='-DHAS_DB -DHAS_LDAP \
    1.29 +		-DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I /usr/include/sasl \
    1.30 +		-DHAS_MYSQL -I/usr/include/mysql \
    1.31 +		-DDEF_DAEMON_DIR=\"/usr/lib/postfix\" \
    1.32 +		-DUSE_TLS \
    1.33 +		-DDEF_MANPAGE_DIR=\"/usr/share/man\"' \
    1.34 +	AUXLIBS="-ldb -lldap -llber -lsasl2 \
    1.35 +		-L/usr/lib/mysql -lmysqlclient -lz -lm " &&
    1.36 +	make
    1.37 +	install_root=$WOK/$PACKAGE/install \
    1.38 +		sh postfix-install -non-interactive
    1.39 +}
    1.40 +
    1.41 +# Rules to gen a SliTaz package suitable for Tazpkg.
    1.42 +genpkg_rules()
    1.43 +{
    1.44 +	mkdir -p $fs/usr/share/licenses/
    1.45 +	cp -a $install/usr/lib $fs/usr
    1.46 +	cp -a $install/usr/bin $fs/usr
    1.47 +	cp -a $install/usr/sbin $fs/usr
    1.48 +	cp -a $install/etc $fs
    1.49 +
    1.50 +	awk 'BEGIN {n=0} /MUST/ {n++} /ALIASES/ {n++} { if (n==1) print }' \
    1.51 +		< $install/etc/postfix/aliases > $fs/etc/postfix/aliases
    1.52 +	while read keyword data; do
    1.53 +		grep -q ^$keyword $fs/etc/postfix/main.cf && continue
    1.54 +		mv $fs/etc/postfix/main.cf $fs/etc/postfix/main.cf.$$
    1.55 +		awk "BEGIN { scan=1 } /^#$keyword / { if (scan) { print \"$keyword $data\" ; scan=0 } } { print }" \
    1.56 +			< $fs/etc/postfix/main.cf.$$ > $fs/etc/postfix/main.cf
    1.57 +		rm -f $fs/etc/postfix/main.cf.$$
    1.58 +	done << EOF
    1.59 +mydomain = localdomain
    1.60 +myorigin = localhost
    1.61 +mydestination = localhost, localhost.\$mydomain
    1.62 +mynetworks = 127.0.0.0/8
    1.63 +alias_maps = hash:/etc/postfix/aliases
    1.64 +EOF
    1.65 +	cp -a $stuff/etc $fs
    1.66 +	cp -a $install/var $fs
    1.67 +	mv $fs/etc/postfix/TLS_LICENSE $fs/usr/share/licenses/POSTFIX_TLS_LICENSE
    1.68 +	mv $fs/etc/postfix/LICENSE $fs/usr/share/licenses/POSTFIX_LICENSE
    1.69 +	cp -a $stuff/etc/init.d $fs/etc
    1.70 +	rm -f $fs/usr/lib/postfix/post* $fs/usr/lib/postfix/*.cf
    1.71 +	strip -s $fs/usr/lib/postfix/*
    1.72 +}
    1.73 +
    1.74 +# Pre and post install commands for Tazpkg.
    1.75 +post_install()
    1.76 +{
    1.77 +
    1.78 +	local user
    1.79 +	local group
    1.80 +	
    1.81 +	user=postfix
    1.82 +	group=postdrop
    1.83 +	
    1.84 +	if ! grep -q $user $1/etc/passwd; then
    1.85 +		echo -n "Adding user/group $user..."
    1.86 +		chroot $1/ addgroup -S $user
    1.87 +		chroot $1/ adduser -S -D -H -G $user $user
    1.88 +		chroot $1/ addgroup -S $group
    1.89 +		status
    1.90 +	fi
    1.91 +
    1.92 +	# addgroup postdrop if needed
    1.93 +	if ! grep -q postdrop $1/etc/group; then
    1.94 +		echo -n "Adding group ${group}..."
    1.95 +		chroot $1/ addgroup -S $group
    1.96 +		status
    1.97 +	fi
    1.98 +
    1.99 +	chroot $1/ chown ${user} /var/spool/postfix/* /var/lib/postfix
   1.100 +	chroot $1/ chgrp ${group} /var/spool/postfix/maildrop \
   1.101 +		/var/spool/postfix/public /usr/sbin/postdrop /usr/sbin/postqueue
   1.102 +	chmod 2755 $1/usr/sbin/postdrop $1/usr/sbin/postqueue
   1.103 +	chmod 2710 $1/var/spool/postfix/public
   1.104 +	chmod 1730 $1/var/spool/postfix/maildrop
   1.105 +	chroot $1/ postalias /etc/postfix/aliases
   1.106 +	cat <<EOF
   1.107 +	
   1.108 +----
   1.109 +Warning: you still need to edit myorigin/mydestination/mynetworks
   1.110 +parameter settings in /etc/postfix/main.cf.
   1.111 +See also http://www.postfix.org/STANDARD_CONFIGURATION_README.html
   1.112 +
   1.113 +To start $PACKAGE server you can run :
   1.114 +
   1.115 +    /etc/init.d/$PACKAGE start
   1.116 +
   1.117 +Or add $PACKAGE to RUN_DAEMONS in /etc/rcS.conf
   1.118 +----
   1.119 +EOF
   1.120 +}
   1.121 +
   1.122 +# Overlap busybox
   1.123 +pre_install()
   1.124 +{
   1.125 +	rm -f $1/usr/sbin/sendmail
   1.126 +}
   1.127 +
   1.128 +post_remove()
   1.129 +{
   1.130 +	deluser postfix
   1.131 +	delgroup postdrop
   1.132 +	ln -s /bin/busybox /usr/sbin/sendmail
   1.133 +}
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/postfix/stuff/etc/init.d/postfix	Sun Dec 22 22:11:30 2013 +0100
     2.3 @@ -0,0 +1,65 @@
     2.4 +#!/bin/sh
     2.5 +# /etc/init.d/postfix : Start, stop and restart SMTP server on SliTaz, at
     2.6 +# boot time or with the command line.
     2.7 +#
     2.8 +# To start SMTP server at boot time, just put postfix in the $RUN_DAEMONS
     2.9 +# variable of /etc/rcS.conf and configure options with /etc/daemons.conf
    2.10 +#
    2.11 +. /etc/init.d/rc.functions
    2.12 +. /etc/daemons.conf
    2.13 +
    2.14 +NAME=Postfix
    2.15 +DESC="SMTP server"
    2.16 +DAEMON=/usr/lib/postfix/master
    2.17 +OPTIONS=$POSTFIX_OPTIONS
    2.18 +PIDFILE=/var/spool/postfix/pid/master.pid
    2.19 +
    2.20 +case "$1" in
    2.21 +  start)
    2.22 +    if active_pidfile $PIDFILE master ; then
    2.23 +      echo "$NAME already running."
    2.24 +      exit 1
    2.25 +    fi
    2.26 +    echo -n "Starting $DESC: $NAME... "
    2.27 +    $DAEMON $OPTIONS &
    2.28 +    status
    2.29 +    ;;
    2.30 +  stop)
    2.31 +    if ! active_pidfile $PIDFILE master ; then
    2.32 +      echo "$NAME is not running."
    2.33 +      exit 1
    2.34 +    fi
    2.35 +    echo -n "Stopping $DESC: $NAME... "
    2.36 +    kill `cat $PIDFILE` && rm -f $PIDFILE
    2.37 +    status
    2.38 +    ;;
    2.39 +  restart)
    2.40 +    if ! active_pidfile $PIDFILE master ; then
    2.41 +      echo "$NAME is not running."
    2.42 +      exit 1
    2.43 +    fi
    2.44 +    echo -n "Restarting $DESC: $NAME... "
    2.45 +    kill `cat $PIDFILE` && rm -f $PIDFILE
    2.46 +    sleep 2
    2.47 +    $DAEMON $OPTIONS &
    2.48 +    status
    2.49 +    ;;
    2.50 +  reload)
    2.51 +    if ! active_pidfile $PIDFILE master ; then
    2.52 +      echo "$NAME is not running."
    2.53 +      exit 1
    2.54 +    fi
    2.55 +    postsuper active || exit 1
    2.56 +    kill -HUP `cat $PIDFILE`
    2.57 +    postsuper &
    2.58 +    status
    2.59 +    ;;
    2.60 +  *)
    2.61 +    echo ""
    2.62 +    echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart|reload]"
    2.63 +    echo ""
    2.64 +    exit 1
    2.65 +    ;;
    2.66 +esac
    2.67 +
    2.68 +exit 0