Author: pere
Date: Thu Jun 25 16:14:36 2009
New Revision: 895

URL: http://svn.debian.org/wsvn/initscripts-ng/?sc=1&rev=895
Log:
Add new patch introducing a new keyword 'X-Interactive: true' in
the LSB header (Closes: #458224).  Add test suite to verify that
it is working.

Added:
    trunk/src/insserv/debian/patches/61_interactive_keyword.patch
Modified:
    trunk/src/insserv/debian/changelog
    trunk/src/insserv/debian/patches/series
    trunk/src/insserv/debian/run-testsuite

Modified: trunk/src/insserv/debian/changelog
URL: 
http://svn.debian.org/wsvn/initscripts-ng/trunk/src/insserv/debian/changelog?rev=895&op=diff
==============================================================================
--- trunk/src/insserv/debian/changelog (original)
+++ trunk/src/insserv/debian/changelog Thu Jun 25 16:14:36 2009
@@ -4,6 +4,9 @@
     scripts while we wait for a proper fix for bug #458224.
   * Fix typo in testsuite function initdir_purge(), making sure the
     rc?.d directories are removed during purge.
+  * Add new patch introducing a new keyword 'X-Interactive: true' in
+    the LSB header (Closes: #458224).  Add test suite to verify that
+    it is working.
 
  -- Petter Reinholdtsen <[email protected]>  Tue, 24 Jun 2009 08:19:19 +0200
 

Added: trunk/src/insserv/debian/patches/61_interactive_keyword.patch
URL: 
http://svn.debian.org/wsvn/initscripts-ng/trunk/src/insserv/debian/patches/61_interactive_keyword.patch?rev=895&op=file
==============================================================================
--- trunk/src/insserv/debian/patches/61_interactive_keyword.patch (added)
+++ trunk/src/insserv/debian/patches/61_interactive_keyword.patch Thu Jun 25 
16:14:36 2009
@@ -1,0 +1,132 @@
+Purpose: Add support for a X-Interactive keyword to avoid specifying it in 
insserv.conf
+Fixes:   #458224
+Status:  Work in progress.
+---
+
+Index: insserv.8.in
+===================================================================
+--- a/insserv.8.in     (revision 885)
++++ b/insserv.8.in     (working copy)
+@@ -76,6 +76,7 @@
+  # X-Stop-After:      boot_facility_1 [ boot_facility_2 ...]
+  # Default-Start:     run_level_1 [ run_level_2 ...]
+  # Default-Stop:      run_level_1 [ run_level_2 ...]
++ # X-Interactive:     true
+  # Short-Description: single_line_description
+  # Description:       multiline_description
+  ### END INIT INFO
+@@ -117,6 +118,11 @@
+ these tags is stopped.
+ @@END_SUSE@@
+ .PP
++The optional X\-Interactive keyword implies that the script using this
++keyword should be started alone in a concurrent boot configuration
++because it interact with the user at the console.  Only the value
++'true' is recogniced.  All other are ignored.
++.PP
+ The optional
+ .B X\-Start\-Before
+ keyword implies that the script using this keyword
+Index: insserv.c
+===================================================================
+--- a/insserv.c        (revision 885)
++++ b/insserv.c        (working copy)
+@@ -97,6 +97,7 @@
+ #define DEFAULT_START DEFAULT  START VALUE
+ #define DEFAULT_STOP  DEFAULT  STOP  VALUE
+ #define DESCRIPTION   COMM "description" VALUE
++#define INTERACTIVE   COMM "x-interactive" VALUE
+ 
+ /* System facility search within /etc/insserv.conf */
+ #define EQSIGN                "([[:blank:]]*[=:][[:blank:]]*|[[:blank:]]+)"
+@@ -133,6 +134,7 @@
+     char *default_start;
+     char *default_stop;
+     char *description;
++    char *interactive;
+ } attribute((aligned(sizeof(char*)))) lsb_t;
+ 
+ /* Search results points here */
+@@ -147,6 +149,7 @@
+     regex_t def_start;
+     regex_t def_stop;
+     regex_t desc;
++    regex_t interact;
+ } attribute((aligned(sizeof(regex_t)))) reg_t;
+ 
+ typedef struct creg_struct {
+@@ -1132,6 +1135,7 @@
+     regcompiler(&reg.def_start, DEFAULT_START,  
REG_EXTENDED|REG_ICASE|REG_NEWLINE);
+     regcompiler(&reg.def_stop,  DEFAULT_STOP,   
REG_EXTENDED|REG_ICASE|REG_NEWLINE);
+     regcompiler(&reg.desc,      DESCRIPTION,    
REG_EXTENDED|REG_ICASE|REG_NEWLINE);
++    regcompiler(&reg.interact,  INTERACTIVE,    
REG_EXTENDED|REG_ICASE|REG_NEWLINE);
+ }
+ 
+ static inline void scan_script_reset(void) attribute((always_inline));
+@@ -1147,6 +1151,7 @@
+     xreset(script_inf.default_start);
+     xreset(script_inf.default_stop);
+     xreset(script_inf.description);
++    xreset(script_inf.interactive);
+ }
+ 
+ #define FOUND_LSB_HEADER   0x01
+@@ -1177,6 +1182,7 @@
+ #define default_start script_inf.default_start
+ #define default_stop  script_inf.default_stop
+ #define description   script_inf.description
++#define interactive   script_inf.interactive
+ 
+     info("Loading %s\n", path);
+ 
+@@ -1273,6 +1279,14 @@
+               description = empty;
+       }
+ 
++      if (!interactive    && regexecutor(&reg.interact,      COMMON_ARGS) == 
true) {
++          if (val->rm_so < val->rm_eo) {
++              *(pbuf+val->rm_eo) = '\0';
++              interactive = xstrdup(pbuf+val->rm_so);
++          } else
++              interactive = empty;
++      }
++
+       /* Skip scanning below from LSB magic end */
+       if ((end = strstr(buf, "### END INIT INFO")))
+           break;
+@@ -1341,6 +1355,7 @@
+ #undef default_start
+ #undef default_stop
+ #undef description
++#undef interactive
+     return ret;
+ }
+ 
+@@ -1503,6 +1518,7 @@
+     regfree(&reg.def_start);
+     regfree(&reg.def_stop);
+     regfree(&reg.desc);
++    regfree(&reg.interact);
+ }
+ 
+ static struct {
+@@ -1776,6 +1792,9 @@
+               if (script_inf.stop_after && script_inf.stop_after != empty) {
+                   reversereq(service, REQ_SHLD|REQ_KILL, 
script_inf.stop_after);
+               }
++              if (script_inf.interactive && 0 == 
strcmp(script_inf.interactive, "true")) {
++                  service->attr.flags |= SERV_INTRACT;
++              }
+           }
+ 
+           if (name) 
+@@ -2807,6 +2826,9 @@
+                       if (script_inf.should_stop && script_inf.should_stop != 
empty) {
+                           rememberreq(service, REQ_SHLD|REQ_KILL, 
script_inf.should_stop);
+                       }
++                      if (script_inf.interactive && 0 == 
strcmp(script_inf.interactive, "true")) {
++                          service->attr.flags |= SERV_INTRACT;
++                      }
+                   }
+ 
+                   if (script_inf.start_before && script_inf.start_before != 
empty) {

Modified: trunk/src/insserv/debian/patches/series
URL: 
http://svn.debian.org/wsvn/initscripts-ng/trunk/src/insserv/debian/patches/series?rev=895&op=diff
==============================================================================
--- trunk/src/insserv/debian/patches/series (original)
+++ trunk/src/insserv/debian/patches/series Thu Jun 25 16:14:36 2009
@@ -4,6 +4,7 @@
 40_badboy_segfault.patch
 50_symlink_in_initddir.patch
 60_all_keyword_start_only.patch
+61_interactive_keyword.patch
 70_req_start_all_depends.patch 
 80_manual_warnings.patch
 90_no_runlevel_spec_for_debian.patch

Modified: trunk/src/insserv/debian/run-testsuite
URL: 
http://svn.debian.org/wsvn/initscripts-ng/trunk/src/insserv/debian/run-testsuite?rev=895&op=diff
==============================================================================
--- trunk/src/insserv/debian/run-testsuite (original)
+++ trunk/src/insserv/debian/run-testsuite Thu Jun 25 16:14:36 2009
@@ -1783,6 +1783,74 @@
 check_script_present S goodboy
 
 rm $initddir/../rcS.d/S06badboy
+}
+##########################################################################
+test_x_interactive() {
+echo
+echo "info: Check if X-Interactive header work"
+echo "BTS #458224"
+echo
+  
+initdir_purge
+
+# Insert a few scripts to flesh out $initdir
+insertscript first <<EOF || true
+### BEGIN INIT INFO
+# Provides:          first
+# Required-Start:
+# Required-Stop:
+# Default-Start:     2
+# Default-Stop:      0
+### END INIT INFO
+EOF
+
+# This test if X-Interactive work with existing scripts when a new
+# script is inserted.
+insertscript alone1 <<'EOF' || true
+### BEGIN INIT INFO
+# Provides:          alone1
+# Required-Start:    first
+# Required-Stop:     first
+# Default-Start:     2
+# Default-Stop:      0
+# X-Interactive:     true
+### END INIT INFO
+EOF
+
+insertscript after <<'EOF' || true
+### BEGIN INIT INFO
+# Provides:          after
+# Required-Start:    first
+# Required-Stop:     first
+# Default-Start:     2
+# Default-Stop:      0
+### END INIT INFO
+EOF
+
+# This test if X-Interactive work with new scripts too.  The code
+# paths in insserv are different for the two cases.
+insertscript alone2 <<'EOF' || true
+### BEGIN INIT INFO
+# Provides:          alone2
+# Required-Start:    first
+# Required-Stop:     first
+# Default-Start:     2
+# Default-Stop:      0
+# X-Interactive:     true
+### END INIT INFO
+EOF
+
+list_rclinks
+
+check_script_present 2 first
+check_script_present 2 after
+check_script_present 2 alone1
+check_script_present 2 alone2
+check_order 2 first after
+check_order 2 first alone1
+check_order 2 first alone2
+${severity}_order 2 alone1 after # This ordering is not guaranteed
+${severity}_order 2 alone2 after # This ordering is not guaranteed
 }
 ##########################################################################
 
@@ -1820,3 +1888,4 @@
 test_all_keyword
 test_early_all
 test_script_in_runlevel
+test_x_interactive


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

Reply via email to