Fix suhosin upgrade problems.
authorValentin Vidic <vvidic@carnet.hr>
Tue, 25 Mar 2008 14:21:49 +0000 (15:21 +0100)
committerValentin Vidic <vvidic@carnet.hr>
Tue, 25 Mar 2008 14:21:49 +0000 (15:21 +0100)
Fix postgresql upgrade problems.

src/actions/main.queue
src/data.sh
src/functions.sh
src/scripts/check_services

index d8c280e..4fb017d 100644 (file)
@@ -16,14 +16,12 @@ true                                update                  # apt-get update & download
 true                           check_disk_space
 ! debconf_priority check       debconf_priority set    # utisaj debconf
 # postgresql-common/etch zahtjeva da postgresql nije instaliran
-pkg postgresql                 post_upgrade pkgadd postgresql
-pkg postgresql                 pkgrm postgresql
 true                           upgrade_libc
 true                           install_keyrings
 pkg skey-cn                    remove_skey
 # mrtg je zamjenjen sa munin
 pkg mrtg-cn                    post_upgrade pkgadd munin-cn
-pkg mrtg-cn                    pkgrm mrtg mrtg-cn
+pkg mrtg-cn                    pkgrm mrtg-cn
 # popravi konfiguracije koje stvaraju probleme
 true                           restore_configs
 # monit stvara probleme postinst skriptama
@@ -32,9 +30,9 @@ pkg monit-cn                  pkgrm monit-cn
 pkg amavisd-cn                 upgrade_amavis
 pkg apache2-cn                 upgrade_apache2
 pkg dovecot-cn                 upgrade_dovecot
-pkg postfix-cn                 pkgadd postfix-cn
-pkg postgrey                   pkgrm postgrey          # problematican
+pkg postfix-cn                 upgrade_postfix
 pkg openldap-aai               upgrade_openldap
+true                           upgrade_postgresql
 true                           upgrade first           # neki paketi moraju rucno
 true                           upgrade second          # neke pakete zelimo ranije
 true                           dist_upgrade            # instaliraj ostatak
index 8041512..d4ccb20 100644 (file)
@@ -107,7 +107,7 @@ openssh-cn          root            /usr/sbin/sshd                          OpenSSH
 ossec-hids-cn          ossecm          /var/ossec/bin/ossec                    OSSec
 postfix-cn             root            /usr/lib/postfix/master                 Postfix
 postfix-cn             root            /usr/sbin/saslauthd                     SASL authentication
-postgresql-cn          postgres        /usr/lib/postgresql/bin/postmaster      PostgreSQL
+postgresql             postgres        /usr/lib/postgresql/bin/postmaster      PostgreSQL
 samba-cn               root            /usr/sbin/smbd                          Samba
 snort-cn               snort           /usr/sbin/snort                         Snort
 spamassassin-cn                dcc             /usr/sbin/dccifd                        DCC client
index d25ca65..ddcb7e0 100644 (file)
@@ -596,21 +596,29 @@ upgrade_libc () {
 
 # upgrade apache2 to etch
 upgrade_apache2 () {
-  local package
+  local package packages
+
+  # php-suhosin-cn causes removal of applications on dist-upgrade
+  # because of php5 only dependencies
+  pkgrm php-suhosin-cn
 
   for package in \
       libapache2-mod-php4 \
       php4-cli \
       php4-cgi \
       php4-cn \
-      apache2-cn
+      apache2-cn \
+      php4-odbc \
+      php4-suhosin
   do
       if pkg $package; then
-          pkgadd $package
+          packages="$packages $package"
       fi
   done
 
-  pkgrm php-suhosin-cn # causes removal of applications on dist-upgrade
+  for package in $packages; do
+      pkgadd $package
+  done
 }
 
 upgrade_amavis () {
@@ -649,6 +657,22 @@ upgrade_openldap () {
   dpkg --configure -a # try postinst again
 }
 
+# fix postgresql deinstallation during upgrade
+upgrade_postgresql () {
+  if check_services show 2>&1 | grep -qw postgresql; then
+     pkgadd postgresql || apt-get -f install
+  fi
+}
+
+# upgrade the MTA
+upgrade_postfix () {
+  pkgadd postfix-cn
+
+  if pkg postgrey; then
+     pkgrm postgrey # not used by postfix-cn anymore
+  fi
+}
+
 get_variable () {
   local name=$1 file=$2 val
 
index c097493..3c33c6b 100755 (executable)
@@ -87,6 +87,12 @@ cs_check () {
   fi
 }
 
+# prikazi sto je zapisano u debconf
+cs_show () {
+  db_get carnet-upgrade/check-services || true
+  echo "$RET"
+}
+
 case "$1" in
 preupgrade)    cs_preupgrade
        ;;
@@ -94,7 +100,9 @@ postupgrade) cs_postupgrade
         ;;
 check) cs_check
         ;;
-*)     echo "Usage: $0 (preupgrade|postupgrade|check)"
+show)   cs_show
+        ;;
+*)     echo "Usage: $0 (preupgrade|postupgrade|check|show)"
         exit 1 
         ;;
 esac