aegir-provision.postinst 2.34 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

anarcat's avatar
anarcat committed
23
VARLIB="/var/aegir"
anarcat's avatar
anarcat committed
24
25
26
27
28
29
30
31
32
33
34
35
36
37

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
38
        if [ -d /etc/sudoers.d ]; then
39
            ucf --debconf-ok /usr/share/doc/aegir-provision/examples/examples.sudoers /etc/sudoers.d/aegir
anarcat's avatar
anarcat committed
40
41
42
43
            ucfr aegir-provision /etc/sudoers.d/aegir
            chmod 440 /etc/sudoers.d/aegir
        else
            echo "running an older version of sudo"
44
            echo "copy content of /usr/share/doc/aegir-provision/examples/examples.sudoers into /etc/sudoers for aegir to run properly"
anarcat's avatar
anarcat committed
45
        fi
anarcat's avatar
anarcat committed
46

anarcat's avatar
anarcat committed
47
48
49
50
51
        if [ -d $VARLIB/.drush/provision ]; then
            echo "existing provision in $VARLIB/.drush/provision detected, move away and try again"
            exit 1
        fi

anarcat's avatar
anarcat committed
52
53
        # fix permissions on installed directories
        chown aegir:aegir "$VARLIB"
anarcat's avatar
anarcat committed
54
55
56
57
        # make sure we have apache configs settled in, for remote headless aegir servers
        touch $VARLIB/config/apache.conf
        ln -sf $VARLIB/config/apache.conf /etc/apache2/conf.d/aegir.conf
        apache2ctl graceful
anarcat's avatar
anarcat committed
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
    ;;

    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