aegir-provision2.postinst 1.91 KB
Newer Older
1
#!/bin/sh
anarcat's avatar
anarcat committed
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
# postinst script for provision
#
# see: dh_installdeb(1)

set -e

# summary of how this script can be called:
#        * <postinst> `configure' <most-recently-configured-version>
#        * <old-postinst> `abort-upgrade' <new version>
#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
#          <new-version>
#        * <postinst> `abort-remove'
#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
#          <failed-install-package> <version> `removing'
#          <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package

anarcat's avatar
anarcat committed
20 21 22
# Source debconf library.
. /usr/share/debconf/confmodule

23
if [ "$DPKG_DEBUG" = "developer" ]; then
24 25 26
    set -x
fi

anarcat's avatar
anarcat committed
27
VARLIB="/var/aegir"
anarcat's avatar
anarcat committed
28 29 30 31 32 33 34 35 36 37 38 39 40 41

case "$1" in
    configure)
        # add a aegir user if one does not already exist
        if ! getent passwd aegir >/dev/null ; then
            echo "adding aegir user..."
            adduser --quiet --system --no-create-home --group \
                --home "$VARLIB" \
                --shell '/bin/bash' \
                --gecos 'Aegir user,,,' \
                aegir
        fi
        adduser --quiet aegir www-data

anarcat's avatar
anarcat committed
42
        if [ -d /etc/sudoers.d ]; then
43
            ucf --debconf-ok /usr/share/doc/aegir-provision2/examples/example.sudoers /etc/sudoers.d/aegir
anarcat's avatar
anarcat committed
44 45 46 47
            ucfr aegir-provision /etc/sudoers.d/aegir
            chmod 440 /etc/sudoers.d/aegir
        else
            echo "running an older version of sudo"
48
            echo "copy content of /usr/share/doc/aegir-provision2/examples/example.sudoers into /etc/sudoers for aegir to run properly"
anarcat's avatar
anarcat committed
49
        fi
anarcat's avatar
anarcat committed
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
    ;;

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

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

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0