From aedd23b3aa1a52574a2cb53ff47b89a8830eeba9 Mon Sep 17 00:00:00 2001 From: Valentin Vidic Date: Fri, 30 Sep 2011 13:33:30 +0200 Subject: [PATCH] Handle config upgrades. --- src/functions.sh | 91 ++++++++++++++++++++---------------------------------- 1 file changed, 34 insertions(+), 57 deletions(-) diff --git a/src/functions.sh b/src/functions.sh index 776c5dd..79c2bfd 100644 --- a/src/functions.sh +++ b/src/functions.sh @@ -823,98 +823,75 @@ restore_configs () { local hostname domain config_new memtotal memlimit # restore simple configs - if pkg kernel-2.6-cn && pkg procps lt 1:3.2.7-11; then + if pkg ntp-cn && pkg ntp lt 1:4.2.6.p2+dfsg-1+b1; then + if restore_file /etc/ntp.conf; then + postupgrade_reconfigure ntp-cn + fi + fi + + if pkg kernel-2.6-cn && pkg procps lt 1:3.2.8-9; then if restore_file /etc/sysctl.conf; then postupgrade_reconfigure kernel-2.6-cn fi fi - if pkg ntp-cn && pkg ntp lt 1:4.2.4p4+dfsg-8; then - if restore_file /etc/ntp.conf; then - postupgrade_reconfigure ntp-cn + if pkg kernel-2.6-cn && pkg libpam-modules lt 1.1.1-6.1; then + if restore_file /etc/security/limits.conf; then + postupgrade_reconfigure kernel-2.6-cn fi fi - if pkg apache2-cn && pkg apache2.2-common lt 2.2.9-10+lenny2; then - if restore_file /etc/apache2/ports.conf; then - postupgrade_reconfigure apache2-cn + if pkg vsftpd-cn && pkg vsftpd lt 2.3.2-3+squeeze2; then + if restore_file /etc/vsftpd.conf; then + postupgrade_reconfigure vsftpd-cn fi fi - if pkg postfix-cn && pkg sasl2-bin lt 2.1.22.dfsg1-23; then - if restore_file /etc/default/saslauthd; then - postupgrade_reconfigure postfix-cn + if pkg squirrelmail-cn && pkg squirrelmail lt 2:1.4.21-2; then + if restore_file /etc/squirrelmail/apache.conf; then + postupgrade_reconfigure squirrelmail-cn fi fi - if pkg bind9-cn && pkg bind9 lt 1:9.5.1.dfsg.P1-1; then - if restore_file /etc/bind/named.conf.options; then - postupgrade_reconfigure bind9-cn + if pkg spamassassin-cn && pkg spamassassin lt 3.3.1-1; then + if restore_file /etc/spamassassin/v310.pre; then + postupgrade_reconfigure spamassassin-cn fi fi - if pkg amavisd-cn && pkg amavisd-new lt 1:2.6.1.dfsg-1; then + if pkg amavisd-cn && pkg amavisd-new lt 1:2.6.4-3; then if restore_file /etc/cron.daily/amavisd-new; then rm -f /etc/cron.daily/amavisd-new.$backup_ext postupgrade_reconfigure amavisd-cn fi - fi - if pkg spamassassin-cn && pkg razor lt 1:2.85-1; then - if restore_file /etc/razor/razor-agent.conf; then - postupgrade_reconfigure spamassassin-cn + if restore_file /etc/amavis/conf.d/15-av_scanners; then + rm -f /etc/amavis/conf.d/15-av_scanners.$backup_ext + postupgrade_reconfigure amavisd-cn fi fi - if pkg kernel-2.6-cn && pkg libpam-modules lt 1.0.1-5; then - if restore_file /etc/security/limits.conf; then - postupgrade_reconfigure kernel-2.6-cn - fi + if pkg amavisd-cn lt 3:2.6.5; then + restore_file /etc/init.d/amavisd-cn fi - if pkg samba-cn && pkg samba-common lt 2:3.2.5-4lenny2; then - if restore_file /etc/samba/smb.conf; then - postupgrade_reconfigure samba-cn - fi + if pkg console-tools lt 1:0.2.3dbs-69.1; then + restore_file /etc/console-tools/config fi - if pkg base-files lt 5lenny2; then + if pkg base-files lt 6.0squeeze2; then restore_file /etc/issue restore_file /etc/issue.net fi - # restore php.ini - memtotal=$(awk '$1 == "MemTotal:" { print int($2/1024) }' /proc/meminfo) - if [ $memtotal -gt 1024 ]; then - memlimit=64 - elif [ $memtotal -ge 512 ]; then - memlimit=32 - else - memlimit=16 - fi - - if pkg php5-cn && pkg php5-cli lt 5.2.6.dfsg.1-1+lenny2; then - config_new=$(copy_template /etc/php5/cli/php.ini) - sed -i "s/^[[:space:]]*memory_limit[[:space:]]*=.*/memory_limit = ${memlimit}M/" $config_new - sed -i "s/^[[:space:]]*post_max_size[[:space:]]*=.*/post_max_size = ${memlimit}M/" $config_new - if restore_file /etc/php5/cli/php.ini $config_new; then - postupgrade_reconfigure php5-cn - fi - rm -f $config_new - fi - - if pkg php5-cn && pkg libapache2-mod-php5 lt 5.2.6.dfsg.1-1+lenny2; then - config_new=$(copy_template /etc/php5/apache2/php.ini) - sed -i "s/^[[:space:]]*memory_limit[[:space:]]*=.*/memory_limit = ${memlimit}M/" $config_new - sed -i "s/^[[:space:]]*post_max_size[[:space:]]*=.*/post_max_size = ${memlimit}M/" $config_new - if restore_file /etc/php5/apache2/php.ini $config_new; then - postupgrade_reconfigure php5-cn - fi - rm -f $config_new + # dovecot won't start with these options + if pkg dovecot-cn && pkg dovecot-common lt 1:1.2.15-7; then + sed -i 's/^\( *\)\(sieve\(_storage\)\?=.*\)/\1#\2/' \ + /etc/dovecot/dovecot.conf fi # check if monitrc is template based - if [ -f /etc/monit/monitrc ]; then + if [ -e /etc/monit/monitrc ]; then # monit is removed at this point # regenerate config from template hostname=$(hostname) domain=$(hostname --domain) @@ -1164,7 +1141,7 @@ upgrade_munin () { local config backup hostname domain for pkg_name in munin munin-node; do - pkg $pkg_name lt '1.2.6-10~lenny1' || continue + pkg $pkg_name lt '1.4.5-3' || continue config=/etc/munin/$pkg_name.conf backup=$config.$backup_ext -- 1.7.10.4