]> git.proxmox.com Git - pve-manager-legacy.git/commitdiff
postinst: unify version-dependent cleanup
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Tue, 13 Mar 2018 09:46:38 +0000 (10:46 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 13 Mar 2018 10:06:12 +0000 (11:06 +0100)
putting this into one place is better for readability

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
debian/postinst

index ebce25364856d36c25313cba7c481f3e18d5b9a6..f2ac0ab29ff8da629ac22f212c32bdd9b327e865 100755 (executable)
@@ -31,15 +31,6 @@ case "$1" in
 
     mkdir /etc/pve 2>/dev/null || true
 
-    if dpkg --compare-versions "$2" '<=' '5.1-47'; then
-       # remove cron update job, superseded by systemd timer
-       rm -f /etc/cron.d/pveupdate
-
-       # remove old/unused init.d files
-       OLD_INITD_FILES="pvebanner pvenetcommit pve-manager pvedaemon pveproxy pvestatd spiceproxy"
-       for f in ${OLD_INITD_FILES}; do rm -f "/etc/init.d/$f"; done
-    fi
-
     if test ! -e /var/lib/pve-manager/apl-info/download.proxmox.com; then
        mkdir -p /var/lib/pve-manager/apl-info
        cp /usr/share/doc/pve-manager/aplinfo.dat /var/lib/pve-manager/apl-info/download.proxmox.com
@@ -78,15 +69,23 @@ case "$1" in
        done
     fi
 
-    if test -z "$2"; then
-      : # no old version, nothing to do
-    else
-      # "$2" is the most recently configured version
-      if dpkg --compare-versions "$2" '<=' '5.0-23'; then
-        # 5.0-23 temporarily reverted the removal of the startcom CA in
-        # ca-certificates; we've since switched to let's encrypt
-        update-ca-certificates >/dev/null 2>&1
-      fi
+    if test -n "$2"; then
+       # "$2" is the most recently configured version
+
+       if dpkg --compare-versions "$2" '<=' '5.0-23'; then
+           # 5.0-23 temporarily reverted the removal of the startcom CA in
+           # ca-certificates; we've since switched to let's encrypt
+           update-ca-certificates >/dev/null 2>&1
+       fi
+
+       if dpkg --compare-versions "$2" '<=' '5.1-47'; then
+           # remove cron update job, superseded by systemd timer
+           rm -f /etc/cron.d/pveupdate
+
+           # remove old/unused init.d files
+           OLD_INITD_FILES="pvebanner pvenetcommit pve-manager pvedaemon pveproxy pvestatd spiceproxy"
+           for f in ${OLD_INITD_FILES}; do rm -f "/etc/init.d/$f"; done
+       fi
     fi
     ;;