[pve-devel] [PATCH manager 4/8] postinst: unify version-dependent cleanup

Fabian Grünbichler f.gruenbichler at proxmox.com
Tue Mar 13 10:46:38 CET 2018


putting this into one place is better for readability

Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
 debian/postinst | 35 +++++++++++++++++------------------
 1 file changed, 17 insertions(+), 18 deletions(-)

diff --git a/debian/postinst b/debian/postinst
index ebce2536..f2ac0ab2 100755
--- a/debian/postinst
+++ b/debian/postinst
@@ -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
     ;;
 
-- 
2.14.2





More information about the pve-devel mailing list