From a5f544b705f83a41d381968f4a646702296d80b8 Mon Sep 17 00:00:00 2001 From: Pierre-Louis Bonicoli Date: Tue, 25 Mar 2014 18:34:34 +0100 Subject: [PATCH 1/8] [enh] homogenize coding style - use 2 spaces for indentations - remove tabulations - remove trailing spaces - if/then statements --- debian/alternc.config | 249 ++++++++++++++++++++---------------------- 1 file changed, 117 insertions(+), 132 deletions(-) diff --git a/debian/alternc.config b/debian/alternc.config index 3e9bd097..51d85ead 100644 --- a/debian/alternc.config +++ b/debian/alternc.config @@ -1,4 +1,4 @@ -#! /bin/bash +#!/bin/bash set -e @@ -8,61 +8,61 @@ set -e db_capb backup -#Return if everything is good, exit error number otherwise +#Return if everything is good, exit error number otherwise function valid_ip() { - local ip=$1 - local stat=1 + local ip=$1 + local stat=1 - if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then - OIFS=$IFS - IFS='.' - ip=($ip) - IFS=$OIFS - [[ ${ip[0]} -le 255 && ${ip[1]} -le 255 \ - && ${ip[2]} -le 255 && ${ip[3]} -le 255 ]] - stat=$? - fi - return $stat + if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then + OIFS=$IFS + IFS='.' + ip=($ip) + IFS=$OIFS + [[ ${ip[0]} -le 255 && ${ip[1]} -le 255 \ + && ${ip[2]} -le 255 && ${ip[3]} -le 255 ]] + stat=$? + fi + return $stat } #checking mysql connectivity and updating local.sh variables accordingly -check_mysql(){ - +check_mysql() +{ STATE=0 - while [ "$STATE" -eq 0 ]; do - db_input high alternc/mysql/host || true - db_go - db_get alternc/mysql/host || true - MYSQL_HOST="$RET" - db_input high alternc/mysql/remote_user || true - db_go - db_get alternc/mysql/remote_user || true - MYSQL_USER="$RET" - db_input high alternc/mysql/remote_password || true - db_go - db_get alternc/mysql/remote_password || true - MYSQL_PASSWORD="$RET" - db_input high alternc/mysql/client || true - db_go - db_get alternc/mysql/client || true - MYSQL_CLIENT="$RET" - if [ "`mysql -u"$MYSQL_USER" -p"$MYSQL_PASSWORD" -h"$MYSQL_HOST" -Bse 'SELECT "OK";' 2>/dev/null`" = "OK" ]; then - STATE=`expr $STATE + 1` - else - db_input high alternc/remote_mysql_error || true - db_go - db_get alternc/remote_mysql_error || true - if [ "$RET" = "false" ]; then - exit 4 - fi - fi - done - + while [ "$STATE" -eq 0 ]; do + db_input high alternc/mysql/host || true + db_go + db_get alternc/mysql/host || true + MYSQL_HOST="$RET" + db_input high alternc/mysql/remote_user || true + db_go + db_get alternc/mysql/remote_user || true + MYSQL_USER="$RET" + db_input high alternc/mysql/remote_password || true + db_go + db_get alternc/mysql/remote_password || true + MYSQL_PASSWORD="$RET" + db_input high alternc/mysql/client || true + db_go + db_get alternc/mysql/client || true + MYSQL_CLIENT="$RET" + if [ "`mysql -u"$MYSQL_USER" -p"$MYSQL_PASSWORD" -h"$MYSQL_HOST" -Bse 'SELECT "OK";' 2>/dev/null`" = "OK" ]; then + STATE=`expr $STATE + 1` + else + db_input high alternc/remote_mysql_error || true + db_go + db_get alternc/remote_mysql_error || true + if [ "$RET" = "false" ]; then + exit 4 + fi + fi + done } -function get_first_existing_dir() { +function get_first_existing_dir() +{ # Prend en premier parametre un chemin # Retourne le répertoire parent existant le plus "proche" # Exemple: on lui donne /var/www/alternc/gerard/dupont/ mais @@ -79,7 +79,6 @@ function get_first_existing_dir() { } - # default values for local.sh MYSQL_HOST=127.0.0.1 MYSQL_DATABASE=alternc @@ -106,14 +105,13 @@ while [ "$QUEST_STATE" != 0 -a "$QUEST_STATE" != 13 ]; do case "$QUEST_STATE" in 1) if [ -r /etc/alternc/local.sh ]; then - # source the current config - . /etc/alternc/local.sh + # source the current config + . /etc/alternc/local.sh fi # upgrade <= 3.0 to >= 3.1 - if [ "x$ALTERNC_LOC" != "x" ] - then - ALTERNC_HTML="$ALTERNC_LOC/html" - ALTERNC_MAIL="$ALTERNC_LOC/mail" + if [ "x$ALTERNC_LOC" != "x" ]; then + ALTERNC_HTML="$ALTERNC_LOC/html" + ALTERNC_MAIL="$ALTERNC_LOC/mail" fi #We ask for the hosting name and the FQDN @@ -136,19 +134,19 @@ while [ "$QUEST_STATE" != 0 -a "$QUEST_STATE" != 13 ]; do while [ $STATE -eq 0 ]; do db_input high alternc/public_ip || true db_go - db_get alternc/public_ip + db_get alternc/public_ip ip="$RET" - if valid_ip $ip ; then + if valid_ip $ip ; then if [ $(echo $ip |egrep '(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1)$') ]; then db_input high alternc/use_private_ip || true db_go db_get alternc/use_private_ip - if [ "$RET" = "true" ]; then - STATE=1 - else - db_reset alternc/use_private_ip || true - db_fset alternc/use_private_ip "seen" "false" || true - fi + if [ "$RET" = "true" ]; then + STATE=1 + else + db_reset alternc/use_private_ip || true + db_fset alternc/use_private_ip "seen" "false" || true + fi else STATE=1 fi @@ -166,11 +164,11 @@ while [ "$QUEST_STATE" != 0 -a "$QUEST_STATE" != 13 ]; do while [ $STATE -eq 0 ]; do db_input high alternc/internal_ip || true db_go - db_get alternc/internal_ip + db_get alternc/internal_ip ip="$RET" - if valid_ip $ip ; then + if valid_ip $ip ; then STATE=1 - fi + fi done ;; 5) @@ -202,10 +200,10 @@ while [ "$QUEST_STATE" != 0 -a "$QUEST_STATE" != 13 ]; do fi ;; 10) - # 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 - if [ -z "$RET" ];then + if [ -z "$RET" ]; then db_set alternc/alternc_html $ALTERNC_HTML db_input high alternc/alternc_html fi @@ -219,28 +217,28 @@ while [ "$QUEST_STATE" != 0 -a "$QUEST_STATE" != 13 ]; do aclcheckfile="$basedir/test-acl" touch "$aclcheckfile" setfacl -m u:root:rwx "$aclcheckfile" 2>/dev/null || ( - test -e "$aclcheckfile" && rm -f "$aclcheckfile" || true - db_input critical alternc/acluninstalled || true - db_go - db_reset alternc/acluninstalled || true - db_fset alternc/acluninstalled "seen" "false" || true - exit 2 + test -e "$aclcheckfile" && rm -f "$aclcheckfile" || true + db_input critical alternc/acluninstalled || true + db_go + db_reset alternc/acluninstalled || true + db_fset alternc/acluninstalled "seen" "false" || true + exit 2 ) test -e "$aclcheckfile" && rm -f "$aclcheckfile" || true quota -gA -f $MOUNT_POINT 2>/dev/null || ( - db_get alternc/quotauninstalled - if [ -z "$RET" ]; then - db_input critical alternc/quotauninstalled || true - db_go - #db_reset alternc/quotauninstalled || true - db_set alternc/quotauninstalled "false" || true - fi + db_get alternc/quotauninstalled + if [ -z "$RET" ]; then + db_input critical alternc/quotauninstalled || true + db_go + #db_reset alternc/quotauninstalled || true + db_set alternc/quotauninstalled "false" || true + fi ) ;; 11) db_get alternc/alternc_mail - if [ -z "$RET" ];then + if [ -z "$RET" ]; then db_set alternc/alternc_mail $ALTERNC_MAIL db_input high alternc/alternc_mail fi @@ -255,31 +253,31 @@ while [ "$QUEST_STATE" != 0 -a "$QUEST_STATE" != 13 ]; do esac if db_go; then QUEST_STATE=$(($QUEST_STATE + 1)) - else + else QUEST_STATE=$(($QUEST_STATE - 1)) fi done if [ -r /etc/alternc/my.cnf ]; then - # make mysql configuration available as shell variables - # to convert from .cnf to shell syntax, we: - # * match only lines with "equal" in them (/=/) - # * remove whitespace around the = and add a left quote operator ' (;s) - # * add a right quote operator at the end of line (;s) - # * convert mysql variables into our MYSQL_ naming convention (;s) - # * print the result (;p) - 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` + # make mysql configuration available as shell variables + # to convert from .cnf to shell syntax, we: + # * match only lines with "equal" in them (/=/) + # * remove whitespace around the = and add a left quote operator ' (;s) + # * add a right quote operator at the end of line (;s) + # * convert mysql variables into our MYSQL_ naming convention (;s) + # * print the result (;p) + 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` fi if [ -r /etc/alternc/my_mail.cnf ]; then - # make mysql configuration available as shell variables - # to convert from .cnf to shell syntax, we: - # * match only lines with "equal" in them (/=/) - # * remove whitespace around the = and add a left quote operator ' (;s) - # * add a right quote operator at the end of line (;s) - # * convert mysql variables into our MYSQL_ naming convention (;s) - # * print the result (;p) - 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` + # make mysql configuration available as shell variables + # to convert from .cnf to shell syntax, we: + # * match only lines with "equal" in them (/=/) + # * remove whitespace around the = and add a left quote operator ' (;s) + # * add a right quote operator at the end of line (;s) + # * convert mysql variables into our MYSQL_ naming convention (;s) + # * print the result (;p) + 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 @@ -297,9 +295,8 @@ fi db_get alternc/monitor_ip -if [ -z "$RET" ] - then -db_set alternc/monitor_ip "$MONITOR_IP" +if [ -z "$RET" ]; then + db_set alternc/monitor_ip "$MONITOR_IP" fi db_get alternc/ns2 @@ -309,31 +306,26 @@ db_set alternc/ns2 "$NS2_HOSTNAME" fi db_get alternc/default_mx2 -if [ -z "$RET" ] - then -db_set alternc/default_mx2 "$DEFAULT_SECONDARY_MX" +if [ -z "$RET" ]; then + db_set alternc/default_mx2 "$DEFAULT_SECONDARY_MX" fi db_get alternc/mysql/host -if [ -z "$RET" ] - then -db_set alternc/mysql/host "$MYSQL_HOST" +if [ -z "$RET" ]; then + db_set alternc/mysql/host "$MYSQL_HOST" fi #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 db_get alternc/mysql/db -if [ -z "$RET" ] - then -db_set alternc/mysql/db "$MYSQL_DATABASE" +if [ -z "$RET" ]; then + db_set alternc/mysql/db "$MYSQL_DATABASE" fi db_get alternc/mysql/user -if [ -z "$RET" ] - then +if [ -z "$RET" ]; then db_get alternc/mysql/remote_user - if [ -z "$RET" ] - then + if [ -z "$RET" ]; then db_set alternc/mysql/user "$MYSQL_USER" else db_set alternc/mysql/user "$RET" @@ -341,11 +333,9 @@ if [ -z "$RET" ] fi db_get alternc/mysql/password -if [ -z "$RET" ] - then +if [ -z "$RET" ]; then db_get alternc/mysql/remote_password - if [ -z "$RET" ] - then + if [ -z "$RET" ]; then db_set alternc/mysql/password "$MYSQL_PASS" else db_set alternc/mysql/password "$RET" @@ -353,33 +343,28 @@ if [ -z "$RET" ] fi db_get alternc/mysql/client -if [ -z "$RET" ] - then - db_set alternc/mysql/client "$MYSQL_CLIENT" +if [ -z "$RET" ]; then + db_set alternc/mysql/client "$MYSQL_CLIENT" fi db_get alternc/sql/backup_type -if [ -z "$RET" ] - then -db_set alternc/sql/backup_type "$SQLBACKUP_TYPE" +if [ -z "$RET" ]; then + db_set alternc/sql/backup_type "$SQLBACKUP_TYPE" fi db_get alternc/sql/backup_overwrite -if [ -z "$RET" ] - then -db_set alternc/sql/backup_overwrite "$SQLBACKUP_OVERWRITE" +if [ -z "$RET" ]; then + db_set alternc/sql/backup_overwrite "$SQLBACKUP_OVERWRITE" fi db_get alternc/mysql/alternc_mail_user -if [ -z "$RET" ] - then -db_set alternc/mysql/alternc_mail_user "$MYSQL_MAIL_USER" +if [ -z "$RET" ]; then + db_set alternc/mysql/alternc_mail_user "$MYSQL_MAIL_USER" fi db_get alternc/mysql/alternc_mail_password -if [ -z "$RET" ] - then -db_set alternc/mysql/alternc_mail_password "$MYSQL_MAIL_PASS" +if [ -z "$RET" ]; then + db_set alternc/mysql/alternc_mail_password "$MYSQL_MAIL_PASS" fi db_input low alternc/default_mx2 || true From cfa27b2b56536ce1dd958d7e0a3ed752028145f0 Mon Sep 17 00:00:00 2001 From: Pierre-Louis Bonicoli Date: Tue, 25 Mar 2014 18:42:29 +0100 Subject: [PATCH 2/8] [fix] don't override existing debconf values --- debian/alternc.config | 46 +++++++++++++++++++++++++++++++------------ 1 file changed, 33 insertions(+), 13 deletions(-) diff --git a/debian/alternc.config b/debian/alternc.config index 51d85ead..2200135d 100644 --- a/debian/alternc.config +++ b/debian/alternc.config @@ -115,13 +115,19 @@ while [ "$QUEST_STATE" != 0 -a "$QUEST_STATE" != 13 ]; do fi #We ask for the hosting name and the FQDN - db_set alternc/hostingname "$HOSTING" - db_set alternc/desktopname "$FQDN" - db_input high alternc/hostingname || true + db_get alternc/hostingname + if [ -z "$RET" ]; then + db_set alternc/hostingname "$HOSTING" + db_input high alternc/hostingname || true + fi ;; 2) # Get the FQDN - db_input high alternc/desktopname || true + db_get alternc/desktopname + if [ -z "$RET" ]; then + db_set alternc/desktopname "$FQDN" + db_input high alternc/desktopname || true + fi # Be sure that the FQDN is lowercase (Bug #1405) db_get alternc/desktopname db_set alternc/desktopname "`echo $RET | tr '[:upper:]' '[:lower:]'`" @@ -129,7 +135,10 @@ while [ "$QUEST_STATE" != 0 -a "$QUEST_STATE" != 13 ]; do ;; 3) #we ask for the public and private ip - db_set alternc/public_ip "$PUBLIC_IP" + db_get alternc/public_ip + if [ -z "$RET" ]; then + db_set alternc/public_ip "$PUBLIC_IP" + fi STATE=0 while [ $STATE -eq 0 ]; do db_input high alternc/public_ip || true @@ -157,8 +166,10 @@ while [ "$QUEST_STATE" != 0 -a "$QUEST_STATE" != 13 ]; do ;; 4) #private IP - - db_set alternc/internal_ip "$INTERNAL_IP" + db_get alternc/internal_ip + if [ -z "$RET" ]; then + db_set alternc/internal_ip "$INTERNAL_IP" + fi STATE=0 while [ $STATE -eq 0 ]; do @@ -173,16 +184,25 @@ while [ "$QUEST_STATE" != 0 -a "$QUEST_STATE" != 13 ]; do ;; 5) #We ask for the DNS server for the ip - db_set alternc/ns1 "$NS1_HOSTNAME" - db_input high alternc/ns1 || true + db_get alternc/ns1 + if [ -z "$RET" ]; then + db_set alternc/ns1 "$NS1_HOSTNAME" + db_input high alternc/ns1 || true + fi ;; 6) - db_set alternc/ns2 "$NS2_HOSTNAME" - db_input high alternc/ns2 || true + db_get alternc/ns2 + if [ -z "$RET" ]; then + db_set alternc/ns2 "$NS2_HOSTNAME" + db_input high alternc/ns2 || true + fi ;; 7) - db_set alternc/default_mx "$DEFAULT_MX" - db_input high alternc/default_mx || true + db_get alternc/default_mx + if [ -z "$RET" ]; then + db_set alternc/default_mx "$DEFAULT_MX" + db_input high alternc/default_mx || true + fi ;; 8) if [ "`mysql --defaults-file=/etc/mysql/debian.cnf -Bse 'SELECT "OK";' 2>/dev/null`" = "OK" ]; then From 58603c0e40d868cb853af8ef816ad898910b30bf Mon Sep 17 00:00:00 2001 From: Pierre-Louis Bonicoli Date: Tue, 25 Mar 2014 18:44:16 +0100 Subject: [PATCH 3/8] [enh] Remove redundant debconf commands --- debian/alternc.config | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/debian/alternc.config b/debian/alternc.config index 2200135d..3baf3142 100644 --- a/debian/alternc.config +++ b/debian/alternc.config @@ -300,31 +300,11 @@ 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` 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 if [ -z "$RET" ]; then db_set alternc/monitor_ip "$MONITOR_IP" fi -db_get alternc/ns2 -if [ -z "$RET" ] - then -db_set alternc/ns2 "$NS2_HOSTNAME" -fi - db_get alternc/default_mx2 if [ -z "$RET" ]; then db_set alternc/default_mx2 "$DEFAULT_SECONDARY_MX" From c8cfbdf4262f784145b068d4bac4499045ebda97 Mon Sep 17 00:00:00 2001 From: Pierre-Louis Bonicoli Date: Wed, 26 Mar 2014 02:04:00 +0100 Subject: [PATCH 4/8] [fix] debconf: avoid infinite loop (#1517) Don't loop when debconf frontend is non-interactive. --- debian/alternc.config | 3 +++ 1 file changed, 3 insertions(+) diff --git a/debian/alternc.config b/debian/alternc.config index 3baf3142..4a69ea03 100644 --- a/debian/alternc.config +++ b/debian/alternc.config @@ -52,6 +52,9 @@ check_mysql() STATE=`expr $STATE + 1` else db_input high alternc/remote_mysql_error || true + if [ $? -eq 30 ]; then + exit 4 + fi db_go db_get alternc/remote_mysql_error || true if [ "$RET" = "false" ]; then From bb26c2f13c9b7aabc45c5a78f3476c930341f20b Mon Sep 17 00:00:00 2001 From: Pierre-Louis Bonicoli Date: Wed, 26 Mar 2014 02:20:17 +0100 Subject: [PATCH 5/8] [fix] Allow to use a remote sql server even if a local one is installed --- debian/alternc.config | 23 +++++++++++++---------- debian/alternc.templates | 1 - 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/debian/alternc.config b/debian/alternc.config index 4a69ea03..c5e3aaf7 100644 --- a/debian/alternc.config +++ b/debian/alternc.config @@ -104,7 +104,7 @@ SQLBACKUP_TYPE="rotate" SQLBACKUP_OVERWRITE="no" 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 1) if [ -r /etc/alternc/local.sh ]; then @@ -210,19 +210,22 @@ while [ "$QUEST_STATE" != 0 -a "$QUEST_STATE" != 13 ]; do 8) if [ "`mysql --defaults-file=/etc/mysql/debian.cnf -Bse 'SELECT "OK";' 2>/dev/null`" = "OK" ]; then db_input critical alternc/use_local_mysql || true - else - db_input critical alternc/use_remote_mysql || true fi ;; 9) - db_get alternc/use_local_mysql || true - if [ -z "$RET" -o "$RET" == "false" ] - then - #user want to use a remote server - check_mysql + db_get alternc/use_local_mysql + if [ "$RET" != "true" ]; then + db_input critical alternc/use_remote_mysql || true fi ;; 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 db_get alternc/alternc_html @@ -259,14 +262,14 @@ while [ "$QUEST_STATE" != 0 -a "$QUEST_STATE" != 13 ]; do fi ) ;; - 11) + 12) db_get alternc/alternc_mail if [ -z "$RET" ]; then db_set alternc/alternc_mail $ALTERNC_MAIL db_input high alternc/alternc_mail fi ;; - 12) + 13) db_get alternc/alternc_logs if [ -z "$RET" ];then db_set alternc/alternc_logs $ALTERNC_LOGS diff --git a/debian/alternc.templates b/debian/alternc.templates index 9a98dca6..a7cd8d04 100644 --- a/debian/alternc.templates +++ b/debian/alternc.templates @@ -238,7 +238,6 @@ _Description: Use locally found MySQL server? Template: alternc/use_remote_mysql Type: boolean _Description: Use a remote MySQL server? - No local Mysql server was found. Please confirm you want to use a remote Mysql Server. If not, AlternC cannot be installed. From c05f1bddd21d50a2891fc8dfb4b01ceaa4fc2b0a Mon Sep 17 00:00:00 2001 From: Pierre-Louis Bonicoli Date: Wed, 26 Mar 2014 02:21:08 +0100 Subject: [PATCH 6/8] [fix] debconf: don't fail when noninteractive frontend is used --- debian/alternc.config | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/debian/alternc.config b/debian/alternc.config index c5e3aaf7..c1fce570 100644 --- a/debian/alternc.config +++ b/debian/alternc.config @@ -231,7 +231,7 @@ while [ "$QUEST_STATE" != 0 -a "$QUEST_STATE" != 14 ]; do db_get alternc/alternc_html if [ -z "$RET" ]; then db_set alternc/alternc_html $ALTERNC_HTML - db_input high alternc/alternc_html + db_input high alternc/alternc_html || true fi db_get alternc/alternc_html @@ -266,14 +266,14 @@ while [ "$QUEST_STATE" != 0 -a "$QUEST_STATE" != 14 ]; do db_get alternc/alternc_mail if [ -z "$RET" ]; then db_set alternc/alternc_mail $ALTERNC_MAIL - db_input high alternc/alternc_mail + db_input high alternc/alternc_mail || true fi ;; 13) db_get alternc/alternc_logs if [ -z "$RET" ];then db_set alternc/alternc_logs $ALTERNC_LOGS - db_input high alternc/alternc_logs + db_input high alternc/alternc_logs || true fi ;; esac From ca8cd304370ee1b5510167378fc7e5d7e47a5dc5 Mon Sep 17 00:00:00 2001 From: Pierre-Louis Bonicoli Date: Wed, 26 Mar 2014 02:52:52 +0100 Subject: [PATCH 7/8] [enh] remote mysql: show an error when connection fails --- debian/alternc.config | 8 ++++++-- debian/alternc.templates | 9 ++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/debian/alternc.config b/debian/alternc.config index c1fce570..4b33c591 100644 --- a/debian/alternc.config +++ b/debian/alternc.config @@ -51,13 +51,17 @@ check_mysql() if [ "`mysql -u"$MYSQL_USER" -p"$MYSQL_PASSWORD" -h"$MYSQL_HOST" -Bse 'SELECT "OK";' 2>/dev/null`" = "OK" ]; then STATE=`expr $STATE + 1` else - db_input high alternc/remote_mysql_error || true + db_input high alternc/retry_remote_mysql || true if [ $? -eq 30 ]; then + db_input high alternc/remote_mysql_error || true + db_go || true exit 4 fi db_go - db_get alternc/remote_mysql_error || true + db_get alternc/retry_remote_mysql || true if [ "$RET" = "false" ]; then + db_input high alternc/remote_mysql_error || true + db_go || true exit 4 fi fi diff --git a/debian/alternc.templates b/debian/alternc.templates index a7cd8d04..49fa3317 100644 --- a/debian/alternc.templates +++ b/debian/alternc.templates @@ -241,7 +241,7 @@ _Description: Use a remote MySQL server? Please confirm you want to use a remote Mysql Server. If not, AlternC cannot be installed. -Template: alternc/remote_mysql_error +Template: alternc/retry_remote_mysql Type: boolean _Description: MySQL connection error. Try again? Remote connection to the MySQL server failed. @@ -254,3 +254,10 @@ _Description: Private IP detected, use it anyway? this is an expected situation, since the server might not be reachable 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. From a7d1a5c3d87e43729729ab00ba78ba964ae65adf Mon Sep 17 00:00:00 2001 From: Pierre-Louis Bonicoli Date: Wed, 26 Mar 2014 02:58:15 +0100 Subject: [PATCH 8/8] [fix] debconf: use error instead of note (#1524) When encountered, errors are always showed. --- debian/alternc.config | 6 ++---- debian/alternc.templates | 5 ++++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/debian/alternc.config b/debian/alternc.config index 4b33c591..2784ed09 100644 --- a/debian/alternc.config +++ b/debian/alternc.config @@ -248,10 +248,8 @@ while [ "$QUEST_STATE" != 0 -a "$QUEST_STATE" != 14 ]; do touch "$aclcheckfile" setfacl -m u:root:rwx "$aclcheckfile" 2>/dev/null || ( test -e "$aclcheckfile" && rm -f "$aclcheckfile" || true - db_input critical alternc/acluninstalled || true - db_go - db_reset alternc/acluninstalled || true - db_fset alternc/acluninstalled "seen" "false" || true + db_input high alternc/acluninstalled || true + db_go || true exit 2 ) test -e "$aclcheckfile" && rm -f "$aclcheckfile" || true diff --git a/debian/alternc.templates b/debian/alternc.templates index 49fa3317..53e45640 100644 --- a/debian/alternc.templates +++ b/debian/alternc.templates @@ -1,11 +1,14 @@ Template: alternc/acluninstalled -Type: note +Type: error _Description: AlternC need ACL on filesystem AlternC can't work without ACL activated on its filesystem. ACL are currently not enabled. . Also, you need to activate group quota (grpquota) 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 Type: note