wok rev 7824

Add postfixadmin
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Dec 26 12:02:09 2010 +0100 (2010-12-26)
parents 5407406663a3
children 35515c7ce512
files postfixadmin/receipt postfixadmin/stuff/etc/mysql.d/postfixadmin postfixadmin/stuff/etc/pgsql.d/postfixadmin
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/postfixadmin/receipt	Sun Dec 26 12:02:09 2010 +0100
     1.3 @@ -0,0 +1,64 @@
     1.4 +# SliTaz package receipt.
     1.5 +
     1.6 +PACKAGE="postfixadmin"
     1.7 +VERSION="2.3.2"
     1.8 +CATEGORY="network"
     1.9 +SHORT_DESC="Postfix web administration."
    1.10 +MAINTAINER="pascal.bellard@slitaz.org"
    1.11 +TARBALL="$PACKAGE-$VERSION.tar.gz"
    1.12 +WEB_SITE="http://postfixadmin.sourceforge.net/"
    1.13 +WGET_URL="$SF_MIRROR/$PACKAGE/$TARBALL"
    1.14 +DEPENDS="php postfix mysql_or_postgresql"
    1.15 +
    1.16 +# Rules to configure and make the package.
    1.17 +compile_rules()
    1.18 +{
    1.19 +	cd $src
    1.20 +}
    1.21 +
    1.22 +# Rules to gen a SliTaz package suitable for Tazpkg.
    1.23 +genpkg_rules()
    1.24 +{
    1.25 +	mkdir -p $fs/usr/share/postfixadmin $fs/etc/postfix
    1.26 +	cp -a $src/* $fs/usr/share/postfixadmin/
    1.27 +	mv $fs/usr/share/postfixadmin/config.inc.php $fs/etc/postfix/postfixadmin.php
    1.28 +	ln -s /etc/postfix/postfixadmin.php $fs/usr/share/postfixadmin/config.inc.php
    1.29 +	sed -i 's/false/true/' $fs/etc/postfix/postfixadmin.php
    1.30 +}
    1.31 +
    1.32 +post_install()
    1.33 +{
    1.34 +	# Configure lighttpd server
    1.35 +	if [ -f $1/etc/lighttpd/lighttpd.conf ]; then
    1.36 +		if ! grep -q /usr/share/postfixadmin/ $1/etc/lighttpd/lighttpd.conf; then
    1.37 +	    		sed -e 's|.*"/examples/" => "/usr/share/examples/",|    "/examples/" => "/usr/share/examples/",\n    "/postfixadmin/" => "/usr/share/postfixadmin/",|g' -i $1/etc/lighttpd/lighttpd.conf
    1.38 +			if [ -z "$1" ]; then
    1.39 +				# Start Web server.
    1.40 +				/etc/init.d/lighttpd stop
    1.41 +				/etc/init.d/lighttpd start
    1.42 +			fi
    1.43 +		fi
    1.44 +	fi
    1.45 +	# Configure apache server
    1.46 +	if [ -f $1/etc/apache/httpd.conf ]; then
    1.47 +		if [ ! -f $1/etc/apache/conf.d/postfixadmin ]; then
    1.48 +			cat > $1/etc/apache/conf.d/postfixadmin <<EOT
    1.49 +<IfModule mod_alias.c>
    1.50 +    Alias /postfixadmin /usr/share/postfixadmin
    1.51 +</IfModule>
    1.52 +<DirectoryMatch /usr/share/postfixadmin/>
    1.53 +    DirectoryIndex index.php
    1.54 +    Options +FollowSymLinks
    1.55 +    AllowOverride None
    1.56 +    Order allow,deny
    1.57 +    Allow from all
    1.58 +</DirectoryMatch>
    1.59 +EOT
    1.60 +			if [ -z "$1" ]; then
    1.61 +				# Start Web server.
    1.62 +				/etc/init.d/apache stop
    1.63 +				/etc/init.d/apache start
    1.64 +			fi
    1.65 +		fi
    1.66 +	fi
    1.67 +}
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/postfixadmin/stuff/etc/mysql.d/postfixadmin	Sun Dec 26 12:02:09 2010 +0100
     2.3 @@ -0,0 +1,9 @@
     2.4 +#!/bin/sh
     2.5 +
     2.6 +mysqldump postfix > /dev/null 2>&1 || mysql <<EOT
     2.7 +CREATE DATABASE postfix;
     2.8 +CREATE USER 'postfix'@'localhost' IDENTIFIED BY 'postfix';
     2.9 +GRANT ALL PRIVILEGES ON `postfix` . * TO 'postfix'@'localhost';
    2.10 +EOT
    2.11 +
    2.12 +chmod -x /etc/mysql.d/postfixadmin
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/postfixadmin/stuff/etc/pgsql.d/postfixadmin	Sun Dec 26 12:02:09 2010 +0100
     3.3 @@ -0,0 +1,8 @@
     3.4 +#!/bin/sh
     3.5 +
     3.6 +su - postgres -c psql <<EOT
     3.7 +CREATE USER postfix WITH PASSWORD 'postfix';
     3.8 +CREATE DATABASE postfix OWNER postfix ENCODING 'unicode';
     3.9 +EOT
    3.10 +
    3.11 +chmod -x /etc/pgsql.d/postfixadmin