Merge branch 'debconf' of https://github.com/pilou-/AlternC
This commit is contained in:
commit
060df26bdd
|
@ -1,4 +1,4 @@
|
||||||
#! /bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
@ -28,8 +28,8 @@ function valid_ip()
|
||||||
|
|
||||||
|
|
||||||
#checking mysql connectivity and updating local.sh variables accordingly
|
#checking mysql connectivity and updating local.sh variables accordingly
|
||||||
check_mysql(){
|
check_mysql()
|
||||||
|
{
|
||||||
STATE=0
|
STATE=0
|
||||||
while [ "$STATE" -eq 0 ]; do
|
while [ "$STATE" -eq 0 ]; do
|
||||||
db_input high alternc/mysql/host || true
|
db_input high alternc/mysql/host || true
|
||||||
|
@ -51,18 +51,25 @@ check_mysql(){
|
||||||
if [ "`mysql -u"$MYSQL_USER" -p"$MYSQL_PASSWORD" -h"$MYSQL_HOST" -Bse 'SELECT "OK";' 2>/dev/null`" = "OK" ]; then
|
if [ "`mysql -u"$MYSQL_USER" -p"$MYSQL_PASSWORD" -h"$MYSQL_HOST" -Bse 'SELECT "OK";' 2>/dev/null`" = "OK" ]; then
|
||||||
STATE=`expr $STATE + 1`
|
STATE=`expr $STATE + 1`
|
||||||
else
|
else
|
||||||
|
db_input high alternc/retry_remote_mysql || true
|
||||||
|
if [ $? -eq 30 ]; then
|
||||||
db_input high alternc/remote_mysql_error || true
|
db_input high alternc/remote_mysql_error || true
|
||||||
|
db_go || true
|
||||||
|
exit 4
|
||||||
|
fi
|
||||||
db_go
|
db_go
|
||||||
db_get alternc/remote_mysql_error || true
|
db_get alternc/retry_remote_mysql || true
|
||||||
if [ "$RET" = "false" ]; then
|
if [ "$RET" = "false" ]; then
|
||||||
|
db_input high alternc/remote_mysql_error || true
|
||||||
|
db_go || true
|
||||||
exit 4
|
exit 4
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_first_existing_dir() {
|
function get_first_existing_dir()
|
||||||
|
{
|
||||||
# Prend en premier parametre un chemin
|
# Prend en premier parametre un chemin
|
||||||
# Retourne le répertoire parent existant le plus "proche"
|
# Retourne le répertoire parent existant le plus "proche"
|
||||||
# Exemple: on lui donne /var/www/alternc/gerard/dupont/ mais
|
# Exemple: on lui donne /var/www/alternc/gerard/dupont/ mais
|
||||||
|
@ -79,7 +86,6 @@ function get_first_existing_dir() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# default values for local.sh
|
# default values for local.sh
|
||||||
MYSQL_HOST=127.0.0.1
|
MYSQL_HOST=127.0.0.1
|
||||||
MYSQL_DATABASE=alternc
|
MYSQL_DATABASE=alternc
|
||||||
|
@ -102,7 +108,7 @@ SQLBACKUP_TYPE="rotate"
|
||||||
SQLBACKUP_OVERWRITE="no"
|
SQLBACKUP_OVERWRITE="no"
|
||||||
QUEST_STATE=1
|
QUEST_STATE=1
|
||||||
|
|
||||||
while [ "$QUEST_STATE" != 0 -a "$QUEST_STATE" != 13 ]; do
|
while [ "$QUEST_STATE" != 0 -a "$QUEST_STATE" != 14 ]; do
|
||||||
case "$QUEST_STATE" in
|
case "$QUEST_STATE" in
|
||||||
1)
|
1)
|
||||||
if [ -r /etc/alternc/local.sh ]; then
|
if [ -r /etc/alternc/local.sh ]; then
|
||||||
|
@ -110,20 +116,25 @@ while [ "$QUEST_STATE" != 0 -a "$QUEST_STATE" != 13 ]; do
|
||||||
. /etc/alternc/local.sh
|
. /etc/alternc/local.sh
|
||||||
fi
|
fi
|
||||||
# upgrade <= 3.0 to >= 3.1
|
# upgrade <= 3.0 to >= 3.1
|
||||||
if [ "x$ALTERNC_LOC" != "x" ]
|
if [ "x$ALTERNC_LOC" != "x" ]; then
|
||||||
then
|
|
||||||
ALTERNC_HTML="$ALTERNC_LOC/html"
|
ALTERNC_HTML="$ALTERNC_LOC/html"
|
||||||
ALTERNC_MAIL="$ALTERNC_LOC/mail"
|
ALTERNC_MAIL="$ALTERNC_LOC/mail"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#We ask for the hosting name and the FQDN
|
#We ask for the hosting name and the FQDN
|
||||||
|
db_get alternc/hostingname
|
||||||
|
if [ -z "$RET" ]; then
|
||||||
db_set alternc/hostingname "$HOSTING"
|
db_set alternc/hostingname "$HOSTING"
|
||||||
db_set alternc/desktopname "$FQDN"
|
|
||||||
db_input high alternc/hostingname || true
|
db_input high alternc/hostingname || true
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
2)
|
2)
|
||||||
# Get the FQDN
|
# Get the FQDN
|
||||||
|
db_get alternc/desktopname
|
||||||
|
if [ -z "$RET" ]; then
|
||||||
|
db_set alternc/desktopname "$FQDN"
|
||||||
db_input high alternc/desktopname || true
|
db_input high alternc/desktopname || true
|
||||||
|
fi
|
||||||
# Be sure that the FQDN is lowercase (Bug #1405)
|
# Be sure that the FQDN is lowercase (Bug #1405)
|
||||||
db_get alternc/desktopname
|
db_get alternc/desktopname
|
||||||
db_set alternc/desktopname "`echo $RET | tr '[:upper:]' '[:lower:]'`"
|
db_set alternc/desktopname "`echo $RET | tr '[:upper:]' '[:lower:]'`"
|
||||||
|
@ -131,7 +142,10 @@ while [ "$QUEST_STATE" != 0 -a "$QUEST_STATE" != 13 ]; do
|
||||||
;;
|
;;
|
||||||
3)
|
3)
|
||||||
#we ask for the public and private ip
|
#we ask for the public and private ip
|
||||||
|
db_get alternc/public_ip
|
||||||
|
if [ -z "$RET" ]; then
|
||||||
db_set alternc/public_ip "$PUBLIC_IP"
|
db_set alternc/public_ip "$PUBLIC_IP"
|
||||||
|
fi
|
||||||
STATE=0
|
STATE=0
|
||||||
while [ $STATE -eq 0 ]; do
|
while [ $STATE -eq 0 ]; do
|
||||||
db_input high alternc/public_ip || true
|
db_input high alternc/public_ip || true
|
||||||
|
@ -159,8 +173,10 @@ while [ "$QUEST_STATE" != 0 -a "$QUEST_STATE" != 13 ]; do
|
||||||
;;
|
;;
|
||||||
4)
|
4)
|
||||||
#private IP
|
#private IP
|
||||||
|
db_get alternc/internal_ip
|
||||||
|
if [ -z "$RET" ]; then
|
||||||
db_set alternc/internal_ip "$INTERNAL_IP"
|
db_set alternc/internal_ip "$INTERNAL_IP"
|
||||||
|
fi
|
||||||
|
|
||||||
STATE=0
|
STATE=0
|
||||||
while [ $STATE -eq 0 ]; do
|
while [ $STATE -eq 0 ]; do
|
||||||
|
@ -175,39 +191,51 @@ while [ "$QUEST_STATE" != 0 -a "$QUEST_STATE" != 13 ]; do
|
||||||
;;
|
;;
|
||||||
5)
|
5)
|
||||||
#We ask for the DNS server for the ip
|
#We ask for the DNS server for the ip
|
||||||
|
db_get alternc/ns1
|
||||||
|
if [ -z "$RET" ]; then
|
||||||
db_set alternc/ns1 "$NS1_HOSTNAME"
|
db_set alternc/ns1 "$NS1_HOSTNAME"
|
||||||
db_input high alternc/ns1 || true
|
db_input high alternc/ns1 || true
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
6)
|
6)
|
||||||
|
db_get alternc/ns2
|
||||||
|
if [ -z "$RET" ]; then
|
||||||
db_set alternc/ns2 "$NS2_HOSTNAME"
|
db_set alternc/ns2 "$NS2_HOSTNAME"
|
||||||
db_input high alternc/ns2 || true
|
db_input high alternc/ns2 || true
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
7)
|
7)
|
||||||
|
db_get alternc/default_mx
|
||||||
|
if [ -z "$RET" ]; then
|
||||||
db_set alternc/default_mx "$DEFAULT_MX"
|
db_set alternc/default_mx "$DEFAULT_MX"
|
||||||
db_input high alternc/default_mx || true
|
db_input high alternc/default_mx || true
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
8)
|
8)
|
||||||
if [ "`mysql --defaults-file=/etc/mysql/debian.cnf -Bse 'SELECT "OK";' 2>/dev/null`" = "OK" ]; then
|
if [ "`mysql --defaults-file=/etc/mysql/debian.cnf -Bse 'SELECT "OK";' 2>/dev/null`" = "OK" ]; then
|
||||||
db_input critical alternc/use_local_mysql || true
|
db_input critical alternc/use_local_mysql || true
|
||||||
else
|
|
||||||
db_input critical alternc/use_remote_mysql || true
|
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
9)
|
9)
|
||||||
db_get alternc/use_local_mysql || true
|
db_get alternc/use_local_mysql
|
||||||
if [ -z "$RET" -o "$RET" == "false" ]
|
if [ "$RET" != "true" ]; then
|
||||||
then
|
db_input critical alternc/use_remote_mysql || true
|
||||||
#user want to use a remote server
|
|
||||||
check_mysql
|
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
10)
|
10)
|
||||||
|
db_get alternc/use_remote_mysql
|
||||||
|
if [ "$RET" == "true" ]; then
|
||||||
|
# user want to use a remote server
|
||||||
|
check_mysql
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
11)
|
||||||
# We need to set the alternc_location here because we have to test for quotas and acls
|
# We need to set the alternc_location here because we have to test for quotas and acls
|
||||||
|
|
||||||
db_get alternc/alternc_html
|
db_get alternc/alternc_html
|
||||||
if [ -z "$RET" ];then
|
if [ -z "$RET" ]; then
|
||||||
db_set alternc/alternc_html $ALTERNC_HTML
|
db_set alternc/alternc_html $ALTERNC_HTML
|
||||||
db_input high alternc/alternc_html
|
db_input high alternc/alternc_html || true
|
||||||
fi
|
fi
|
||||||
db_get alternc/alternc_html
|
db_get alternc/alternc_html
|
||||||
|
|
||||||
|
@ -220,10 +248,8 @@ while [ "$QUEST_STATE" != 0 -a "$QUEST_STATE" != 13 ]; do
|
||||||
touch "$aclcheckfile"
|
touch "$aclcheckfile"
|
||||||
setfacl -m u:root:rwx "$aclcheckfile" 2>/dev/null || (
|
setfacl -m u:root:rwx "$aclcheckfile" 2>/dev/null || (
|
||||||
test -e "$aclcheckfile" && rm -f "$aclcheckfile" || true
|
test -e "$aclcheckfile" && rm -f "$aclcheckfile" || true
|
||||||
db_input critical alternc/acluninstalled || true
|
db_input high alternc/acluninstalled || true
|
||||||
db_go
|
db_go || true
|
||||||
db_reset alternc/acluninstalled || true
|
|
||||||
db_fset alternc/acluninstalled "seen" "false" || true
|
|
||||||
exit 2
|
exit 2
|
||||||
)
|
)
|
||||||
test -e "$aclcheckfile" && rm -f "$aclcheckfile" || true
|
test -e "$aclcheckfile" && rm -f "$aclcheckfile" || true
|
||||||
|
@ -238,18 +264,18 @@ while [ "$QUEST_STATE" != 0 -a "$QUEST_STATE" != 13 ]; do
|
||||||
fi
|
fi
|
||||||
)
|
)
|
||||||
;;
|
;;
|
||||||
11)
|
12)
|
||||||
db_get alternc/alternc_mail
|
db_get alternc/alternc_mail
|
||||||
if [ -z "$RET" ];then
|
if [ -z "$RET" ]; then
|
||||||
db_set alternc/alternc_mail $ALTERNC_MAIL
|
db_set alternc/alternc_mail $ALTERNC_MAIL
|
||||||
db_input high alternc/alternc_mail
|
db_input high alternc/alternc_mail || true
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
12)
|
13)
|
||||||
db_get alternc/alternc_logs
|
db_get alternc/alternc_logs
|
||||||
if [ -z "$RET" ];then
|
if [ -z "$RET" ];then
|
||||||
db_set alternc/alternc_logs $ALTERNC_LOGS
|
db_set alternc/alternc_logs $ALTERNC_LOGS
|
||||||
db_input high alternc/alternc_logs
|
db_input high alternc/alternc_logs || true
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -282,58 +308,32 @@ if [ -r /etc/alternc/my_mail.cnf ]; then
|
||||||
eval `sed -n -e "/=/{s/ *= *\"\?/='/;s/\"\?\$/'/;s/host/MYSQL_HOST/;s/user/MYSQL_MAIL_USER/;s/password/MYSQL_MAIL_PASS/;s/database/MYSQL_DATABASE/;p}" /etc/alternc/my_mail.cnf`
|
eval `sed -n -e "/=/{s/ *= *\"\?/='/;s/\"\?\$/'/;s/host/MYSQL_HOST/;s/user/MYSQL_MAIL_USER/;s/password/MYSQL_MAIL_PASS/;s/database/MYSQL_DATABASE/;p}" /etc/alternc/my_mail.cnf`
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
db_get alternc/hostingname
|
|
||||||
if [ -z "$RET" ]
|
|
||||||
then
|
|
||||||
db_set alternc/hostingname "$HOSTING"
|
|
||||||
fi
|
|
||||||
|
|
||||||
db_get alternc/desktopname
|
|
||||||
if [ -z "$RET" ]
|
|
||||||
then
|
|
||||||
db_set alternc/desktopname "$FQDN"
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
db_get alternc/monitor_ip
|
db_get alternc/monitor_ip
|
||||||
if [ -z "$RET" ]
|
if [ -z "$RET" ]; then
|
||||||
then
|
db_set alternc/monitor_ip "$MONITOR_IP"
|
||||||
db_set alternc/monitor_ip "$MONITOR_IP"
|
|
||||||
fi
|
|
||||||
|
|
||||||
db_get alternc/ns2
|
|
||||||
if [ -z "$RET" ]
|
|
||||||
then
|
|
||||||
db_set alternc/ns2 "$NS2_HOSTNAME"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
db_get alternc/default_mx2
|
db_get alternc/default_mx2
|
||||||
if [ -z "$RET" ]
|
if [ -z "$RET" ]; then
|
||||||
then
|
db_set alternc/default_mx2 "$DEFAULT_SECONDARY_MX"
|
||||||
db_set alternc/default_mx2 "$DEFAULT_SECONDARY_MX"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
db_get alternc/mysql/host
|
db_get alternc/mysql/host
|
||||||
if [ -z "$RET" ]
|
if [ -z "$RET" ]; then
|
||||||
then
|
db_set alternc/mysql/host "$MYSQL_HOST"
|
||||||
db_set alternc/mysql/host "$MYSQL_HOST"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#Even if we asked the question concerning the database earlier in the process
|
#Even if we asked the question concerning the database earlier in the process
|
||||||
#those calls are needed to pass the variable of remote sql server to AlternC
|
#those calls are needed to pass the variable of remote sql server to AlternC
|
||||||
db_get alternc/mysql/db
|
db_get alternc/mysql/db
|
||||||
if [ -z "$RET" ]
|
if [ -z "$RET" ]; then
|
||||||
then
|
db_set alternc/mysql/db "$MYSQL_DATABASE"
|
||||||
db_set alternc/mysql/db "$MYSQL_DATABASE"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
db_get alternc/mysql/user
|
db_get alternc/mysql/user
|
||||||
if [ -z "$RET" ]
|
if [ -z "$RET" ]; then
|
||||||
then
|
|
||||||
db_get alternc/mysql/remote_user
|
db_get alternc/mysql/remote_user
|
||||||
if [ -z "$RET" ]
|
if [ -z "$RET" ]; then
|
||||||
then
|
|
||||||
db_set alternc/mysql/user "$MYSQL_USER"
|
db_set alternc/mysql/user "$MYSQL_USER"
|
||||||
else
|
else
|
||||||
db_set alternc/mysql/user "$RET"
|
db_set alternc/mysql/user "$RET"
|
||||||
|
@ -341,11 +341,9 @@ if [ -z "$RET" ]
|
||||||
fi
|
fi
|
||||||
|
|
||||||
db_get alternc/mysql/password
|
db_get alternc/mysql/password
|
||||||
if [ -z "$RET" ]
|
if [ -z "$RET" ]; then
|
||||||
then
|
|
||||||
db_get alternc/mysql/remote_password
|
db_get alternc/mysql/remote_password
|
||||||
if [ -z "$RET" ]
|
if [ -z "$RET" ]; then
|
||||||
then
|
|
||||||
db_set alternc/mysql/password "$MYSQL_PASS"
|
db_set alternc/mysql/password "$MYSQL_PASS"
|
||||||
else
|
else
|
||||||
db_set alternc/mysql/password "$RET"
|
db_set alternc/mysql/password "$RET"
|
||||||
|
@ -353,33 +351,28 @@ if [ -z "$RET" ]
|
||||||
fi
|
fi
|
||||||
|
|
||||||
db_get alternc/mysql/client
|
db_get alternc/mysql/client
|
||||||
if [ -z "$RET" ]
|
if [ -z "$RET" ]; then
|
||||||
then
|
|
||||||
db_set alternc/mysql/client "$MYSQL_CLIENT"
|
db_set alternc/mysql/client "$MYSQL_CLIENT"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
db_get alternc/sql/backup_type
|
db_get alternc/sql/backup_type
|
||||||
if [ -z "$RET" ]
|
if [ -z "$RET" ]; then
|
||||||
then
|
db_set alternc/sql/backup_type "$SQLBACKUP_TYPE"
|
||||||
db_set alternc/sql/backup_type "$SQLBACKUP_TYPE"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
db_get alternc/sql/backup_overwrite
|
db_get alternc/sql/backup_overwrite
|
||||||
if [ -z "$RET" ]
|
if [ -z "$RET" ]; then
|
||||||
then
|
db_set alternc/sql/backup_overwrite "$SQLBACKUP_OVERWRITE"
|
||||||
db_set alternc/sql/backup_overwrite "$SQLBACKUP_OVERWRITE"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
db_get alternc/mysql/alternc_mail_user
|
db_get alternc/mysql/alternc_mail_user
|
||||||
if [ -z "$RET" ]
|
if [ -z "$RET" ]; then
|
||||||
then
|
db_set alternc/mysql/alternc_mail_user "$MYSQL_MAIL_USER"
|
||||||
db_set alternc/mysql/alternc_mail_user "$MYSQL_MAIL_USER"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
db_get alternc/mysql/alternc_mail_password
|
db_get alternc/mysql/alternc_mail_password
|
||||||
if [ -z "$RET" ]
|
if [ -z "$RET" ]; then
|
||||||
then
|
db_set alternc/mysql/alternc_mail_password "$MYSQL_MAIL_PASS"
|
||||||
db_set alternc/mysql/alternc_mail_password "$MYSQL_MAIL_PASS"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
db_input low alternc/default_mx2 || true
|
db_input low alternc/default_mx2 || true
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
Template: alternc/acluninstalled
|
Template: alternc/acluninstalled
|
||||||
Type: note
|
Type: error
|
||||||
_Description: AlternC need ACL on filesystem
|
_Description: AlternC need ACL on filesystem
|
||||||
AlternC can't work without ACL activated on its filesystem.
|
AlternC can't work without ACL activated on its filesystem.
|
||||||
ACL are currently not enabled.
|
ACL are currently not enabled.
|
||||||
.
|
.
|
||||||
Also, you need to activate group quota (grpquota)
|
Also, you need to activate group quota (grpquota)
|
||||||
to be able to use disk quota (but that's not mandatory).
|
to be able to use disk quota (but that's not mandatory).
|
||||||
|
.
|
||||||
|
This is a fatal error and will cause the package installation
|
||||||
|
to fail.
|
||||||
|
|
||||||
Template: alternc/quotauninstalled
|
Template: alternc/quotauninstalled
|
||||||
Type: note
|
Type: note
|
||||||
|
@ -238,11 +241,10 @@ _Description: Use locally found MySQL server?
|
||||||
Template: alternc/use_remote_mysql
|
Template: alternc/use_remote_mysql
|
||||||
Type: boolean
|
Type: boolean
|
||||||
_Description: Use a remote MySQL server?
|
_Description: Use a remote MySQL server?
|
||||||
No local Mysql server was found.
|
|
||||||
Please confirm you want to use a remote Mysql Server.
|
Please confirm you want to use a remote Mysql Server.
|
||||||
If not, AlternC cannot be installed.
|
If not, AlternC cannot be installed.
|
||||||
|
|
||||||
Template: alternc/remote_mysql_error
|
Template: alternc/retry_remote_mysql
|
||||||
Type: boolean
|
Type: boolean
|
||||||
_Description: MySQL connection error. Try again?
|
_Description: MySQL connection error. Try again?
|
||||||
Remote connection to the MySQL server failed.
|
Remote connection to the MySQL server failed.
|
||||||
|
@ -255,3 +257,10 @@ _Description: Private IP detected, use it anyway?
|
||||||
this is an expected situation, since the server might not be reachable
|
this is an expected situation, since the server might not be reachable
|
||||||
from outside your network.
|
from outside your network.
|
||||||
|
|
||||||
|
Template: alternc/remote_mysql_error
|
||||||
|
Type: error
|
||||||
|
_Description: Remote mysql: connection error
|
||||||
|
Connection to the remote MySQL server failed.
|
||||||
|
.
|
||||||
|
This is a fatal error and will cause the package installation
|
||||||
|
to fail.
|
||||||
|
|
Loading…
Reference in New Issue