[Pkg-sysvinit-commits] r1615 - in sysvinit/trunk/debian: . sysv-rc/man8 sysv-rc/sbin

Petter Reinholdtsen pere at alioth.debian.org
Wed Aug 19 20:43:17 UTC 2009


Author: pere
Date: 2009-08-19 20:43:16 +0000 (Wed, 19 Aug 2009)
New Revision: 1615

Added:
   sysvinit/trunk/debian/sysv-rc.preinst
Modified:
   sysvinit/trunk/debian/changelog
   sysvinit/trunk/debian/rules
   sysvinit/trunk/debian/sysv-rc.postinst
   sysvinit/trunk/debian/sysv-rc.templates
   sysvinit/trunk/debian/sysv-rc/man8/update-rc.d.8
   sysvinit/trunk/debian/sysv-rc/sbin/update-rc.d
Log:
Rewrite update-rc.d to use dependency based boot sequencing by default
and legacy mode when /var/lib/sysv-rc/legacy-bootsequence exist, and the
migration code to create this file during upgrades on systems still
using legacy mode.


Modified: sysvinit/trunk/debian/changelog
===================================================================
--- sysvinit/trunk/debian/changelog	2009-08-19 08:30:23 UTC (rev 1614)
+++ sysvinit/trunk/debian/changelog	2009-08-19 20:43:16 UTC (rev 1615)
@@ -16,16 +16,16 @@
     rcS.d/, no longer valid with dependency based boot sequencing.
   * Make sysv-rc depend on initscripts (>= 2.86.ds1-63) to make sure we
     get scripts working with makefile style concurrent booting.
-  * Migrate the code to enable dependency based boot sequencing from
-    the insserv package to sysv-rc.  Depend on insserv (>> 1.12.0-10)
-    for this.  Migration to dependency based boot sequencing is now a
-    one-way process, enabled when it is safe to do so, with a debconf
-    question asked during upgrades.  Checks
-    previously done by update-bootsystem-insserv are now only done
-    once in sysv-rc postinst (Closes: #538934).  The change make it
-    possible to remove both sysv-rc and insserv (Closes: #538959) if
-    other packages want to take over the boot sequencing
-    resposibility.
+  * Dependency based boot sequencing is now the defailt.  Move the
+    code to migrate to dependency based boot sequencing during
+    upgrades from the insserv package to the sysv-rc package.  Depend
+    on insserv (>> 1.12.0-10) for this.  Migration is now a one-way
+    process, enabled after a debconf question during upgrades when it
+    is safe to do so.  Checks previously done by
+    update-bootsystem-insserv are now only done once in sysv-rc
+    postinst (Closes: #538934).  The change make it possible to remove
+    both sysv-rc and insserv (Closes: #538959) if other packages want
+    to take over the boot sequencing resposibility.
 
   [ Kel Modderman ]
   * Migrate from dpatch to quilt for patch management:

Modified: sysvinit/trunk/debian/rules
===================================================================
--- sysvinit/trunk/debian/rules	2009-08-19 08:30:23 UTC (rev 1614)
+++ sysvinit/trunk/debian/rules	2009-08-19 20:43:16 UTC (rev 1615)
@@ -286,6 +286,7 @@
 	install -d -o root -g root -m 755 $(tmp)/usr/share
 	install -d -o root -g root -m 755 $(tmp)$(doc)/sysv-rc
 	install -d -o root -g root -m 755 $(tmp)/var/lib/insserv
+	install -d -o root -g root -m 755 $(tmp)/var/lib/sysv-rc
 	install -o root -g root -m 644 debian/sysv-rc/doc/* $(tmp)$(doc)/sysv-rc
 	sed -ne '/sysvinit (2.84-3)/q' -e p < debian/changelog \
 		> $(tmp)$(doc)/sysv-rc/changelog.Debian
@@ -325,12 +326,12 @@
 		$(tmp)/usr/share/lintian/overrides/sysv-rc
 	install -o root -g root -m 644 debian/sysv-rc.copyright \
 	  $(tmp)$(doc)/sysv-rc/copyright
-	install -o root -g root -m 755 debian/sysv-rc.postinst $(tmp)/DEBIAN/postinst
-	install -o root -g root -m 755 debian/sysv-rc.postrm $(tmp)/DEBIAN/postrm
+	for f in preinst postinst postrm templates ; do \
+		install -o root -g root -m 755 debian/sysv-rc.$$f $(tmp)/DEBIAN/$$f ; \
+	done
 	install -o root -g root -m 755 debian/sysv-rc/saveconfig \
 		$(tmp)/usr/share/doc/sysv-rc/saveconfig
 	dpkg-gencontrol -psysv-rc -P$(tmp) -isp
-	dh_installdebconf -Ninitscripts -Nsysv-rc
 	dh_md5sums -Ninitscripts -Nsysv-rc
 	dpkg --build $(tmp) ..
 	rm -rf $(tmp)

Modified: sysvinit/trunk/debian/sysv-rc/man8/update-rc.d.8
===================================================================
--- sysvinit/trunk/debian/sysv-rc/man8/update-rc.d.8	2009-08-19 08:30:23 UTC (rev 1614)
+++ sysvinit/trunk/debian/sysv-rc/man8/update-rc.d.8	2009-08-19 20:43:16 UTC (rev 1615)
@@ -66,10 +66,13 @@
 are no loops in the dependencies declared by LSB headers of all
 installed init.d scripts and no obsolete init.d scripts,
 the boot system is converted to dependency based boot sequencing.
-The conversion to dependency based boot sequencing is one\-way.
+The conversion to dependency based boot sequencing is one\-way.  The
+machines using the legacy mode will have a file
+/var/lib/sysv-rc/legacy-bootsequence.
 
-Packages installing init.d scripts should make sure both methods
-work.
+Packages installing init.d scripts should make sure both methods work,
+for compatiblity with systems where the migration have not been done
+yet.
 
 For legacy mode, the following section documents the old behaviour.
 
@@ -310,6 +313,10 @@
 Model for use by writers of
 .B init.d
 scripts.
+.TP
+.B /var/lib/sysv-rc/legacy-bootsequence
+Flag indicating the machine is using legacy mode for boot script
+ordering.
 .SH "SEE ALSO"
 .I R "Debian Policy Manual" ,
 .br 

Modified: sysvinit/trunk/debian/sysv-rc/sbin/update-rc.d
===================================================================
--- sysvinit/trunk/debian/sysv-rc/sbin/update-rc.d	2009-08-19 08:30:23 UTC (rev 1614)
+++ sysvinit/trunk/debian/sysv-rc/sbin/update-rc.d	2009-08-19 20:43:16 UTC (rev 1615)
@@ -31,7 +31,7 @@
 # probably be considered obsolete and dropped in Squeeze+1 or +2, and
 # the default behaviour be changed to assume the flag exist on all
 # systems.
-if ( -f "/var/lib/insserv/using-insserv" ) {
+if ( ! -f "/var/lib/sysv-rc/legacy-bootsequence" ) {
     info("using dependency based boot sequencing");
     exit insserv_updatercd(@ARGV);
 }

Modified: sysvinit/trunk/debian/sysv-rc.postinst
===================================================================
--- sysvinit/trunk/debian/sysv-rc.postinst	2009-08-19 08:30:23 UTC (rev 1614)
+++ sysvinit/trunk/debian/sysv-rc.postinst	2009-08-19 20:43:16 UTC (rev 1615)
@@ -10,7 +10,7 @@
 backupfile="$logdir/bootscripts-$now.tar.gz"
 listfile="$logdir/bootscripts-$now-after.list"
 logfile="$logdir/run-$now.log"
-flagfile="$logdir/using-insserv"
+flagfile=/var/lib/sysv-rc/legacy-bootsequence
 
 # Make sure insserv is in path
 PATH=/sbin:$PATH
@@ -27,6 +27,12 @@
 	    dpkg-divert --package $package --remove $2
 	fi
 	;;
+    status) # Return true if the divert is in effect
+        if [ -n "$div" ] && [ -z "${div%%*by $package}" ]; then
+            :
+	else
+	    false
+	fi
     esac
 }
 
@@ -86,14 +92,13 @@
     echo "info: Recording new boot sequence in $listfile"
     ls /etc/init.d /etc/rc*.d > $listfile
 
-    echo "info: Use '$0 restore' to restore the old boot sequence."
-    touch $flagfile
+    # Indicate that system is no longer using the legacy ordering
+    rm $flagfile
 
     return 0
 }
 
 try_to_convert() {
-    lastver=$1
     if is_unsafe_to_activate ; then
 	cat <<EOF
 error: Unable to enable dependency based boot system.
@@ -110,18 +115,14 @@
 	# dependency based, making 'yes' the default.
 	db_set sysv-rc/convert-legacy true
 
-	# Priority is high during upgrades but medium during first
-	# time installation and reconfiguration, to give those with
+	# Priority is high during upgrades, to give those with
 	# existing installations higher chance of seeing and rejecting
 	# the migration.
-	if [ -z "$lastver" ] ; then
-	    pri=medium
-	else
-	    pri=high
-	fi
-	db_input $pri sysv-rc/convert-legacy || [ $? -eq 30 ]
+	db_input high sysv-rc/convert-legacy || [ $? -eq 30 ]
+
 	db_go || true
 	db_get sysv-rc/convert-legacy || true
+
 	if [ true = "$RET" ] ; then
 	    if activate_insserv ; then
 		echo "success: Enabled dependency based boot system."
@@ -134,17 +135,25 @@
     fi
 }
 
-# Remove divert if it exist.  It was dropped in insserv 1.12.0-11 and
-# sysvinit 2.87dsf-3, 2009-07-29.
-check_divert false /usr/sbin/update-rc.d /usr/sbin/update-rc.d-insserv
-
 case "$1" in
     configure)
-	if [ -f /var/lib/insserv/using-insserv ] ; then
-	    : # Already enabled, do not need to do anything
-	else
-	    try_to_convert "$2"
+        # Remove insserv created divert during upgrades if it exist.
+        # It was dropped in insserv 1.12.0-11 converted since sysvinit
+        # 2.87dsf-3, 2009-08-19.
+        if [ ! -f /var/run/sysv-rc.upgrade ]; then
+	    if check_divert status /usr/sbin/update-rc.d \
+		/usr/sbin/update-rc.d-insserv ; then
+		check_divert false /usr/sbin/update-rc.d \
+		    /usr/sbin/update-rc.d-insserv
+		rm /var/lib/insserv/using-insserv
+	    else
+		touch $flagfile
+	    fi
 	fi
+	if [ -f $flagfile ] ; then
+	    # Still using legacy ordering, try to convert
+	    try_to_convert
+	fi
 	;;
     *)
 	;;

Added: sysvinit/trunk/debian/sysv-rc.preinst
===================================================================
--- sysvinit/trunk/debian/sysv-rc.preinst	                        (rev 0)
+++ sysvinit/trunk/debian/sysv-rc.preinst	2009-08-19 20:43:16 UTC (rev 1615)
@@ -0,0 +1,28 @@
+#! /bin/sh
+# preinst script for sysv-rc
+
+set -e
+
+# summary of how this script can be called:
+#        * <new-preinst> `install'
+#        * <new-preinst> `install' <old-version>
+#        * <new-preinst> `upgrade' <old-version>
+#        * <old-preinst> `abort-upgrade' <new-version>
+
+case "$1" in
+    upgrade)
+        echo "$2" > /var/run/sysv-rc.upgrade
+    	;;
+    install)
+    	;;
+
+    abort-upgrade)
+    	;;
+
+    *)
+        echo "preinst called with unknown argument \`$1'" >&2
+        exit 0
+    ;;
+esac
+
+exit 0

Modified: sysvinit/trunk/debian/sysv-rc.templates
===================================================================
--- sysvinit/trunk/debian/sysv-rc.templates	2009-08-19 08:30:23 UTC (rev 1614)
+++ sysvinit/trunk/debian/sysv-rc.templates	2009-08-19 20:43:16 UTC (rev 1615)
@@ -9,6 +9,7 @@
 
 Template: sysv-rc/convert-legacy
 Type: boolean
+Default: true
 _Description: Migrate legacy boot sequence to dependency based sequencing?
  This is a one way migration, where the old way of specifying boot
  sequence numbers for init.d scripts is made obsolete, and the




More information about the Pkg-sysvinit-commits mailing list