tags 840073 patch
thanks

Hi,

looking at the problem and setting up piuparts, and using a local repository, I
think the problem with upgrade from jessie to stretch/sid is solved with the
attached patch.

The following has been tested:
 * upgrade from stretch (0.21-3) to sid (0.21-4)
 * upgrade from jessie (0.13.1-4) to sid (0.21-4)
 * upgrade from kessie (0.13.1-4) to stretch/testing (0.21-4)
piuparts logs are available on request.

I have not been able to upgrade from jessie (without openrc) to stretch/sid
(0.21-4). Anybody knows ho to do that (if needed)?

The only line in the patch that I'm unsure of is the removal of:
[ ${svc} = reboot ] && continue
in openrc.postinst.

I need somebody doing an upload of the new package, of course modifying the
changelog accordingly: Adam/Benda?


Thanks!
diff -uNr openrc-0.21-3/debian/changelog openrc-0.21/debian/changelog
--- openrc-0.21-3/debian/changelog	2016-09-24 02:11:37.000000000 +0200
+++ openrc-0.21/debian/changelog	2016-11-08 09:32:48.740226951 +0100
@@ -1,3 +1,12 @@
+openrc (0.21-4) unstable; urgency=medium
+
+  [ Svante Signell ]
+  * Fix upgrade from jessie to stretch by adding openrc.preinst
+    and modifying openrc.postinst for conffile transit (Closes #840073)
+  * Revert fix for #834014
+
+ -- Adam Borowski <[email protected]>  Tue, 08 Nov 2016 09:20:37 +0100
+
 openrc (0.21-3) unstable; urgency=medium
 
   [ Marvin Kohl ]
diff -uNr openrc-0.21-3/debian/openrc.install.in openrc-0.21/debian/openrc.install.in
--- openrc-0.21-3/debian/openrc.install.in	2016-09-24 01:25:57.000000000 +0200
+++ openrc-0.21/debian/openrc.install.in	2016-11-08 18:06:02.939872210 +0100
@@ -4,6 +4,5 @@
 debian/tmp/etc                /
 debian/tmp/usr/share/man/man8 /usr/share/man
 
-debian/transit		/etc/init.d
 debian/rc		/etc/init.d
 debian/rcS		/etc/init.d
diff -uNr openrc-0.21-3/debian/openrc.postinst openrc-0.21/debian/openrc.postinst
--- openrc-0.21-3/debian/openrc.postinst	2016-09-24 01:25:57.000000000 +0200
+++ openrc-0.21/debian/openrc.postinst	2016-11-08 17:58:45.151877253 +0100
@@ -46,10 +46,6 @@
 		if [ -f ${initsh} ]; then
 			# no need to duplicate services in the off runlevel
 			egrep -q '# Default-Start:\s+[S12345]' ${initsh} && continue
-
-			# reboot is managed by transit as below
-			[ ${svc} = reboot ] && continue
-
 			rc-update add ${svc} off
 		else
 			echo "*** WARNING: dangling link $rclink"
@@ -58,7 +54,6 @@
 	done
 
 	rc-update add savecache off
-	rc-update add transit shutdown
 	rc-update -u
 
 	if [ "$dsvcs" != "" ]; then
diff -uNr openrc-0.21-3/debian/openrc.preinst openrc-0.21/debian/openrc.preinst
--- openrc-0.21-3/debian/openrc.preinst	1970-01-01 01:00:00.000000000 +0100
+++ openrc-0.21/debian/openrc.preinst	2016-11-08 18:24:06.579859726 +0100
@@ -0,0 +1,27 @@
+# Remove a no-longer used conffile
+rm_conffile() {
+    local PKGNAME="$1"
+    local CONFFILE="$2"
+
+    [ -e "$CONFFILE" ] || return 0
+
+    local md5sum="$(md5sum $CONFFILE | sed -e 's/ .*//')"
+    local old_md5sum="$(dpkg-query -W -f='${Conffiles}' $PKGNAME | \
+            sed -n -e "\' $CONFFILE ' { s/ obsolete$//; s/.* //; p }")"
+    if [ "$md5sum" != "$old_md5sum" ]; then
+        echo "Obsolete conffile $CONFFILE has been modified by you."
+        echo "Saving as $CONFFILE.dpkg-bak ..."
+        mv -f "$CONFFILE" "$CONFFILE".dpkg-bak
+    else
+        echo "Removing obsolete conffile $CONFFILE ..."
+        rm -f "$CONFFILE"
+    fi
+}
+
+case "$1" in
+install|upgrade)
+    if dpkg --compare-versions "$2" le "$LASTVERSION"; then
+        rm_conffile openrc "/etc/pkg/conf.1"
+        rm_conffile openrc "/etc/pkg/conf.2"
+    fi
+esac
diff -uNr openrc-0.21-3/debian/rules openrc-0.21/debian/rules
--- openrc-0.21-3/debian/rules	2016-09-24 01:39:09.000000000 +0200
+++ openrc-0.21/debian/rules	2016-11-08 09:26:27.716231340 +0100
@@ -67,7 +67,7 @@
 	done
 
 	# We don't want the Gentoo init scripts, but only want savecache to stay
-	find $(CURDIR)/debian/openrc/etc/init.d/* -name savecache -or -name rc -or -name rcS -or -name transit -prune -o -exec rm -f {} +
+	find $(CURDIR)/debian/openrc/etc/init.d/* -name savecache -or -name rc -or -name rcS -prune -o -exec rm -f {} +
 
 	for dir in boot default sysinit shutdown; do \
 		rm -f $(CURDIR)/debian/openrc/etc/runlevels/$${dir}/* ; \
diff -uNr openrc-0.21-3/debian/transit openrc-0.21/debian/transit
--- openrc-0.21-3/debian/transit	2016-09-24 01:25:57.000000000 +0200
+++ openrc-0.21/debian/transit	1970-01-01 01:00:00.000000000 +0100
@@ -1,19 +0,0 @@
-#!/sbin/openrc-run
-
-description="Call halt through OpenRC style."
-
-depend() {
-	keyword -prefix
-	after *
-}
-
-start()
-{
-	if [ "$RC_REBOOT" = "YES" ]; then
-		ebegin "reboot runlevel..."
-		exec /etc/init.d/reboot stop
-	else
-		ebegin "shutdown runlevel..."
-		exec /etc/init.d/halt stop
-	fi
-}

Reply via email to