From cdb3a1e281b6625ee557f841d86adbb2ea9100c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antoine=20Beaupr=C3=A9?= Date: Mon, 6 Oct 2008 21:13:11 +0000 Subject: [PATCH] remove alternc/mynetwork debconf parameter, stop overriding it in postfix also split the config prompts between slave and non-slave package See: #1029 --- .gitattributes | 3 +- debian/alternc-slave.config | 176 ++++++++++++++++++++++++++ debian/alternc-slave.postinst | 4 - debian/{config => alternc.config} | 7 - debian/alternc.postinst | 4 - debian/changelog | 3 + debian/templates | 10 -- etc/alternc/templates/postfix/main.cf | 1 - install/alternc.install | 1 - 9 files changed, 181 insertions(+), 28 deletions(-) create mode 100644 debian/alternc-slave.config rename debian/{config => alternc.config} (96%) diff --git a/.gitattributes b/.gitattributes index e78fe819..74b12a51 100644 --- a/.gitattributes +++ b/.gitattributes @@ -245,6 +245,7 @@ bureau/locales/manual.pot -text bureau/locales/messages.pot -text bureau/locales/pt_BR/LC_MESSAGES/messages.po -text debian/README.Debian -text +debian/alternc-slave.config -text debian/alternc-slave.dirs -text debian/alternc-slave.install -text debian/alternc-slave.links -text @@ -253,6 +254,7 @@ debian/alternc-slave.logrotate -text debian/alternc-slave.postinst -text debian/alternc-slave.postrm -text debian/alternc-slave.prerm -text +debian/alternc.config -text debian/alternc.cron.d -text debian/alternc.dirs -text debian/alternc.links -text @@ -264,7 +266,6 @@ debian/alternc.preinst -text debian/alternc.prerm -text debian/changelog -text debian/compat -text -debian/config -text debian/control -text debian/copyright -text debian/docs -text diff --git a/debian/alternc-slave.config b/debian/alternc-slave.config new file mode 100644 index 00000000..896aaa47 --- /dev/null +++ b/debian/alternc-slave.config @@ -0,0 +1,176 @@ +#! /bin/sh + +set -e + +# Source debconf library. +. /usr/share/debconf/confmodule +db_title AlternC + +db_input critical alternc-slave/welcomeconfirm || true + +db_go +# Check the answer. +db_get alternc-slave/welcomeconfirm || true + +if [ "$RET" = "false" ]; then + # reset the welcomeconfirm flag if user refuses so it gets asked again next time + db_reset alternc-slave/welcomeconfirm || true + db_fset alternc-slave/welcomeconfirm "seen" "false" || true + exit 1 +fi + +# default values for local.sh +MYSQL_HOST=127.0.0.1 +MYSQL_DATABASE=alternc +MYSQL_USER=sysusr +MYSQL_PASS="`perl -e 'print map{("a".."z","A".."Z",0..9)[int(rand(62))]}(1..10)' `" +MYSQL_CLIENT=localhost +FQDN="`cat /etc/mailname 2>/dev/null || hostname -f`" +INTERNAL_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`" +PUBLIC_IP="$INTERNAL_IP" +DEFAULT_MX="`cat /etc/mailname 2>/dev/null || hostname -f`" +ALTERNC_LOC=/var/alternc +NS1_HOSTNAME="$FQDN" +NS2_HOSTNAME="$FQDN" +HOSTING="AlternC" +SQLBACKUP_TYPE="rotate" +SQLBACKUP_OVERWRITE="no" + +if [ -r /etc/alternc/local.sh ]; then + # source the current config + . /etc/alternc/local.sh +fi +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` +fi + +# mettre les valeurs de local.sh comme "default" pour debconf +db_get alternc-slave/hostingname +if [ -z "$RET" ] + then + db_set alternc-slave/hostingname "$HOSTING" +fi + +db_get alternc-slave/desktopname +if [ -z "$RET" ] + then +db_set alternc-slave/desktopname "$FQDN" +fi + +db_get alternc-slave/public_ip +if [ -z "$RET" ] + then +db_set alternc-slave/public_ip "$PUBLIC_IP" +fi + +db_get alternc-slave/internal_ip +if [ -z "$RET" ] + then +db_set alternc-slave/internal_ip "$INTERNAL_IP" +fi + +db_get alternc-slave/monitor_ip +if [ -z "$RET" ] + then +db_set alternc-slave/monitor_ip "$MONITOR_IP" +fi + +db_get alternc-slave/ns1 +if [ -z "$RET" ] + then +db_set alternc-slave/ns1 "$NS1_HOSTNAME" +fi + +db_get alternc-slave/ns2 +if [ -z "$RET" ] + then +db_set alternc-slave/ns2 "$NS2_HOSTNAME" +fi + +db_get alternc-slave/bind_internal +if [ -z "$RET" ] + then +db_set alternc-slave/bind_internal "$BIND_INTERNAL" +fi + +db_get alternc-slave/default_mx +if [ -z "$RET" ] + then +db_set alternc-slave/default_mx "$DEFAULT_MX" +fi + +db_get alternc-slave/mysql/host +if [ -z "$RET" ] + then +db_set alternc-slave/mysql/host "$MYSQL_HOST" +fi + +db_get alternc-slave/mysql/db +if [ -z "$RET" ] + then +db_set alternc-slave/mysql/db "$MYSQL_DATABASE" +fi + +db_get alternc-slave/mysql/user +if [ -z "$RET" ] + then +db_set alternc-slave/mysql/user "$MYSQL_USER" +fi + +db_get alternc-slave/mysql/password +if [ -z "$RET" ] + then +db_set alternc-slave/mysql/password "$MYSQL_PASS" +fi + +db_get alternc-slave/mysql/client +if [ -z "$RET" ] + then +db_set alternc-slave/mysql/client "$MYSQL_CLIENT" +fi + +db_get alternc-slave/sql/backup_type +if [ -z "$RET" ] + then +db_set alternc-slave/sql/backup_type "$SQLBACKUP_TYPE" +fi + +db_get alternc-slave/sql/backup_overwrite +if [ -z "$RET" ] + then +db_set alternc-slave/sql/backup_overwrite "$SQLBACKUP_OVERWRITE" +fi + +db_get alternc-slave/alternc_location +if [ -z "$RET" ] + then +db_set alternc-slave/alternc_location "$ALTERNC_LOC" +fi + +db_input medium alternc-slave/desktopname || true +db_input medium alternc-slave/hostingname || true +db_input medium alternc-slave/internal_ip || true +db_input medium alternc-slave/public_ip || true +db_input medium alternc-slave/default_mx || true +db_input medium alternc-slave/ns1 || true +db_input medium alternc-slave/ns2 || true +db_input low alternc-slave/alternc_location || true +db_input low alternc-slave/mysql/host || true +db_input low alternc-slave/mysql/db || true +db_input low alternc-slave/mysql/user || true +db_input low alternc-slave/mysql/password || true +db_input low alternc-slave/mysql/client || true +db_input low alternc-slave/sql/backup_type || true +db_input low alternc-slave/sql/overwrite || true +db_input low alternc-slave/monitor_ip || true +db_input low alternc-slave/bind_internal || true +db_go + +# vim: et sw=4 diff --git a/debian/alternc-slave.postinst b/debian/alternc-slave.postinst index 90abeabd..20ce7501 100644 --- a/debian/alternc-slave.postinst +++ b/debian/alternc-slave.postinst @@ -93,9 +93,6 @@ MYSQL_CLIENT="" # Folder holding data (used for quota management) ALTERNC_LOC="" -# Networks that SMTP should relay, separated with spaces -SMTP_RELAY_NETWORKS="" - # the type of backup created by the sql backup script # valid options are "rotate" (newsyslog-style) or "date" (suffix is the date) SQLBACKUP_TYPE="" @@ -129,7 +126,6 @@ EOF update_var alternc/sql/backup_type SQLBACKUP_TYPE update_var alternc/sql/backup_overwrite SQLBACKUP_OVERWRITE update_var alternc/alternc_location ALTERNC_LOC - update_var alternc/mynetwork SMTP_RELAY_NETWORKS sed -e "$SED_SCRIPT" < $CONFIGFILE > $CONFIGFILE.tmp mv -f $CONFIGFILE.tmp $CONFIGFILE diff --git a/debian/config b/debian/alternc.config similarity index 96% rename from debian/config rename to debian/alternc.config index eef12421..aaa95676 100644 --- a/debian/config +++ b/debian/alternc.config @@ -154,12 +154,6 @@ if [ -z "$RET" ] db_set alternc/alternc_location "$ALTERNC_LOC" fi -db_get alternc/mynetwork -if [ -z "$RET" ] - then -db_set alternc/mynetwork "$SMTP_RELAY_NETWORKS" -fi - db_input medium alternc/desktopname || true db_input medium alternc/hostingname || true db_input medium alternc/internal_ip || true @@ -177,7 +171,6 @@ db_input low alternc/sql/backup_type || true db_input low alternc/sql/overwrite || true db_input low alternc/monitor_ip || true db_input low alternc/bind_internal || true -db_input low alternc/mynetwork || true db_go # vim: et sw=4 diff --git a/debian/alternc.postinst b/debian/alternc.postinst index 9c0d9b02..325d1791 100644 --- a/debian/alternc.postinst +++ b/debian/alternc.postinst @@ -93,9 +93,6 @@ MYSQL_CLIENT="" # Folder holding data (used for quota management) ALTERNC_LOC="" -# Networks that SMTP should relay, separated with spaces -SMTP_RELAY_NETWORKS="" - # the type of backup created by the sql backup script # valid options are "rotate" (newsyslog-style) or "date" (suffix is the date) SQLBACKUP_TYPE="" @@ -129,7 +126,6 @@ EOF update_var alternc/sql/backup_type SQLBACKUP_TYPE update_var alternc/sql/backup_overwrite SQLBACKUP_OVERWRITE update_var alternc/alternc_location ALTERNC_LOC - update_var alternc/mynetwork SMTP_RELAY_NETWORKS sed -e "$SED_SCRIPT" < $CONFIGFILE > $CONFIGFILE.tmp mv -f $CONFIGFILE.tmp $CONFIGFILE diff --git a/debian/changelog b/debian/changelog index 6dc43a23..82fed0c8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -19,6 +19,9 @@ alternc (0.9.9) stable; urgency=low value or available domains * make a new alternc-slave package that eases installation on NFS-backed frontend nodes + * other changes: + * deprecate the mynetwork modification in Postfix, this is now left to the + admin -- Antoine Beaupré Tue, 15 Apr 2008 11:52:56 -0400 diff --git a/debian/templates b/debian/templates index 886cac33..a865acec 100644 --- a/debian/templates +++ b/debian/templates @@ -148,11 +148,6 @@ _Description: trusted servers for bind: IP address or prefix of trusted machines for DNS transfers, delimited by ';', optional. -Template: alternc/mynetwork -Type: string -_Description: SMTP authorized networks: - IP addresses of the networks authorized in SMTP, space-delimited. - Template: alternc/pop_before_smtp_warning Type: note _Description: POP Before SMTP deprecated @@ -337,11 +332,6 @@ _Description: trusted servers for bind: IP address or prefix of trusted machines for DNS transfers, delimited by ';', optional. -Template:alternc-slave/mynetwork -Type: string -_Description: SMTP authorized networks: - IP addresses of the networks authorized in SMTP, space-delimited. - Template:alternc-slave/pop_before_smtp_warning Type: note _Description: POP Before SMTP deprecated diff --git a/etc/alternc/templates/postfix/main.cf b/etc/alternc/templates/postfix/main.cf index e5b14a5f..b974fba0 100644 --- a/etc/alternc/templates/postfix/main.cf +++ b/etc/alternc/templates/postfix/main.cf @@ -23,7 +23,6 @@ default_destination_concurrency_limit = 10 myhostname = %%fqdn%% myorigin = %%fqdn%% -mynetworks = 127.0.0.1 %%mynetwork%% # Configuration TLS pour le serveur smtp : diff --git a/install/alternc.install b/install/alternc.install index 48653eeb..a5598d42 100644 --- a/install/alternc.install +++ b/install/alternc.install @@ -136,7 +136,6 @@ s\\%%dbname%%\\$MYSQL_DATABASE\\; s\\%%dbuser%%\\$MYSQL_USER\\; s\\%%dbpwd%%\\$MYSQL_PASS\\; s\\%%ALTERNC_LOC%%\\$ALTERNC_LOC\\; -s\\%%mynetwork%%\\$SMTP_RELAY_NETWORKS\\; s\\%%warning_message%%\\$WARNING\\; s\\%%fqdn_lettre%%\\$FQDN_LETTER\\; s\\%%version%%\\$VERSION\\;