[Initscripts-ng-commits] r934 - in /trunk/src/insserv/debian: changelog insserv.config

pere at users.alioth.debian.org pere at users.alioth.debian.org
Sun Jul 26 12:51:47 UTC 2009


Author: pere
Date: Sun Jul 26 12:51:46 2009
New Revision: 934

URL: http://svn.debian.org/wsvn/initscripts-ng/?sc=1&rev=934
Log:
Change how we check if it is safe to convert to dependency based boot sequencing, to use the same method as update-bootsystem-insserv.

Modified:
    trunk/src/insserv/debian/changelog
    trunk/src/insserv/debian/insserv.config

Modified: trunk/src/insserv/debian/changelog
URL: http://svn.debian.org/wsvn/initscripts-ng/trunk/src/insserv/debian/changelog?rev=934&op=diff
==============================================================================
--- trunk/src/insserv/debian/changelog (original)
+++ trunk/src/insserv/debian/changelog Sun Jul 26 12:51:46 2009
@@ -3,8 +3,8 @@
   * Change check-initd-order to return a exit code when there is a problem
     with the boot sequence or dependencies.
   * Change the default to enable dependency based boot sequencing if
-    check-initd-order report that it is safe to do.  This should enable
-    it in the common case, while avoiding conversion on problems.
+    it is safe to do.  This should enable it in the common case,
+    while avoiding conversion on problems.
 
  -- Petter Reinholdtsen <pere at debian.org>  Sun, 26 Jul 2009 13:40:00 +0200
 

Modified: trunk/src/insserv/debian/insserv.config
URL: http://svn.debian.org/wsvn/initscripts-ng/trunk/src/insserv/debian/insserv.config?rev=934&op=diff
==============================================================================
--- trunk/src/insserv/debian/insserv.config (original)
+++ trunk/src/insserv/debian/insserv.config Sun Jul 26 12:51:46 2009
@@ -21,6 +21,37 @@
     esac
 }
 
+
+# Function is_unsafe_to_activate is copied from update-bootsystem-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."
+    retval=1
+    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 | \
+            grep 'obsolete$' | grep -o '/etc/init.d/[^ ]\+') || :
+        if [ "$obsolete_initscripts" ]; then
+            for initscript in $obsolete_initscripts; do
+                if [ -e "$initscript" ]; then
+                    echo "error: Obsolete conffile $initscript left behind by package $package"
+                    retval=0
+                fi
+            done
+        fi
+    done
+
+    insserv -nv > $logfile 2>&1 || true
+    if egrep -q 'There is a loop between|already provided!|provides system facility' $logfile ; then
+        echo "error: Problems running insserv:"
+        egrep 'There is a loop between|loop involving service|already provided!|provides system facility' $l
+ogfile | sed 's/^/  /'
+        rm $logfile
+        retval=0
+    fi
+    return $retval
+}
 
 if [ "$1" = configure ] && [ -z "$2" ]; then
     set +e
@@ -60,7 +91,7 @@
     if check_divert status /usr/sbin/update-rc.d \
 	/usr/sbin/update-rc.d-insserv ; then
 	db_set insserv/enable true
-    elif /usr/share/insserv/check-initd-order ; then
+    elif ! is_unsafe_to_activate ; then
 	# No problems with the current boot scripts, should be safe to enable
 	db_set insserv/enable true
     else




More information about the Initscripts-ng-commits mailing list