[Pkg-php-commits] [php/debian-sid] Make sure even harded to not left any stale file after purging the package

Ondřej Surý ondrej at sury.org
Mon Apr 11 07:09:29 UTC 2011


---
 debian/libapache2-mod-php5.prerm       |   19 ++++++++++++-------
 debian/libapache2-mod-php5filter.prerm |   19 ++++++++++++-------
 2 files changed, 24 insertions(+), 14 deletions(-)

diff --git a/debian/libapache2-mod-php5.prerm b/debian/libapache2-mod-php5.prerm
index e7865fe..ff42610 100644
--- a/debian/libapache2-mod-php5.prerm
+++ b/debian/libapache2-mod-php5.prerm
@@ -4,17 +4,22 @@ set -e
 
 #DEBHELPER#
 
-if [ "$1" != "remove" -a "$1" != "purge" ]; then
-        exit 0
-fi
-
-if [ -e /etc/apache2/apache2.conf ]; then
-	if [ -e /etc/apache2/mods-enabled/php5.load ] && [ "$1" != "purge" ]; then
+case "$1" in
+    purge)
+        # remove the flag file rather than just not creating it
+	if [ -e /etc/php5/apache2/.start ]; then
+	    rm -f /etc/php5/apache2/.start
+	fi
+	a2dismod php5 || true
+	;;
+    remove)
+	if [ -e /etc/apache2/apache2.conf -a -e /etc/apache2/mods-enabled/php5.load ]; then
 	    # set a flag to remember the original state
 	    #  useful when reinstalling the same version.
 	    touch /etc/php5/apache2/.start
 	fi
 	a2dismod php5 || true
-fi
+	;;
+esac
 
 exit 0
diff --git a/debian/libapache2-mod-php5filter.prerm b/debian/libapache2-mod-php5filter.prerm
index 7d1c1b8..1af2d93 100644
--- a/debian/libapache2-mod-php5filter.prerm
+++ b/debian/libapache2-mod-php5filter.prerm
@@ -4,17 +4,22 @@ set -e
 
 #DEBHELPER#
 
-if [ "$1" != "remove" -a "$1" != "purge" ]; then
-        exit 0
-fi
-
-if [ -e /etc/apache2/apache2.conf ]; then
-	if [ -e /etc/apache2/mods-enabled/php5.load ] && [ "$1" != "purge" ]; then
+case "$1" in
+    purge)
+        # remove the flag file rather than just not creating it
+	if [ -e /etc/php5/apache2filter/.start ]; then
+	    rm -f /etc/php5/apache2filter/.start
+	fi
+	a2dismod php5filter || true
+	;;
+    remove)
+	if [ -e /etc/apache2/apache2.conf -a -e /etc/apache2/mods-enabled/php5.load ]; then
 	    # set a flag to remember the original state
 	    #  useful when reinstalling the same version.
 	    touch /etc/php5/apache2filter/.start
 	fi
 	a2dismod php5filter || true
-fi
+	;;
+esac
 
 exit 0
-- 
1.7.1




More information about the Pkg-php-commits mailing list