[Initscripts-ng-commits] r657 - in /trunk/src/insserv/debian: changelog update-bootsystem-insserv

pere at users.alioth.debian.org pere at users.alioth.debian.org
Wed Feb 27 13:45:24 UTC 2008


Author: pere
Date: Wed Feb 27 13:45:24 2008
New Revision: 657

URL: http://svn.debian.org/wsvn/initscripts-ng/?sc=1&rev=657
Log:
  * Restructure update-bootsystem-insserv slightly to make it possible
    to check if it is safe to convert to dependency based boot
    sequencing without doing the conversion.

Modified:
    trunk/src/insserv/debian/changelog
    trunk/src/insserv/debian/update-bootsystem-insserv

Modified: trunk/src/insserv/debian/changelog
URL: http://svn.debian.org/wsvn/initscripts-ng/trunk/src/insserv/debian/changelog?rev=657&op=diff
==============================================================================
--- trunk/src/insserv/debian/changelog (original)
+++ trunk/src/insserv/debian/changelog Wed Feb 27 13:45:24 2008
@@ -5,6 +5,9 @@
     generated files /etc/init.d/.depend.* when disabled or removed.
   * Implemented better support in check-initd-orderfor graphing $all
     relations.
+  * Restructure update-bootsystem-insserv slightly to make it possible
+    to check if it is safe to convert to dependency based boot
+    sequencing without doing the conversion.
   * Debconf translations:
     - Added Spanish from Steve Lord Flaubert (Closes: #467391).
     - Added German from Erik Schanze (Closes: #467483).

Modified: trunk/src/insserv/debian/update-bootsystem-insserv
URL: http://svn.debian.org/wsvn/initscripts-ng/trunk/src/insserv/debian/update-bootsystem-insserv?rev=657&op=diff
==============================================================================
--- trunk/src/insserv/debian/update-bootsystem-insserv (original)
+++ trunk/src/insserv/debian/update-bootsystem-insserv Wed Feb 27 13:45:24 2008
@@ -143,11 +143,10 @@
     rm -f /etc/init.d/.depend.stop
 }
 
-activate_insserv() {
+is_unsafe_to_activate() {
     # Refuse to convert when there are obsolete init.d scripts left
     # behind, as these tend to confuse the boot sequence.
     echo "info: Checking if it is safe to convert to dependency based boot."
-    badstate=""
     for package in $(dpkg -S $(find /etc/init.d -type f -perm /+x) \
                      2>/dev/null | cut -d: -f1 | sort -u); do
         obsolete_initscripts=$(dpkg-query -W -f='${Conffiles}\n' $package | \
@@ -156,7 +155,7 @@
             for initscript in $obsolete_initscripts; do
                 if [ -e "$initscript" ]; then
                     echo "error: Obsolete conffile $initscript left behind by package $package"
-                    badstate=1
+                    return 0
                 fi
             done
         fi
@@ -167,17 +166,20 @@
 	echo "error: Problems running insserv:"
 	egrep 'There is a loop between|loop involving service|already provided!|provides system facility' $logfile | sed 's/^/  /'
 	rm $logfile
-	badstate=1
-    fi
-
-    if [ 1 = "$badstate" ] ; then
+	return 0
+    fi
+    return 1
+}
+
+activate_insserv() {
+    if is_unsafe_to_activate ; then
 	cat <<EOF
 info: Please check out this manually.
 info: Refusing to convert boot sequence until this is fixed
 info: See http://wiki.debian.org/LSBInitScripts/DependencyBasedBoot
 info: for more information on how to solve these issues.  Most likely,
-info: it is a bug in the binary package with the init.d script, and
-info: not with insserv.
+info: it is a bug in the binary package with the init.d script in
+info: question, and not with insserv.
 EOF
 	exit 1
     fi
@@ -205,10 +207,26 @@
 	/usr/sbin/update-rc.d-insserv
 }
 
-if [ restore = "$1" ] ; then
-    deactivate_inserv
-else
-    activate_insserv
-fi
+case "$1" in
+    enable|'')
+	activate_insserv
+	;;
+    disable|restore)
+	deactivate_inserv
+	;;
+    check)
+	if is_unsafe_to_activate ; then
+	    echo "warning: It is not safe to convert to dependency based boot."
+	    exit 1
+	else
+	    echo "info: It is safe to convert to dependency based boot."
+	    exit 0
+	fi
+	;;
+    *)
+	echo "error: Unknown argument '$1'"
+	exit 1
+	;;
+esac
 
 exit 0




More information about the Initscripts-ng-commits mailing list