| 1 |
#!/bin/sh |
|---|
| 2 |
|
|---|
| 3 |
set -e |
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
. /usr/share/debconf/confmodule |
|---|
| 7 |
|
|---|
| 8 |
CONFIGFILE="/etc/alternc/local.sh" |
|---|
| 9 |
|
|---|
| 10 |
update_var() { |
|---|
| 11 |
local question="$1" |
|---|
| 12 |
local var="$2" |
|---|
| 13 |
db_get "$question" |
|---|
| 14 |
if [ ! -z "$RET" ]; then |
|---|
| 15 |
grep -Eq "^ *$var=" $CONFIGFILE || echo "$var=" >> $CONFIGFILE |
|---|
| 16 |
SED_SCRIPT="$SED_SCRIPT;s\\^ *$var=.*\\$var=\"$RET\"\\" |
|---|
| 17 |
fi |
|---|
| 18 |
} |
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 |
|
|---|
| 33 |
|
|---|
| 34 |
|
|---|
| 35 |
|
|---|
| 36 |
|
|---|
| 37 |
|
|---|
| 38 |
case "$1" in |
|---|
| 39 |
configure) |
|---|
| 40 |
|
|---|
| 41 |
|
|---|
| 42 |
if [ ! -f $CONFIGFILE ]; then |
|---|
| 43 |
cat > $CONFIGFILE <<EOF |
|---|
| 44 |
#!/bin/sh |
|---|
| 45 |
|
|---|
| 46 |
|
|---|
| 47 |
|
|---|
| 48 |
|
|---|
| 49 |
|
|---|
| 50 |
|
|---|
| 51 |
HOSTING="" |
|---|
| 52 |
|
|---|
| 53 |
|
|---|
| 54 |
FQDN="" |
|---|
| 55 |
|
|---|
| 56 |
|
|---|
| 57 |
PUBLIC_IP="" |
|---|
| 58 |
|
|---|
| 59 |
|
|---|
| 60 |
|
|---|
| 61 |
|
|---|
| 62 |
INTERNAL_IP="" |
|---|
| 63 |
|
|---|
| 64 |
|
|---|
| 65 |
MONITOR_IP="" |
|---|
| 66 |
|
|---|
| 67 |
|
|---|
| 68 |
NS1_HOSTNAME="" |
|---|
| 69 |
|
|---|
| 70 |
|
|---|
| 71 |
NS2_HOSTNAME="" |
|---|
| 72 |
|
|---|
| 73 |
|
|---|
| 74 |
BIND_INTERNAL="" |
|---|
| 75 |
|
|---|
| 76 |
|
|---|
| 77 |
DEFAULT_MX="" |
|---|
| 78 |
|
|---|
| 79 |
|
|---|
| 80 |
MYSQL_HOST="" |
|---|
| 81 |
MYSQL_DATABASE="" |
|---|
| 82 |
MYSQL_USER="" |
|---|
| 83 |
MYSQL_PASS="" |
|---|
| 84 |
|
|---|
| 85 |
|
|---|
| 86 |
ALTERNC_LOC="" |
|---|
| 87 |
|
|---|
| 88 |
|
|---|
| 89 |
SMTP_RELAY_NETWORKS="" |
|---|
| 90 |
EOF |
|---|
| 91 |
|
|---|
| 92 |
chown root:www-data $CONFIGFILE |
|---|
| 93 |
fi |
|---|
| 94 |
|
|---|
| 95 |
for pair in \ |
|---|
| 96 |
"alternc/desktopname FQDN" \ |
|---|
| 97 |
"alternc/default_mx DEFAULT_MX" \ |
|---|
| 98 |
"alternc/alternc_location ALTERNC_LOC" \ |
|---|
| 99 |
"alternc/mysql/host MYSQL_HOST" \ |
|---|
| 100 |
"alternc/mysql/db MYSQL_DATABASE" \ |
|---|
| 101 |
"alternc/mysql/user MYSQL_USER" \ |
|---|
| 102 |
"alternc/mysql/password MYSQL_PASS" \ |
|---|
| 103 |
"alternc/public_ip DEFAULT_IP" |
|---|
| 104 |
do |
|---|
| 105 |
skip=0 |
|---|
| 106 |
for single in $pair |
|---|
| 107 |
do |
|---|
| 108 |
if [ "$skip" = "0" ]; then |
|---|
| 109 |
db_get "$single" || true |
|---|
| 110 |
skip=1 |
|---|
| 111 |
else |
|---|
| 112 |
echo "$single=\"$RET\"" >> /etc/alternc/local.sh |
|---|
| 113 |
fi |
|---|
| 114 |
done |
|---|
| 115 |
done |
|---|
| 116 |
|
|---|
| 117 |
|
|---|
| 118 |
db_reset alternc/mysql/password || true |
|---|
| 119 |
db_fset alternc/mysql/password "seen" "false" || true |
|---|
| 120 |
|
|---|
| 121 |
if [ -e $CONFIGFILE ]; then |
|---|
| 122 |
|
|---|
| 123 |
. $CONFIGFILE |
|---|
| 124 |
fi |
|---|
| 125 |
|
|---|
| 126 |
|
|---|
| 127 |
|
|---|
| 128 |
if dpkg --compare-versions "$2" le "0.9.3.9-globenet14"; then |
|---|
| 129 |
rm -f /var/alternc/apacheconf/*/* |
|---|
| 130 |
rm -f /var/alternc/apacheconf/override_php.conf |
|---|
| 131 |
fi |
|---|
| 132 |
|
|---|
| 133 |
echo "checking for upgrades" |
|---|
| 134 |
/usr/share/alternc/install/upgrade_check.sh $2 |
|---|
| 135 |
|
|---|
| 136 |
|
|---|
| 137 |
db_stop |
|---|
| 138 |
|
|---|
| 139 |
|
|---|
| 140 |
|
|---|
| 141 |
PWDIR=/var/spool/postfix/var/run/saslauthd |
|---|
| 142 |
dpkg-statoverride --list $PWDIR 2>&1 >/dev/null || |
|---|
| 143 |
dpkg-statoverride --update --add root sasl 710 $PWDIR |
|---|
| 144 |
|
|---|
| 145 |
|
|---|
| 146 |
adduser --quiet postfix sasl |
|---|
| 147 |
|
|---|
| 148 |
echo "config phpmyadmin" |
|---|
| 149 |
include_str='include_once("/etc/alternc/phpmyadmin.inc.php")' |
|---|
| 150 |
pma_config=/etc/phpmyadmin/config.inc.php |
|---|
| 151 |
if ! grep -e "$include_str" $pma_config > /dev/null 2>&1; then |
|---|
| 152 |
echo "<?php $include_str ?>" >> $pma_config |
|---|
| 153 |
fi |
|---|
| 154 |
|
|---|
| 155 |
if ! test -e /etc/apache-ssl/conf.d/phpmyadmin.conf; then |
|---|
| 156 |
if test -e /etc/phpmyadmin/apache.conf; then |
|---|
| 157 |
ln -s /etc/phpmyadmin/apache.conf /etc/apache-ssl/conf.d/phpmyadmin.conf |
|---|
| 158 |
fi |
|---|
| 159 |
fi |
|---|
| 160 |
|
|---|
| 161 |
if ! test -e /etc/apache/conf.d/phpmyadmin.conf; then |
|---|
| 162 |
if test -e /etc/phpmyadmin/apache.conf; then |
|---|
| 163 |
ln -s /etc/phpmyadmin/apache.conf /etc/apache/conf.d/phpmyadmin.conf |
|---|
| 164 |
fi |
|---|
| 165 |
fi |
|---|
| 166 |
|
|---|
| 167 |
|
|---|
| 168 |
if ! test -e /etc/apache-ssl/conf.d/squirrelmail.conf; then |
|---|
| 169 |
if test -e /etc/squirrelmail/apache.conf; then |
|---|
| 170 |
ln -s /etc/squirrelmail/apache.conf /etc/apache-ssl/conf.d/squirrelmail.conf |
|---|
| 171 |
fi |
|---|
| 172 |
fi |
|---|
| 173 |
|
|---|
| 174 |
if ! test -e /etc/apache/conf.d/squirrelmail.conf; then |
|---|
| 175 |
if test -e /etc/squirrelmail/apache.conf; then |
|---|
| 176 |
ln -s /etc/squirrelmail/apache.conf /etc/apache/conf.d/squirrelmail.conf |
|---|
| 177 |
fi |
|---|
| 178 |
fi |
|---|
| 179 |
|
|---|
| 180 |
|
|---|
| 181 |
|
|---|
| 182 |
touch /var/alternc/apacheconf/override_php.conf |
|---|
| 183 |
|
|---|
| 184 |
if ! test -e /etc/apache-ssl/conf.d/override_php.conf; then |
|---|
| 185 |
ln -s /var/alternc/apacheconf/override_php.conf /etc/apache-ssl/conf.d/override_php.conf |
|---|
| 186 |
fi |
|---|
| 187 |
|
|---|
| 188 |
|
|---|
| 189 |
if ! test -e /etc/apache/conf.d/override_php.conf; then |
|---|
| 190 |
ln -s /var/alternc/apacheconf/override_php.conf /etc/apache/conf.d/override_php.conf |
|---|
| 191 |
fi |
|---|
| 192 |
|
|---|
| 193 |
|
|---|
| 194 |
|
|---|
| 195 |
echo "running alternc.install" |
|---|
| 196 |
alternc.install |
|---|
| 197 |
|
|---|
| 198 |
;; |
|---|
| 199 |
|
|---|
| 200 |
abort-upgrade|abort-remove|abort-deconfigure) |
|---|
| 201 |
|
|---|
| 202 |
;; |
|---|
| 203 |
|
|---|
| 204 |
*) |
|---|
| 205 |
echo "postinst called with unknown argument \`$1'" >&2 |
|---|
| 206 |
exit 1 |
|---|
| 207 |
;; |
|---|
| 208 |
|
|---|
| 209 |
esac |
|---|
| 210 |
|
|---|
| 211 |
|
|---|
| 212 |
|
|---|
| 213 |
|
|---|
| 214 |
|
|---|
| 215 |
|
|---|
| 216 |
exit 0 |
|---|
| 217 |
|
|---|
| 218 |
|
|---|
| 219 |
|
|---|