[Pkg-sysvinit-commits] r1784 - in sysvinit/trunk/debian: . src/sysv-rc/sbin

Petter Reinholdtsen pere at alioth.debian.org
Sun Sep 20 17:27:48 UTC 2009


Author: pere
Date: 2009-09-20 17:27:48 +0000 (Sun, 20 Sep 2009)
New Revision: 1784

Modified:
   sysvinit/trunk/debian/changelog
   sysvinit/trunk/debian/src/sysv-rc/sbin/update-rc.d
Log:
Report error from update-rc.d when insserv reject a script, to
make it more clear what program call failed in a postinst.

Modified: sysvinit/trunk/debian/changelog
===================================================================
--- sysvinit/trunk/debian/changelog	2009-09-20 17:16:30 UTC (rev 1783)
+++ sysvinit/trunk/debian/changelog	2009-09-20 17:27:48 UTC (rev 1784)
@@ -7,6 +7,8 @@
     to start earlier when concurrent booting is enabled.
   * Quiet down sysv-rc postinst to not give error when no file exist
     in /var/lib/update-rc.d.  Discovered from piuparts.
+  * Report error from update-rc.d when insserv reject a script, to
+    make it more clear what program call failed in a postinst.
 
  -- Petter Reinholdtsen <pere at debian.org>  Fri, 18 Sep 2009 22:12:48 +0200
 

Modified: sysvinit/trunk/debian/src/sysv-rc/sbin/update-rc.d
===================================================================
--- sysvinit/trunk/debian/src/sysv-rc/sbin/update-rc.d	2009-09-20 17:16:30 UTC (rev 1783)
+++ sysvinit/trunk/debian/src/sysv-rc/sbin/update-rc.d	2009-09-20 17:27:48 UTC (rev 1784)
@@ -56,7 +56,7 @@
 
     return if $notreally;
 
-    open(FILE, ">", "$archive/${script}.new") || die;
+    open(FILE, ">", "$archive/${script}.new") || die "unable to write to $archive/${script}.new";
     print FILE join(" ","update-rc.d", at arguments), "\n";
     close(FILE);
     rename "$archive/${script}.new", "$archive/${script}";
@@ -116,6 +116,12 @@
     exit (1);
 }
 
+sub error_code {
+    my $rc = shift;
+    print STDERR "update-rc.d: error: @_\n";
+    exit ($rc);
+}
+
 # Check if there are links in /etc/rc[0-9S].d/ 
 # Remove if the first argument is "remove" and the links 
 # point to $bn.
@@ -388,6 +394,7 @@
             if (0 == $rc && !$notreally) {
                 remove_last_action($scriptname);
             }
+            error_code($rc, "insserv rejected the script header") if $rc;
             exit $rc;
         } else {
             # insserv removes all dangling symlinks, no need to tell it
@@ -396,6 +403,7 @@
             if (0 == $rc && !$notreally) {
                 remove_last_action($scriptname);
             }
+            error_code($rc, "insserv rejected the script header") if $rc;
             exit $rc;
         }
     } elsif ("defaults" eq $action || "start" eq $action ||
@@ -410,6 +418,7 @@
             if (0 == $rc && !$notreally) {
                 save_last_action($scriptname, @orig_argv);
             }
+            error_code($rc, "insserv rejected the script header") if $rc;
             exit $rc;
         } else {
             error("initscript does not exist: /etc/init.d/$scriptname");
@@ -421,6 +430,7 @@
         if (0 == $rc && !$notreally) {
             save_last_action($scriptname, @orig_argv);
         }
+        error_code($rc, "insserv rejected the script header") if $rc;
         exit $rc;
     } else {
         usage();


Property changes on: sysvinit/trunk/debian/src/sysv-rc/sbin/update-rc.d
___________________________________________________________________
Added: svn:executable
   + *




More information about the Pkg-sysvinit-commits mailing list