[DRE-commits] [SCM] thin.git branch, master, updated. upstream/1.2.11-42-g12e1dcb

Ryan Niebur ryanryan52 at gmail.com
Fri Jan 27 22:13:19 UTC 2012


The following commit has been merged in the master branch:
commit 12e1dcb5bcb27e24d4981dc104eff4d803a8cc56
Author: Ryan Niebur <ryanryan52 at gmail.com>
Date:   Fri Jan 27 14:12:39 2012 -0800

    reimplement with similar logic to dpkg-maintscript-helper, which I beleive will now work correctly in all situations

diff --git a/debian/changelog b/debian/changelog
index b2f46bf..e02126a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,9 +1,5 @@
 thin (1.3.1-1) UNRELEASED; urgency=low
 
-  TODO: copy and tweak logic from dpkg-maintscript-helper,
-        to properly handle when only thin1.8 is installed
-	prior to the upgrade
-
   [ Laurent Arnoud ]
   * New upstream release
   * Switch to gem2deb-based packaging. Binary package renamed to
diff --git a/debian/thin.postinst b/debian/thin.postinst
index b330933..6e00dec 100644
--- a/debian/thin.postinst
+++ b/debian/thin.postinst
@@ -1,11 +1,22 @@
+# -*- mode: Shell-Script -*-
 # complete dpkg-maintscript-helper operations
 
-if [ -h /etc/init.d/thin.dpkg-remove ] || [ -h /etc/init.d/thin.dpkg-backup ]; then
-   dpkg-maintscript-helper rm_conffile /etc/init.d/thin -- "$@"
-fi
+if [ "$1" = "configure" ]; then
+
+    if [ -h /etc/init.d/thin.dpkg-backup ]; then
+	mv -f "/etc/init.d/thin.dpkg-backup" "/etc/init.d/thin.dpkg-bak"
+    fi
+    if [ -h /etc/init.d/thin.dpkg-remove ]; then
+	rm -f /etc/init.d/thin.dpkg-remove
+    fi
+
+    if [ -e /etc/init.d/thin1.8.dpkg-remove ]; then
+	rm -f /etc/init.d/thin1.8.dpkg-remove
+    fi
+    if [ -e /etc/init.d/thin1.8.dpkg-backup ]; then
+	mv -f /etc/init.d/thin1.8.dpkg-backup /etc/init.d/thin1.8.dpkg-bak
+    fi
 
-if [ -e /etc/init.d/thin1.8.dpkg-remove ] || [ -e /etc/init.d/thin1.8.dpkg-backup ]; then
-   dpkg-maintscript-helper rm_conffile /etc/init.d/thin1.8 -- "$@"
 fi
 
 #DEBHELPER#
diff --git a/debian/thin.postrm b/debian/thin.postrm
index b330933..2cc53a6 100644
--- a/debian/thin.postrm
+++ b/debian/thin.postrm
@@ -1,11 +1,25 @@
+# -*- mode: Shell-Script -*-
 # complete dpkg-maintscript-helper operations
 
-if [ -h /etc/init.d/thin.dpkg-remove ] || [ -h /etc/init.d/thin.dpkg-backup ]; then
-   dpkg-maintscript-helper rm_conffile /etc/init.d/thin -- "$@"
+if [ "$1" = "abort-install" -o "$1" = "abort-upgrade" ]; then
+    if [ -h /etc/init.d/thin.dpkg-remove ]; then
+	mv /etc/init.d/thin.dpkg-remove /etc/init.d/thin
+    fi
+    if [ -h /etc/init.d/thin.dpkg-backup ]; then
+	mv /etc/init.d/thin.dpkg-backup /etc/init.d/thin
+    fi
+
+    if [ -e /etc/init.d/thin1.8.dpkg-remove ]; then
+	mv /etc/init.d/thin1.8.dpkg-remove /etc/init.d/thin1.8
+    fi
+    if [ -e /etc/init.d/thin1.8.dpkg-backup ]; then
+	mv /etc/init.d/thin1.8.dpkg-backup /etc/init.d/thin1.8
+    fi
 fi
 
-if [ -e /etc/init.d/thin1.8.dpkg-remove ] || [ -e /etc/init.d/thin1.8.dpkg-backup ]; then
-   dpkg-maintscript-helper rm_conffile /etc/init.d/thin1.8 -- "$@"
+if [ "$1" = "purge" ]; then
+    rm -f /etc/init.d/thin1.8.dpkg-backup /etc/init.d/thin1.8.dpkg-remove /etc/init.d/thin1.8.dpkg-bak
+    rm -f /etc/init.d/thin.dpkg-backup /etc/init.d/thin.dpkg-remove /etc/init.d/thin.dpkg-bak
 fi
 
 #DEBHELPER#
diff --git a/debian/thin.preinst b/debian/thin.preinst
index db811d0..9155871 100644
--- a/debian/thin.preinst
+++ b/debian/thin.preinst
@@ -1,13 +1,27 @@
+# -*- mode: Shell-Script -*-
 # Just check if the old thin init.d conffile symlink needs to be removed
-if [ -h /etc/init.d/thin ] && [ "$(readlink /etc/init.d/thin)" = "thin1.8" ]; then
-  dpkg-maintscript-helper rm_conffile /etc/init.d/thin -- "$@"
-  update-rc.d thin remove
-fi
 
-# thin1.8 provided the same service name, so we must remove it to avoid a failure due to insserv error
-if [ -f /etc/init.d/thin1.8 ]; then
-   dpkg-maintscript-helper rm_conffile /etc/init.d/thin1.8 -- "$@"
-   update-rc.d thin1.8 remove
+if [ "$1" = "install" -o "$1" = "upgrade" ]; then
+    if [ -h /etc/init.d/thin ]; then # do we need to handle  || [ -e /etc/init.d/thin ] ? guess not.
+	if [ "$(readlink /etc/init.d/thin)" = "thin1.8" ]; then
+	    mv -f /etc/init.d/thin /etc/init.d/thin.dpkg-remove
+	else
+	    mv -f /etc/init.d/thin /etc/init.d/thin.dpkg-backup
+	fi
+	update-rc.d thin remove
+    fi
+
+    # thin1.8 provided the same service name, so we must remove it to avoid a failure due to insserv error
+    if [ -f /etc/init.d/thin1.8 ]; then
+	md5sum="$(md5sum /etc/init.d/thin1.8 | sed -e 's/ .*//')"
+	old_md5sum="$(dpkg-query -W -f='${Conffiles}' thin1.8 | sed -n -e "\' /etc/init.d/thin1.8 ' { s/ obsolete$//; s/.* //; p }")"
+	if [ "$md5sum" = "$old_md5sum" ]; then
+	    mv -f /etc/init.d/thin1.8 /etc/init.d/thin1.8.dpkg-remove
+	else
+	    mv -f /etc/init.d/thin1.8 /etc/init.d/thin1.8.dpkg-backup
+	fi
+	update-rc.d thin1.8 remove
+    fi
 fi
 
 #DEBHELPER#

-- 
thin.git



More information about the Pkg-ruby-extras-commits mailing list