aegir3-hostmaster.config 2.32 KB
Newer Older
1
2
3
4
5
6
7
#! /bin/sh

set -e

# Source debconf library.
. /usr/share/debconf/confmodule

8
if [ "$DPKG_DEBUG" = "developer" ]; then
9
10
11
    set -x
fi

anarcat's avatar
anarcat committed
12
if su -s /bin/sh aegir -c 'drush @hostmaster status' 2>&1 | grep -q 'Drupal bootstrap.*Successful'; then
13
    # there's already an install, do not go around asking silly questions
14
15
16
17
18
    db_fget aegir/makefile "seen" || true
    if [ "$RET" = "false" ]; then
        # ... except if that makefile question was never asked, in
        # which case we're probably upgrading from a custom install,
        # so we need to ask for the custom install makefile
19
        db_fset aegir/makefile "seen" "false" || true
20
21
22
        db_input medium aegir/makefile || true
        db_go
    fi
23
24
25
    exit 0
fi

26
db_input medium aegir/email ||true
27
db_input high aegir/site || true
28
29
30
31
db_get aegir/email
if [ -z "$RET" ]; then
   db_set aegir/email "aegir@`hostname -f`"
fi
anarcat's avatar
anarcat committed
32
db_get aegir/site
33
34
35
36
if [ -z "$RET" ]; then
    db_set aegir/site `hostname -f`
fi
db_input low aegir/makefile || true
37
db_input low aegir/profile || true
38
db_input low aegir/working-copy || true
39
40
41
42
db_input low aegir/db_host || true
db_input low aegir/db_user || true
# if we got here, it means aegir is not installed and we forgot the
# root password, ask for it again
43
44
45
46
db_get aegir/db_password
if [ -z "$RET" ] ; then
    db_fset aegir/db_password "seen" "false" || true
fi
47
db_input high aegir/db_password || true
anarcat's avatar
anarcat committed
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81

# (taken from the webapps-common httpd functions)
# wc_httpd_installed: test for installed httpds
# usage:
#       wc_httpd_installed [ httpd1 httpd2 ... ]
#
# no arguments implies to test for all servers
wc_httpd_installed(){
        local httpds
        if [ "$*" ]; then
                httpds=$*
        else
                httpds=$wc_httpd_supported
        fi
        for f in $httpds; do
                if test -x /usr/sbin/$f; then
                        echo $f
                fi
        done
}

# list of installed servers to check for
default_servers=`wc_httpd_installed apache2 nginx`
# convert list to comma seperated list
server_list=`echo $default_servers | sed -e 's/[[:space:]][[:space:]]*/, /g'`

# if they haven't already been prompted, preseed the server selection
db_fget aegir/webserver seen
if [ "$RET" = "false" ]; then
        db_set aegir/webserver $server_list
fi
db_input low aegir/webserver || true

# alright, ask the questions that need to be asked
82
db_go