#!/bin/sh -e

case "$1" in
    configure)
        # enable Apache userdir
        a2enmod userdir
        mkdir -p /srv/udd.debian.org
        chmod -R g+w /srv
        chgrp -R admin /srv
        cd /srv
        echo "TODO: cd /srv ; git clone salsa:blends/website"
        if [ ! -L udd ] ; then
            ln -sf udd.debian.org udd
        fi
        echo "TODO: cd udd ; git clone salsa:qa/udd"

        chown -R postgres: /etc/postgresql
	su postgres -c "/usr/bin/createuser --createdb --createrole --superuser andreas 2>/dev/null || true"
	su postgres -c "/usr/bin/createuser --createdb --createrole --superuser tille 2>/dev/null || true"
	su postgres -c "/usr/bin/createuser guest 2>/dev/null || true"
	su postgres -c "/usr/bin/createuser sukhbir 2>/dev/null || true"
    ;;

    abort-upgrade|abort-remove|abort-deconfigure)
    ;;

    *)
        echo "postinst called with unknown argument \`$1'" >&2
        exit 1
    ;;
esac

#DEBHELPER#
