Author: pere
Date: Sat Sep 26 20:34:33 2009
New Revision: 1022

URL: http://svn.debian.org/wsvn/initscripts-ng/?sc=1&rev=1022
Log:
Implement -u option to allow /lib/init/upstart-job to be replaced.

Modified:
    trunk/src/insserv/debian/patches/62_upstart_job.patch

Modified: trunk/src/insserv/debian/patches/62_upstart_job.patch
URL: 
http://svn.debian.org/wsvn/initscripts-ng/trunk/src/insserv/debian/patches/62_upstart_job.patch?rev=1022&op=diff
==============================================================================
--- trunk/src/insserv/debian/patches/62_upstart_job.patch (original)
+++ trunk/src/insserv/debian/patches/62_upstart_job.patch Sat Sep 26 20:34:33 
2009
@@ -5,9 +5,20 @@
 
 Index: insserv/insserv.8.in
 ===================================================================
---- insserv.orig/insserv.8.in  2009-09-26 12:25:41.000000000 +0200
-+++ insserv/insserv.8.in       2009-09-26 12:25:44.000000000 +0200
-@@ -339,6 +339,12 @@
+--- insserv.orig/insserv.8.in  2009-09-26 22:29:42.000000000 +0200
++++ insserv/insserv.8.in       2009-09-26 22:32:50.000000000 +0200
+@@ -266,6 +266,10 @@
+ .BR \-f ,\  \-\-force
+ Ignore if a required service is missed.
+ .TP
++.BR \-u\ <path> ,\  \-\-upstart-job\ <path>
++Path to replace existing upstart job path.  (default path is
++.IR /lib/init/upstart-job ).
++.TP
+ .BR \-h ,\  \-\-help
+ Print out short usage message.
+ .PP
+@@ -339,6 +343,12 @@
  name as the boot or init script in the directory
  .IR /etc/insserv/overrides/ .
  .\"
@@ -22,9 +33,18 @@
  .RS 7
 Index: insserv/insserv.c
 ===================================================================
---- insserv.orig/insserv.c     2009-09-26 12:25:41.000000000 +0200
-+++ insserv/insserv.c  2009-09-26 12:25:45.000000000 +0200
-@@ -1154,6 +1154,43 @@
+--- insserv.orig/insserv.c     2009-09-26 22:29:42.000000000 +0200
++++ insserv/insserv.c  2009-09-26 22:33:18.000000000 +0200
+@@ -70,6 +70,8 @@
+ # define INSCONF      "/etc/insserv.conf"
+ #endif
+ 
++const char *upstartjob_path = "/lib/init/upstart-job";
++
+ /*
+  * For a description of regular expressions see regex(7).
+  */
+@@ -1154,6 +1156,43 @@
      xreset(script_inf.interactive);
  }
  
@@ -40,7 +60,7 @@
 +        int len = readlink(path, buf, sizeof(buf)-1);
 +      if (0 < len) {
 +          buf[len] = '\0';
-+          if (0 == strcmp(buf, "/lib/init/upstart-job")) {
++          if (0 == strcmp(buf, upstartjob_path)) {
 +            /* upstart job, return base name of original symlink */
 +            return strdup(basenamestr);
 +          } else
@@ -68,7 +88,7 @@
  #define FOUND_LSB_HEADER   0x01
  #define FOUND_LSB_DEFAULT  0x02
  #define FOUND_LSB_OVERRIDE 0x04
-@@ -1170,7 +1207,8 @@
+@@ -1170,7 +1209,8 @@
      char *pbuf = buf;
      FILE *script;
      uchar ret = 0;
@@ -78,7 +98,7 @@
  
  #define provides      script_inf.provides
  #define required_start        script_inf.required_start
-@@ -1186,12 +1224,23 @@
+@@ -1186,12 +1226,23 @@
  
      info("Loading %s\n", path);
  
@@ -88,7 +108,7 @@
 +        char cmd[2048];
 +      int len;
 +      len = snprintf(cmd, sizeof(cmd),
-+                     "/lib/init/upstart-job %s lsb-header", upstart_job);
++                     "%s %s lsb-header", upstartjob_path, upstart_job);
 +      if (len < 0 || sizeof(cmd) == len)
 +          error("snprintf: insufficient buffer for %s\n", path);
 +      if ((FILE*)0 == (script = popen(cmd, "r")))
@@ -105,7 +125,7 @@
  
  #define COMMON_ARGS   buf, SUBNUM, subloc, 0
  #define COMMON_SHD_ARGS       buf, SUBNUM_SHD, subloc, 0
-@@ -1303,7 +1352,12 @@
+@@ -1303,7 +1354,12 @@
        (void)posix_fadvise(fd, 0, 0, POSIX_FADV_NOREUSE);
  #endif
  
@@ -119,3 +139,32 @@
  
      if (begin && end)
        ret |= FOUND_LSB_HEADER;
+@@ -2224,6 +2280,7 @@
+     {"force", 0, (int*)0, 'f'},
+     {"path",  1, (int*)0, 'p'},
+     {"override",1, (int*)0, 'o'},
++    {"upstart-job",1, (int*)0, 'u'},
+     {"help",  0, (int*)0, 'h'},
+     { 0,      0, (int*)0,  0 },
+ };
+@@ -2277,7 +2334,7 @@
+     for (c = 0; c < argc; c++)
+       argr[c] = (char*)0;
+ 
+-    while ((c = getopt_long(argc, argv, "c:dfrhvno:p:", long_options, (int 
*)0)) != -1) {
++    while ((c = getopt_long(argc, argv, "c:dfrhvno:p:u:", long_options, (int 
*)0)) != -1) {
+       size_t l;
+       switch (c) {
+           case 'c':
+@@ -2317,6 +2374,11 @@
+               override_path = optarg;
+               set_override = true;
+               break;
++          case 'u':
++              if (optarg == (char*)0 || *optarg == '\0')
++                  goto err;
++              upstartjob_path = optarg;
++              break;
+           case '?':
+           err:
+               error("For help use: %s -h\n", myname);


_______________________________________________
Initscripts-ng-commits mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/initscripts-ng-commits

Reply via email to