source: alternc/trunk/debian/config @ 2048

Revision 2048, 3.3 KB checked in by anarcat, 6 years ago (diff)

properly prompt, with low priority, for the MYSQL_CLIENT parameter. AT LAST, this Closes: #1012

Line 
1#! /bin/sh
2
3set -e
4
5# Source debconf library.
6. /usr/share/debconf/confmodule
7db_title AlternC
8
9db_input critical alternc/welcomeconfirm || true
10
11db_go
12# Check the answer.
13db_get alternc/welcomeconfirm || true
14
15if [ "$RET" = "false" ]; then
16        # reset the welcomeconfirm flag if user refuses so it gets asked again next time
17        db_reset alternc/welcomeconfirm || true
18        db_fset alternc/welcomeconfirm "seen" "false" || true
19        exit 1
20fi
21
22# default values for local.sh
23MYSQL_HOST=127.0.0.1
24MYSQL_DATABASE=alternc
25MYSQL_USER=sysusr
26MYSQL_PASS="`perl -e 'print map{("a".."z","A".."Z",0..9)[int(rand(62))]}(1..10)' `"
27MYSQL_CLIENT=localhost
28FQDN="`cat /etc/mailname 2>/dev/null || hostname -f`"
29INTERNAL_IP="`/sbin/ifconfig|grep "inet addr:" | grep -v 127.0.0.1| head -1 | sed -e 's/^.*addr:\([0-9\.]*\).*$/\1/' 2>/dev/null || hostname -f`"
30PUBLIC_IP="$INTERNAL_IP"
31DEFAULT_MX="`cat /etc/mailname 2>/dev/null || hostname -f`"
32ALTERNC_LOC=/var/alternc
33NS1_HOSTNAME="$FQDN"
34NS2_HOSTNAME="$FQDN"
35HOSTING="AlternC"
36
37if [ -r /etc/alternc/local.sh ]; then
38    # source the current config
39    . /etc/alternc/local.sh
40fi
41
42# mettre les valeurs de local.sh comme "default" pour debconf
43db_get alternc/hostingname
44if [ -z "$RET" ]
45    then
46    db_set alternc/hostingname "$HOSTING"
47fi
48
49db_get alternc/desktopname
50if [ -z "$RET" ]
51    then
52db_set alternc/desktopname "$FQDN"
53fi
54
55db_get alternc/public_ip
56if [ -z "$RET" ]
57    then
58db_set alternc/public_ip "$PUBLIC_IP"
59fi
60
61db_get alternc/internal_ip
62if [ -z "$RET" ]
63    then
64db_set alternc/internal_ip "$INTERNAL_IP"
65fi
66
67db_get alternc/monitor_ip
68if [ -z "$RET" ]
69    then
70db_set alternc/monitor_ip "$MONITOR_IP"
71fi
72
73db_get alternc/ns1
74if [ -z "$RET" ]
75    then
76db_set alternc/ns1 "$NS1_HOSTNAME"
77fi
78
79db_get alternc/ns2
80if [ -z "$RET" ]
81    then
82db_set alternc/ns2 "$NS2_HOSTNAME"
83fi
84
85db_get alternc/bind_internal
86if [ -z "$RET" ]
87    then
88db_set alternc/bind_internal "$BIND_INTERNAL"
89fi
90
91db_get alternc/default_mx
92if [ -z "$RET" ]
93    then
94db_set alternc/default_mx "$DEFAULT_MX"
95fi
96
97db_get alternc/mysql/host
98if [ -z "$RET" ]
99    then
100db_set alternc/mysql/host "$MYSQL_HOST"
101fi
102
103db_get alternc/mysql/db
104if [ -z "$RET" ]
105    then
106db_set alternc/mysql/db "$MYSQL_DATABASE"
107fi
108
109db_get alternc/mysql/user
110if [ -z "$RET" ]
111    then
112db_set alternc/mysql/user "$MYSQL_USER"
113fi
114
115db_get alternc/mysql/password
116if [ -z "$RET" ]
117    then
118db_set alternc/mysql/password "$MYSQL_PASS"
119fi
120
121db_get alternc/mysql/client
122if [ -z "$RET" ]
123    then
124db_set alternc/mysql/client "$MYSQL_CLIENT"
125fi
126
127db_get alternc/alternc_location
128if [ -z "$RET" ]
129    then
130db_set alternc/alternc_location "$ALTERNC_LOC"
131fi
132
133db_get alternc/mynetwork
134if [ -z "$RET" ]
135    then
136db_set alternc/mynetwork "$SMTP_RELAY_NETWORKS"
137fi
138
139db_input medium alternc/desktopname || true
140db_input medium alternc/hostingname || true
141db_input medium alternc/internal_ip || true
142db_input medium alternc/public_ip || true
143db_input medium alternc/default_mx || true
144db_input medium alternc/ns1 || true
145db_input medium alternc/ns2 || true
146db_input low alternc/alternc_location || true
147db_input low alternc/mysql/host || true
148db_input low alternc/mysql/db || true
149db_input low alternc/mysql/user || true
150db_input low alternc/mysql/password || true
151db_input low alternc/mysql/client || true
152db_input low alternc/monitor_ip || true
153db_input low alternc/bind_internal || true
154db_input low alternc/mynetwork || true
155db_go
156
157# vim: et sw=4
Note: See TracBrowser for help on using the repository browser.