diff --git a/autoscripts/preinst-pycentral-clean b/autoscripts/preinst-pycentral-clean
index 412602a039873afee957df094dc2e6d8dd86168e..72cfa8e5e5ca58fe4f1c49b80d2a37bb5ae15b0c 100644
--- a/autoscripts/preinst-pycentral-clean
+++ b/autoscripts/preinst-pycentral-clean
@@ -1,6 +1,9 @@
 # make sure python-central files are removed before new package is installed
-if [ -f /var/lib/pycentral/#PACKAGE#.pkgremove ]
-then
-	pycentral pkgremove #PACKAGE#
-	rm -f /var/lib/pycentral/#PACKAGE#.pkgremove
-fi
+case "$1" in
+    install|upgrade)
+	if [ -f /var/lib/pycentral/#PACKAGE#.pkgremove ]
+	then
+		pycentral pkgremove #PACKAGE#
+		rm -f /var/lib/pycentral/#PACKAGE#.pkgremove
+	fi
+esac