source: alternc/branches/last_working_20110522/debian/alternc.config @ 2952

Revision 2952, 4.1 KB checked in by xals, 2 years ago (diff)

Commit fichier qui ne semble pas casser le build

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
22db_input critical alternc/warningaclquota || true
23
24# default values for local.sh
25MYSQL_HOST=127.0.0.1
26MYSQL_DATABASE=alternc
27MYSQL_USER=sysusr
28MYSQL_PASS="`perl -e 'print map{("a".."z","A".."Z",0..9)[int(rand(62))]}(1..10)' `"
29MYSQL_CLIENT=localhost
30FQDN="`cat /etc/mailname 2>/dev/null || hostname -f`"
31INTERNAL_IP="`env LANG=C /sbin/ifconfig|grep inet | grep -v 127.0.0.1| head -1 | cut -d: -f2 | sed -e 's/\([0-9\.]*\).*$/\1/' 2>/dev/null || hostname -f`"
32PUBLIC_IP="$INTERNAL_IP"
33DEFAULT_MX="`cat /etc/mailname 2>/dev/null || hostname -f`"
34ALTERNC_LOC=/var/alternc
35NS1_HOSTNAME="$FQDN"
36NS2_HOSTNAME="$FQDN"
37HOSTING="AlternC"
38SQLBACKUP_TYPE="rotate"
39SQLBACKUP_OVERWRITE="no"
40
41if [ -r /etc/alternc/local.sh ]; then
42    # source the current config
43    . /etc/alternc/local.sh
44fi
45if [ -r /etc/alternc/my.cnf ]; then
46    # make mysql configuration available as shell variables
47    # to convert from .cnf to shell syntax, we:
48    # * match only lines with "equal" in them (/=/)
49    # * remove whitespace around the = and add a left quote operator ' (;s)
50    # * add a right quote operator at the end of line (;s)
51    # * convert mysql variables into our MYSQL_ naming convention (;s)
52    # * print the result (;p)
53    eval `sed -n -e "/=/{s/ *= *\"\?/='/;s/\"\?\$/'/;s/host/MYSQL_HOST/;s/user/MYSQL_USER/;s/password/MYSQL_PASS/;s/database/MYSQL_DATABASE/;p}" /etc/alternc/my.cnf`
54fi
55
56# mettre les valeurs de local.sh comme "default" pour debconf
57db_get alternc/hostingname
58if [ -z "$RET" ]
59    then
60    db_set alternc/hostingname "$HOSTING"
61fi
62
63db_get alternc/desktopname
64if [ -z "$RET" ]
65    then
66db_set alternc/desktopname "$FQDN"
67fi
68
69db_get alternc/public_ip
70if [ -z "$RET" ]
71    then
72db_set alternc/public_ip "$PUBLIC_IP"
73fi
74
75db_get alternc/internal_ip
76if [ -z "$RET" ]
77    then
78db_set alternc/internal_ip "$INTERNAL_IP"
79fi
80
81db_get alternc/monitor_ip
82if [ -z "$RET" ]
83    then
84db_set alternc/monitor_ip "$MONITOR_IP"
85fi
86
87db_get alternc/ns1
88if [ -z "$RET" ]
89    then
90db_set alternc/ns1 "$NS1_HOSTNAME"
91fi
92
93db_get alternc/ns2
94if [ -z "$RET" ]
95    then
96db_set alternc/ns2 "$NS2_HOSTNAME"
97fi
98
99db_get alternc/default_mx
100if [ -z "$RET" ]
101    then
102db_set alternc/default_mx "$DEFAULT_MX"
103fi
104
105db_get alternc/mysql/host
106if [ -z "$RET" ]
107    then
108db_set alternc/mysql/host "$MYSQL_HOST"
109fi
110
111db_get alternc/mysql/db
112if [ -z "$RET" ]
113    then
114db_set alternc/mysql/db "$MYSQL_DATABASE"
115fi
116
117db_get alternc/mysql/user
118if [ -z "$RET" ]
119    then
120db_set alternc/mysql/user "$MYSQL_USER"
121fi
122
123db_get alternc/mysql/password
124if [ -z "$RET" ]
125    then
126db_set alternc/mysql/password "$MYSQL_PASS"
127fi
128
129db_get alternc/mysql/client
130if [ -z "$RET" ]
131    then
132db_set alternc/mysql/client "$MYSQL_CLIENT"
133fi
134
135db_get alternc/sql/backup_type
136if [ -z "$RET" ]
137    then
138db_set alternc/sql/backup_type "$SQLBACKUP_TYPE"
139fi
140
141db_get alternc/sql/backup_overwrite
142if [ -z "$RET" ]
143    then
144db_set alternc/sql/backup_overwrite "$SQLBACKUP_OVERWRITE"
145fi
146
147db_get alternc/alternc_location
148if [ -z "$RET" ]
149    then
150db_set alternc/alternc_location "$ALTERNC_LOC"
151fi
152
153db_input medium alternc/desktopname || true
154db_input medium alternc/hostingname || true
155db_input medium alternc/internal_ip || true
156db_input medium alternc/public_ip || true
157db_input medium alternc/default_mx || true
158db_input medium alternc/ns1 || true
159db_input medium alternc/ns2 || true
160db_input low alternc/alternc_location || true
161db_input low alternc/mysql/host || true
162db_input low alternc/mysql/db || true
163db_input low alternc/mysql/user || true
164db_input low alternc/mysql/password || true
165db_input low alternc/mysql/client || true
166db_input low alternc/sql/backup_type || true
167db_input low alternc/sql/overwrite || true
168db_input low alternc/monitor_ip || true
169db_input low alternc/slaves || true
170db_go
171
172# vim: et sw=4
Note: See TracBrowser for help on using the repository browser.