INPUTS := configuration/* configuration/mysql/*
-all: $(INPUTS:configuration/%=$(DST)/%)
+all: $(INPUTS:configuration/%=$(DST)/%) postfixadmin
+
+postfixadmin:
+ ./setup-postfix.sh
$(DST)/%: $(SRC)/%
@mkdir -p $(@D)
--- /dev/null
+<?php
+$CONF['configured'] = true;
+$CONF['setup_password'] = 'e4a6f79aadbb1af88ff390be0d2e5687:dfabdc4772c6b8bd56cc8ba41fdc95dfe0e39b27';
+$CONF['postfix_admin_url'] = '/postfixadmin';
+$CONF['database_type'] = 'mysql';
+$CONF['database_host'] = 'localhost';
+$CONF['database_user'] = 'postfix';
+$CONF['database_password'] = 'postfix';
+$CONF['database_name'] = 'postfix';
+
+$CONF['admin_email'] = 'postmaster@pley.net';
+$CONF['default_aliases'] = array (
+ 'abuse' => 'abuse@pley.net',
+ 'hostmaster' => 'hostmaster@pley.net',
+ 'postmaster' => 'postmaster@pley.net',
+ 'webmaster' => 'webmaster@pley.net'
+);
+$CONF['domain_path'] = 'YES';
+$CONF['transport'] = 'YES';
+$CONF['transport_options'] = array (
+ 'virtual', // for virtual accounts
+ 'local', // for system accounts
+ 'relay' // for backup mx
+ 'mailman' // for mailing lists
+);
+
+$CONF['user_footer_link'] = "http://mail.pley.net/postfixadmin/main";
+$CONF['show_footer_text'] = 'NO';
--- /dev/null
+Alias /postfixadmin /usr/local/share/postfixadmin
+
+<Directory /usr/local/share/postfixadmin>
+AllowOverride all
+</Directory>
--- /dev/null
+#!/bin/sh
+
+if [[ -z "$( mysql -u root -e 'SELECT User FROM mysql.user WHERE User = "postfix"' )" ]]; then
+ echo Creating \"postfix\" user.
+ mysql -u root -e 'CREATE USER "postfix"@"localhost" IDENTIFIED BY "postfix"'
+fi
+
+if [[ -z "$( mysql -u root -e 'SHOW DATABASES LIKE "postfix"' )" ]]; then
+ echo Creating \"postfix\" database.
+ mysql -u root -e 'CREATE DATABASE postfix'
+ mysql -u root -e 'GRANT ALL PRIVILEGES ON postfix.* TO "postfix"@"localhost"'
+ mysql -u root -e 'FLUSH PRIVILEGES'
+fi
+
+if [[ ! -d /usr/local/share/postfixadmin ]]; then
+ echo Installing postfixadmin
+ if [[ ! -d postfixadmin-code ]]; then
+ svn checkout svn://svn.code.sf.net/p/postfixadmin/code/tags/postfixadmin-2.3.8 postfixadmin-code
+ fi
+
+ sudo rsync -av --exclude '.svn' postfixadmin-code/ /usr/local/share/postfixadmin
+fi
+
+if [[ config.local.php -nt /usr/local/share/postfixadmin/config.local.php ]]; then
+ echo Configuring postfixadmin.
+ sudo cp config.local.php /usr/local/share/postfixadmin/config.local.php
+fi
+
+if [[ postfixadmin.conf -nt /etc/httpd/conf.d/postfixadmin.conf ]]; then
+ echo Configuring postfixadmin in Apache.
+ sudo cp postfixadmin.conf /etc/httpd/conf.d/postfixadmin.conf
+fi