[25448] in Source-Commits

home help back first fref pref prev next nref lref last post

/svn/athena r24992 - trunk/debathena/config/auto-update/debian

daemon@ATHENA.MIT.EDU (Jonathan D Reed)
Tue Mar 1 15:10:34 2011

Date: Tue, 1 Mar 2011 15:10:28 -0500
From: Jonathan D Reed <jdreed@MIT.EDU>
Message-Id: <201103012010.p21KAS8N000537@drugstore.mit.edu>
To: source-commits@mit.edu
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Author: jdreed
Date: 2011-03-01 15:10:28 -0500 (Tue, 01 Mar 2011)
New Revision: 24992

Modified:
   trunk/debathena/config/auto-update/debian/changelog
   trunk/debathena/config/auto-update/debian/debathena-auto-update.postinst
   trunk/debathena/config/auto-update/debian/debathena-auto-update.postrm
Log:
In auto-update:
  * Remove old cron.d file while attempting to comply with Debian policy


Modified: trunk/debathena/config/auto-update/debian/changelog
===================================================================
--- trunk/debathena/config/auto-update/debian/changelog	2011-03-01 19:35:35 UTC (rev 24991)
+++ trunk/debathena/config/auto-update/debian/changelog	2011-03-01 20:10:28 UTC (rev 24992)
@@ -1,8 +1,9 @@
 debathena-auto-update (1.22) unstable; urgency=low
 
   * Install debathena-license-config and reconfigure packages as necessary
+  * Remove old cron.d file while attempting to comply with Debian policy
 
- -- Jonathan Reed <jdreed@mit.edu>  Thu, 24 Feb 2011 16:29:09 -0500
+ -- Jonathan Reed <jdreed@mit.edu>  Tue, 01 Mar 2011 15:02:30 -0500
 
 debathena-auto-update (1.21) unstable; urgency=low
 

Modified: trunk/debathena/config/auto-update/debian/debathena-auto-update.postinst
===================================================================
--- trunk/debathena/config/auto-update/debian/debathena-auto-update.postinst	2011-03-01 19:35:35 UTC (rev 24991)
+++ trunk/debathena/config/auto-update/debian/debathena-auto-update.postinst	2011-03-01 20:10:28 UTC (rev 24992)
@@ -33,6 +33,28 @@
 UPD_CRONFILE=/etc/cron.d/athena-auto-update
 UPG_CRONFILE=/etc/cron.d/athena-auto-upgrade
 
+# We stopped shipping our own cron.d file in 1.21, so remove it
+# dpkg-maintscript-helper exists in maverick+
+if dpkg-maintscript-helper supports rm_conffile 2> /dev/null; then
+    dpkg-maintscript-helper rm_conffile \
+	/etc/cron.d/debathena-auto-update 1.21~ -- "$@"
+else
+    # From http://wiki.debian.org/DpkgConffileHandling
+    rm_conffile() {
+	local PKGNAME="$1" # Unused
+	local CONFFILE="$2"
+	if [ -f "$CONFFILE".dpkg-del ]; then
+            rm -f "$CONFFILE".dpkg-del
+	fi
+    }
+    case "$1" in
+	install|upgrade)
+	    if dpkg --compare-versions "$2" le-nl 1.21~; then
+		rm_conffile debathena-auto-update "/etc/cron.d/debathena-auto-update"
+	    fi
+    esac
+fi
+
 case "$1" in
     configure)
 	# Nuke /var/lib/athena-update-status on 1.18, 
@@ -43,11 +65,6 @@
 	    rm /var/lib/athena-update-status
 	fi
 	
-	# We stopped shipping our own cron.d file in 1.21, so remove it.
-	if dpkg --compare-versions "$2" lt 1.21~; then
-	    rm -f /etc/cron.d/debathena-auto-update
-	fi
-
         if [ ! -f /var/lib/athena-update-status ]; then
 	    echo "$(date +"%s")|$(date +"%s")|ok|Package configured" > /var/lib/athena-update-status
         fi

Modified: trunk/debathena/config/auto-update/debian/debathena-auto-update.postrm
===================================================================
--- trunk/debathena/config/auto-update/debian/debathena-auto-update.postrm	2011-03-01 19:35:35 UTC (rev 24991)
+++ trunk/debathena/config/auto-update/debian/debathena-auto-update.postrm	2011-03-01 20:10:28 UTC (rev 24992)
@@ -18,6 +18,27 @@
 # for details, see http://www.debian.org/doc/debian-policy/ or
 # the debian-policy package
 
+if dpkg-maintscript-helper supports rm_conffile 2> /dev/null; then
+    dpkg-maintscript-helper rm_conffile \
+	/etc/cron.d/debathena-auto-update 1.21~ -- "$@"
+else
+    # From http://wiki.debian.org/DpkgConffileHandling
+    rm_conffile() {
+	local PKGNAME="$1" # Unused
+	local CONFFILE="$2"
+	
+	if [ -f "$CONFFILE".dpkg-del ]; then
+            mv -f "$CONFFILE".dpkg-del "$CONFFILE"
+	fi
+    }
+    # See policy 6.6, item 3 and 5
+    case "$1" in
+	abort-install|abort-upgrade)
+	    if dpkg --compare-versions "$2" le-nl 1.21~; then
+		rm_conffile debathena-auto-update "/etc/cron.d/debathena-auto-update"
+	    fi
+    esac
+fi
 
 case "$1" in
     purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)


home help back first fref pref prev next nref lref last post