Hello community,
here is the log from the commit of package insserv for openSUSE:Factory
checked in at Fri Aug 21 18:37:53 CEST 2009.
--------
--- insserv/insserv.changes 2009-08-18 11:44:54.000000000 +0200
+++ insserv/insserv.changes 2009-08-19 12:21:00.000000000 +0200
@@ -1,0 +2,11 @@
+Wed Aug 19 12:07:58 CEST 200 - werner@suse.de
+
+- New version 1.13.0 of insserv
+- Use dependency sorting for scripts using $all
+
+-------------------------------------------------------------------
+Tue Aug 18 14:16:05 CEST 2009 - werner@suse.de
+
+- Make $all available for stopping order
+
+-------------------------------------------------------------------
calling whatdependson for head-i586
Old:
----
insserv-1.12.0.dif
insserv-1.12.0.tar.bz2
New:
----
insserv-1.13.0.dif
insserv-1.13.0.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ insserv.spec ++++++
--- /var/tmp/diff_new_pack.iShUCk/_old 2009-08-21 18:37:18.000000000 +0200
+++ /var/tmp/diff_new_pack.iShUCk/_new 2009-08-21 18:37:18.000000000 +0200
@@ -1,5 +1,5 @@
#
-# spec file for package insserv (Version 1.12.0)
+# spec file for package insserv (Version 1.13.0)
#
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@@ -23,8 +23,8 @@
Group: System/Base
Provides: aaa_base:/sbin/insserv
AutoReqProv: on
-Version: 1.12.0
-Release: 32
+Version: 1.13.0
+Release: 1
Summary: A Program to Arrange Initialization Scripts
Source0: insserv-%{version}.tar.bz2
Source1: insserv.conf
++++++ insserv-1.12.0.dif -> insserv-1.13.0.dif ++++++
--- insserv/insserv-1.12.0.dif 2009-08-18 11:44:54.000000000 +0200
+++ insserv/insserv-1.13.0.dif 2009-08-19 12:20:59.000000000 +0200
@@ -1,565 +1,4 @@
---- insserv.8.in
-+++ insserv.8.in 2009-06-29 14:21:17.377902650 +0200
-@@ -76,6 +76,7 @@ by reading the comment header of the scr
- # 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 @@ which are declared by these two Stop tag
- 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
-@@ -195,7 +201,7 @@ Here is an example for
- # System logger is operational
- $syslog syslog
-
-- # All network daemons are running
-+ # All network daemons are running (This was removed in LSB 1.2)
- $netdaemons portmap inetd
-
- # Services which need to be interactive
-@@ -215,7 +221,19 @@ are keywords. Currently
- is the only know keyword for marking a service
- as an interactive one, e.g. a service which requires
- a passphrase or password input during boot
--or runlevel change.
-+or runlevel change. The special facility
-+.B $null
-+is used to enforce an empty dependency in case of
-+.B Should-Stop
-+and
-+@@BEGIN_SUSE@@
-+.B Required-Stop
-+otherwise insserv assumes the same dependencies as for the
-+.B Start
-+case.
-+@@ELSE_SUSE@@
-+.BR Required-Stop .
-+@@END_SUSE@@
- .P
- Beside the defined
- .B System Facilities
-@@ -258,7 +276,9 @@ Use default runlevels a defined in the s
- This may restore an edited runlevel link scheme.
- .TP
- .BR \-f ,\ \-\-force
--Ignore if a required service is missed.
-+Ignore if a required service is missed. Beside this if start and or
-+stop levels are specified on the command line the default levels of
-+the script will be ignored.
- .TP
- .BR \-h ,\ \-\-help
- Print out short usage message.
-@@ -332,6 +352,10 @@ or simple provide a missing LSB comment
- by placing a file with the new LSB comment header using the same
- name as the boot or init script in the directory
- .IR /etc/insserv/overrides/ .
-+For third party boot scripts without LSB header it is possible to
-+add a file with the same name in the directory
-+.I /usr/share/insserv/overrides/
-+to make them completely LSB compliant.
- .\"
- .SH EXIT CODES
- The exit codes have the following conditions:
---- insserv.c
-+++ insserv.c 2009-08-18 11:37:06.334401679 +0200
-@@ -38,6 +38,9 @@
- # include
- # include
- #endif /* USE_RPMLIB */
-+#ifdef SUSE
-+# include
-+#endif /* SUSE */
- #include "listing.h"
-
- #ifdef SUSE
-@@ -97,6 +100,7 @@ static inline void oneway(char *restrict
- #define DEFAULT_START DEFAULT START VALUE
- #define DEFAULT_STOP DEFAULT STOP VALUE
- #define DESCRIPTION COMM "description" VALUE
-+#define INTERACTIVE COMM "(x[-_]+[a-z0-9_-]*)?interactive" VALUE
-
- /* System facility search within /etc/insserv.conf */
- #define EQSIGN "([[:blank:]]*[=:][[:blank:]]*|[[:blank:]]+)"
-@@ -133,6 +137,7 @@ typedef struct lsb_struct {
- char *default_start;
- char *default_stop;
- char *description;
-+ char *interactive;
- } attribute((aligned(sizeof(char*)))) lsb_t;
-
- /* Search results points here */
-@@ -147,6 +152,7 @@ typedef struct reg_struct {
- 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 {
-@@ -217,6 +223,7 @@ typedef struct string {
- typedef struct repl {
- list_t r_list;
- string_t r[1];
-+ ushort flags;
- } __align repl_t;
- #define getrepl(arg) list_entry((arg), struct repl, r_list)
-
-@@ -290,6 +297,8 @@ static void rememberreq(service_t * rest
- requires(here, need, type);
- break;
- case '$':
-+ if (strcasecmp(token, "$null") == 0)
-+ break;
- if (strcasecmp(token, "$all") == 0) {
- serv->attr.flags |= SERV_ALL;
- break;
-@@ -771,9 +780,6 @@ static inline void makedep(void)
- continue;
- #endif /* not MINIMAL_RULES */
-
-- if (list_empty(&serv->sort.req))
-- continue;
--
- if (serv->start->lvl & LVL_BOOT)
- out = boot;
- else
-@@ -815,6 +821,10 @@ static inline void makedep(void)
- fprintf(out, " %s", name);
- }
- } else {
-+
-+ if (list_empty(&serv->sort.req))
-+ continue;
-+
- np_list_for_each(pos, &serv->sort.req) {
- req_t * req = getreq(pos);
- service_t * dep = req->serv;
-@@ -1132,6 +1142,7 @@ static inline void scan_script_regalloc(
- regcompiler(®.def_start, DEFAULT_START, REG_EXTENDED|REG_ICASE|REG_NEWLINE);
- regcompiler(®.def_stop, DEFAULT_STOP, REG_EXTENDED|REG_ICASE|REG_NEWLINE);
- regcompiler(®.desc, DESCRIPTION, REG_EXTENDED|REG_ICASE|REG_NEWLINE);
-+ regcompiler(®.interact, INTERACTIVE, REG_EXTENDED|REG_ICASE|REG_NEWLINE);
- }
-
- static inline void scan_script_reset(void) attribute((always_inline));
-@@ -1147,6 +1158,7 @@ static inline void scan_script_reset(voi
- 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 +1189,7 @@ static uchar scan_lsb_headers(const int
- #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 +1286,14 @@ static uchar scan_lsb_headers(const int
- description = empty;
- }
-
-+ if (!interactive && regexecutor(®.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 +1362,7 @@ static uchar scan_lsb_headers(const int
- #undef default_start
- #undef default_stop
- #undef description
-+#undef interactive
- return ret;
- }
-
-@@ -1503,6 +1525,7 @@ static inline void scan_script_regfree()
- regfree(®.def_start);
- regfree(®.def_stop);
- regfree(®.desc);
-+ regfree(®.interact);
- }
-
- static struct {
-@@ -1696,6 +1719,11 @@ static void scan_script_locations(const
- }
-
- lsb = scan_script_defaults(dfd, d->d_name, override_path, &name, true, ignore);
-+ if (!name) {
-+ warn("warning: script is corrupt or invalid: %s/%s%s\n", path, rcd, d->d_name);
-+ continue;
-+ }
-+
- if (!script_inf.provides || script_inf.provides == empty)
- script_inf.provides = xstrdup(ptr);
-
-@@ -1776,6 +1804,9 @@ static void scan_script_locations(const
- 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)
-@@ -1849,6 +1880,7 @@ static void scan_conf_file(const char *r
- if (posix_memalign((void*)&subst, sizeof(void*), alignof(repl_t)) != 0)
- error("%s", strerror(errno));
- insert(&subst->r_list, r_list->prev);
-+ subst->flags = 0;
- r = &subst->r[0];
- if (posix_memalign((void*)&r->ref, sizeof(void*), alignof(typeof(r->ref))+strsize(token)) != 0)
- error("%s", strerror(errno));
-@@ -1878,6 +1910,7 @@ static void scan_conf_file(const char *r
- error("%s", strerror(errno));
- insert(&subst->r_list, r_list->prev);
- r = &subst->r[0];
-+ subst->flags = 0;
- if (posix_memalign((void*)&r->ref, sizeof(void*), alignof(typeof(r->ref))+strsize(token)) != 0)
- error("%s", strerror(errno));
- *r->ref = 1;
-@@ -2028,33 +2061,32 @@ static void expand_faci(list_t *restrict
- goto out;
- }
-
-- if ((*deep)++ > 10) {
-- warn("The nested level of the system facilities in the insserv.conf file(s) is to large\n");
-- goto out;
-- }
--
- list_for_each_safe(tmp, safe, ptr) {
- repl_t * rnxt = getrepl(tmp);
-+ if (rnxt->flags & 0x0001) {
-+ error("Loop detected during expanding system facilities in the insserv.conf file(s): %s\n",
-+ rnxt->r[0].name);
-+ }
- if (*rnxt->r[0].name == '$') {
-- expand_faci(tmp, head, deep);
-- } else {
-- if (*deep == 1) {
-- if (--(*rent->r[0].ref) <= 0)
-- free(rent->r[0].ref);
-- rent->r[0] = rnxt->r[0];
-- ++(*rent->r[0].ref);
-- } else {
-- repl_t *restrict subst;
-- if (posix_memalign((void*)&subst, sizeof(void*), alignof(repl_t)) != 0)
-- error("%s", strerror(errno));
-- insert(&subst->r_list, head);
-- subst->r[0] = rnxt->r[0];
-- ++(*subst->r[0].ref);
-+ if (*deep > 10) {
-+ warn("The nested level of the system facilities in the insserv.conf file(s) is to large\n");
-+ goto out;
- }
-+ (*deep)++;
-+ rnxt->flags |= 0x0001;
-+ expand_faci(tmp, head, deep);
-+ rnxt->flags &= ~0x0001;
-+ (*deep)--;
-+ } else if (*deep > 0) {
-+ repl_t *restrict subst;
-+ if (posix_memalign((void*)&subst, sizeof(void*), alignof(repl_t)) != 0)
-+ error("%s", strerror(errno));
-+ insert(&subst->r_list, head->prev);
-+ subst->r[0] = rnxt->r[0];
-+ (*subst->r[0].ref) = 1;
- }
- }
- out:
-- (*deep)--;
- return;
- }
-
-@@ -2064,9 +2096,12 @@ static inline void expand_conf(void)
- list_for_each(ptr, sysfaci_start) {
- list_t * rlist, * safe, * head = &getfaci(ptr)->replace;
- list_for_each_safe(rlist, safe, head) {
-- if (*getrepl(rlist)->r[0].name == '$') {
-+ repl_t * tmp = getrepl(rlist);
-+ if (*tmp->r[0].name == '$') {
- int deep = 0;
-+ tmp->flags |= 0x0001;
- expand_faci(rlist, rlist, &deep);
-+ tmp->flags &= ~0x0001;
- }
- }
- }
-@@ -2114,6 +2149,7 @@ static inline char * scan_for(DIR *const
- static inline boolean underrpm(void)
- {
- boolean ret = false;
-+ boolean mnt = true;
- const pid_t pp = getppid();
- char buf[PATH_MAX], *argv[3], *ptr;
- # if defined(USE_RPMLIB) && (USE_RPMLIB > 0)
-@@ -2123,8 +2159,15 @@ static inline boolean underrpm(void)
- ssize_t len;
-
- snprintf(buf, sizeof(buf)-1, "/proc/%lu/cmdline", (unsigned long)pp);
-- if ((fd = open(buf, O_NOCTTY|O_RDONLY)) < 0)
-- goto out;
-+ do {
-+ if ((fd = open(buf, O_NOCTTY|O_RDONLY)) >= 0)
-+ break;
-+ if (!mnt || (errno != ENOENT))
-+ goto out;
-+ if (mount("proc", "/proc", "proc", 0, NULL) < 0)
-+ error ("underrpm() can not mount /proc: %s\n", strerror(errno));
-+ mnt = false;
-+ } while (1);
-
- memset(buf, '\0', sizeof(buf));
- if ((len = read(fd , buf, sizeof(buf)-1)) < 0)
-@@ -2185,6 +2228,8 @@ static inline boolean underrpm(void)
- out:
- if (fd >= 0)
- close(fd);
-+ if (!mnt)
-+ umount("/proc");
-
- return ret;
- }
-@@ -2238,6 +2283,7 @@ int main (int argc, char *argv[])
- boolean del = false;
- boolean defaults = false;
- boolean ignore = false;
-+ boolean loadarg = false;
-
- myname = basename(*argv);
-
-@@ -2305,7 +2351,9 @@ int main (int argc, char *argv[])
- argv += optind;
- argc -= optind;
-
-- if (!argc && del)
-+ if (argc)
-+ loadarg = true;
-+ else if (del)
- error("usage: %s [[-r] init_script|init_directory]\n", myname);
-
- if (*argv) {
-@@ -2357,7 +2405,19 @@ int main (int argc, char *argv[])
-
- if (strcmp(path, INITDIR) != 0) {
- char * tmp;
-- root = xstrdup(path);
-+ if (*path != '/') {
-+ char * pwd = getcwd((char*)0, 0);
-+ size_t len = strlen(pwd)+1+strlen(path);
-+ root = (char*)malloc(len);
-+ if (!root)
-+ error("%s", strerror(errno));
-+ strcpy(root, pwd);
-+ if (pwd[1])
-+ strcat(root, "/");
-+ strcat(root, path);
-+ free(pwd);
-+ } else
-+ root = xstrdup(path);
- if ((tmp = strstr(root, INITDIR))) {
- *tmp = '\0';
- } else {
-@@ -2490,17 +2550,45 @@ int main (int argc, char *argv[])
- /*
- * Scan now all scripts found in the init.d/ directory
- */
-- while ((d = readdir(initdir)) != (struct dirent*)0) {
-- const boolean isarg = chkfor(d->d_name, argv, argc);
-+ for (;;) {
- service_t * service = (service_t*)0;
- char * token;
- char * begin = (char*)0; /* hold start pointer of strings handled by strsep() */
- boolean hard = false;
-+ boolean isarg = false;
- uchar lsb = 0;
- #if defined(DEBUG) && (DEBUG > 0)
- int nobug = 0;
- #endif
-
-+ if ((d = readdir(initdir)) == (struct dirent*)0) {
-+ /*
-+ * If first script in argument list was loaded in advance, then
-+ * rewind the init.d/ directory stream and attempt to load all
-+ * other scripts.
-+ */
-+ if (loadarg) {
-+ loadarg = false;
-+ rewinddir(initdir);
-+ continue;
-+ }
-+ break;
-+ }
-+
-+ isarg = chkfor(d->d_name, argv, argc);
-+
-+ /*
-+ * Load first script in argument list before all other scripts. This
-+ * avoids problems with loading scripts in underterministic sequence
-+ * returned by readdir(3).
-+ */
-+ if (loadarg && !isarg)
-+ continue;
-+ if (loadarg && isarg && (curr_argc != 0))
-+ continue;
-+ if (!loadarg && isarg && (curr_argc == 0))
-+ continue;
-+
- if (*d->d_name == '.')
- continue;
- errno = 0;
-@@ -2807,6 +2895,9 @@ int main (int argc, char *argv[])
- 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) {
-@@ -2985,16 +3076,17 @@ int main (int argc, char *argv[])
- char * ptr = argr[curr_argc];
- struct _mark {
- const char * wrd;
-+ const boolean sk;
- char * order;
- char ** str;
- } mark[] = {
-- {"start=", (char*)0, &script_inf.default_start},
-- {"stop=", (char*)0, &script_inf.default_stop },
-+ {"start=", true, (char*)0, &script_inf.default_start},
-+ {"stop=", false, (char*)0, &script_inf.default_stop },
- #if 0
-- {"reqstart=", (char*)0, &script_inf.required_start},
-- {"reqstop=", (char*)0, &script_inf.required_stop },
-+ {"reqstart=", false, (char*)0, &script_inf.required_start},
-+ {"reqstop=", false, (char*)0, &script_inf.required_stop },
- #endif
-- {(char*)0, (char*)0, (char**)0}
-+ {(char*)0, false, (char*)0, (char**)0}
- };
-
- for (c = 0; mark[c].wrd; c++) {
-@@ -3016,6 +3108,14 @@ int main (int argc, char *argv[])
- char * ptr = mark[c].order + len - 1;
- if (*ptr == ',') *ptr = '\0';
- }
-+ if (ignore) {
-+ service_t *arg = findservice(getprovides(d->d_name));
-+ arg = getorig(arg);
-+ if (mark[c].sk)
-+ arg->start->lvl = 0;
-+ else
-+ arg->stopp->lvl = 0;
-+ }
- xreset(*(mark[c].str));
- *(mark[c].str) = xstrdup(mark[c].order);
- }
---- listing.c
-+++ listing.c 2009-08-17 14:15:48.893900934 +0200
-@@ -364,6 +364,7 @@ static void __follow (dir_t *restrict di
- * Do not count the dependcy deep of the system facilities
- * but follow them to count the replacing provides.
- */
-+
- if (*ptmp->name == '$')
- warn("System facilities not fully expanded, see %s!\n", dir->name);
- else if (++deep > MAX_DEEP) {
-@@ -398,6 +399,12 @@ static void __follow (dir_t *restrict di
- break; /* Loop detected, stop recursion */
- }
-
-+ if ((mode == 'S') && (attof(tmp)->flags & SERV_ALL)) {
-+ warn("%s depends on %s and therefore on system facility `$all' which can not be true!\n",
-+ target->script ? target->script : target->name, tmp->script ? tmp->script : tmp->name);
-+ continue;
-+ }
-+
- if (ptrg->deep >= deep) /* Nothing new */
- continue;
- /* The inner recursion */
---- listing.h
-+++ listing.h 2009-07-02 10:48:50.789901632 +0200
-@@ -92,7 +92,7 @@ static inline void prefetch(const void *
- #endif
- #define __packed attribute((packed))
-
--#define alignof(type) (sizeof(type)+(sizeof(type)%sizeof(void*)))
-+#define alignof(type) ((sizeof(type)+(sizeof(void*)-1)) & ~(sizeof(void*)-1))
- #define strsize(string) ((strlen(string)+1)*sizeof(char))
-
- typedef struct list_struct {
---- tests/suite
-+++ tests/suite 2009-08-17 11:24:02.497901719 +0200
-@@ -79,6 +79,22 @@ else
- $time hwclock
- <interactive> udev mountdevsubfs checkroot checkfs console-screen
- EOF
-+ update_conf ()
-+ {
-+ set +C
-+ cat <<-'EOF' > $insconf
-+ $local_fs +mountall +umountfs
-+ $network +networking +ifupdown
-+ $named +named +dnsmasq +lwresd +bind9 $network
-+ $remote_fs $local_fs +mountnfs +mountnfs-bootclean +umountnfs +sendsigs
-+ $syslog +syslog +sysklogd
-+ $portmap portmap
-+ $time hwclock
-+ <interactive> udev mountdevsubfs checkroot checkfs console-screen
-+ EOF
-+ set -C
-+ }
-+
- fi
- chmod u+w,a+r $insconf
-
-@@ -94,6 +110,12 @@ insserv_del ()
- $insserv $debug -c $insconf -p $initddir -o $overridedir -r $script
- }
-
-+initdir_purge ()
-+{
-+ rm -rf ${initddir}/../rc*.d ${initddir}
-+ mkdir -p ${initddir}
-+}
-+
- relpath ()
- {
- local OLDIFS IFS
-@@ -201,6 +223,13 @@ addscript ()
- chmod u+w,a+rx $script
- }
-
-+remscript ()
-+{
-+ local scriptname=$1
-+ local script=${initddir}/$scriptname
-+ rm -f $script
-+}
-+
- insertscript ()
- {
- local scriptname=$1
+--- .dummy
++++ .dummy 2009-08-19 12:18:39.181901099 +0200
+@@ -0,0 +1 @@
++this is a dummy, remove if real changes are required
++++++ insserv-1.12.0.tar.bz2 -> insserv-1.13.0.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/insserv-1.12.0/CHANGES new/insserv-1.13.0/CHANGES
--- old/insserv-1.12.0/CHANGES 2008-07-29 15:32:33.000000000 +0200
+++ new/insserv-1.13.0/CHANGES 2009-08-19 12:09:14.000000000 +0200
@@ -1,4 +1,63 @@
-------------------------------------------------------------------
+Wed Aug 19 12:07:58 CEST 200 - werner@suse.de
+
+- Use dependency sorting for scripts using $all
+
+-------------------------------------------------------------------
+Tue Aug 18 14:16:05 CEST 2009 - werner@suse.de
+
+- Make $all available for stopping order
+
+-------------------------------------------------------------------
+Mon Aug 17 14:55:39 CEST 2009 - werner@suse.de
+
+- Loops within /etc/insserv.conf are real errors
+- The system facility $all is special
+
+-------------------------------------------------------------------
+Thu Jul 23 11:28:08 CEST 2009 - werner@suse.de
+
+- Fix expansion of the system facilties
+
+-------------------------------------------------------------------
+Mon Jun 29 14:26:57 CEST 2009 - werner@suse.de
+
+- Make it possible to mark a script as interactive in the LSB
+ header its self (patch from Petter Reinholdtsen).
+
+-------------------------------------------------------------------
+Mon Mar 9 13:12:17 CET 2009 - werner@suse.de
+
+- Add service in .depend.start even if $all only is used
+
+-------------------------------------------------------------------
+Mon Feb 23 13:04:00 CET 2009 - werner@suse.de
+
+- Allow overriding level on the command line
+
+-------------------------------------------------------------------
+Thu Feb 12 14:15:22 CET 2009 - werner@suse.de
+
+- Do not be fooled by inexistent /proc
+
+-------------------------------------------------------------------
+Fri Sep 12 12:33:29 CEST 2008 - werner@suse.de
+
+- Don't be fooled by broken symlinks (Patch from Kel Modderman)
+
+-------------------------------------------------------------------
+Thu Sep 11 15:28:29 CEST 2008 - werner@suse.de
+
+- Load first script in argument list before all other scripts. This
+ avoids problems with loading scripts in underterministic sequence
+ returned by readdir(3) (Patch from Kel Modderman)
+
+-------------------------------------------------------------------
+Tue Aug 12 13:40:43 CEST 2008 - werner@suse.de
+
+- Mention the $null facility
+
+-------------------------------------------------------------------
Tue Jul 29 15:23:43 CEST 2008 - werner@suse.de
- Resolve server minor problems on openSUSE and Debian
@@ -105,7 +164,7 @@
Petter Reinholdtsen
* Make it possible to set the path at runtime, to make it easier
to write test suites
- * Support for reading LSB headers info from override directroy
+ * Support for reading LSB headers info from override directory
* Accept script names like 'rc.local' for Debian build
* Use other defaults on Debian systems (start, stop levels)
* Put redundant level informations in one API
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/insserv-1.12.0/Makefile new/insserv-1.13.0/Makefile
--- old/insserv-1.12.0/Makefile 2008-07-30 12:04:51.000000000 +0200
+++ new/insserv-1.13.0/Makefile 2009-08-19 12:09:58.000000000 +0200
@@ -11,7 +11,7 @@
DEBUG =
ISSUSE = -DSUSE
DESTDIR =
-VERSION = 1.12.0
+VERSION = 1.13.0
DATE = $(shell date +'%d%b%y' | tr '[:lower:]' '[:upper:]')
#
@@ -59,7 +59,7 @@
#
# Determine if a library provides a specific function
-# Fist argument is the function to test, the second
+# First argument is the function to test, the second
# one is the library its self.
#
CTEST = $(CC) -nostdinc -fno-builtin -o /dev/null -xc
@@ -173,7 +173,7 @@
Author: Werner Fink \n\
Maintained-by: Werner Fink \n\
Primary-site: sunsite.unc.edu /pub/Linux/system/daemons/init\n\
-x @UNKNOWN insserv-$(VERSION).tar.gz\n\
+x @UNKNOWN insserv-$(VERSION).tar.bz2\n\
Alternate-site: ftp.suse.com /pub/projects/init\n\
Platforms: Linux with System VR2 or higher boot scheme\n\
Copying-policy: GPL\n\
@@ -184,9 +184,9 @@
*) cp -p $$file insserv-$(VERSION)/ ;; \
esac; \
done
- tar -cps -zf insserv-$(VERSION).tar.gz insserv-$(VERSION)/
+ tar -cps -jf insserv-$(VERSION).tar.bz2 insserv-$(VERSION)/
$(RMDIR) insserv-$(VERSION)
- set -- `gzip -l insserv-$(VERSION).tar.gz | tail -1` ; \
+ set -- `find insserv-$(VERSION).tar.bz2 -printf '%s'` ; \
sed "s:@UNKNOWN:$$1:" < insserv-$(VERSION).lsm > \
insserv-$(VERSION).lsm.tmp ; \
mv insserv-$(VERSION).lsm.tmp insserv-$(VERSION).lsm
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/insserv-1.12.0/insserv-1.12.0.lsm new/insserv-1.13.0/insserv-1.12.0.lsm
--- old/insserv-1.12.0/insserv-1.12.0.lsm 2008-07-30 12:05:13.000000000 +0200
+++ new/insserv-1.13.0/insserv-1.12.0.lsm 1970-01-01 01:00:00.000000000 +0100
@@ -1,15 +0,0 @@
-Begin3
-Title: insserv tool for boot scripts
-Version: 1.12.0
-Entered-date: 30JUL08
-Description: Used for enabling of installed boot scripts
- by scanning comment headers which are LSB conform.
-Keywords: boot service control, LSB
-Author: Werner Fink
-Maintained-by: Werner Fink
-Primary-site: sunsite.unc.edu /pub/Linux/system/daemons/init
- @UNKNOWN insserv-1.12.0.tar.gz
-Alternate-site: ftp.suse.com /pub/projects/init
-Platforms: Linux with System VR2 or higher boot scheme
-Copying-policy: GPL
-End
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/insserv-1.12.0/insserv-1.13.0.lsm new/insserv-1.13.0/insserv-1.13.0.lsm
--- old/insserv-1.12.0/insserv-1.13.0.lsm 1970-01-01 01:00:00.000000000 +0100
+++ new/insserv-1.13.0/insserv-1.13.0.lsm 2009-08-19 13:57:01.000000000 +0200
@@ -0,0 +1,15 @@
+Begin3
+Title: insserv tool for boot scripts
+Version: 1.13.0
+Entered-date: 19AUG09
+Description: Used for enabling of installed boot scripts
+ by scanning comment headers which are LSB conform.
+Keywords: boot service control, LSB
+Author: Werner Fink
+Maintained-by: Werner Fink
+Primary-site: sunsite.unc.edu /pub/Linux/system/daemons/init
+ @UNKNOWN insserv-1.13.0.tar.bz2
+Alternate-site: ftp.suse.com /pub/projects/init
+Platforms: Linux with System VR2 or higher boot scheme
+Copying-policy: GPL
+End
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/insserv-1.12.0/insserv.8.in new/insserv-1.13.0/insserv.8.in
--- old/insserv-1.12.0/insserv.8.in 2008-07-29 15:16:18.000000000 +0200
+++ new/insserv-1.13.0/insserv.8.in 2009-08-18 14:19:48.000000000 +0200
@@ -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
@@ -195,7 +201,7 @@
# System logger is operational
$syslog syslog
- # All network daemons are running
+ # All network daemons are running (This was removed in LSB 1.2)
$netdaemons portmap inetd
# Services which need to be interactive
@@ -215,7 +221,19 @@
is the only know keyword for marking a service
as an interactive one, e.g. a service which requires
a passphrase or password input during boot
-or runlevel change.
+or runlevel change. The special facility
+.B $null
+is used to enforce an empty dependency in case of
+.B Should-Stop
+and
+@@BEGIN_SUSE@@
+.B Required-Stop
+otherwise insserv assumes the same dependencies as for the
+.B Start
+case.
+@@ELSE_SUSE@@
+.BR Required-Stop .
+@@END_SUSE@@
.P
Beside the defined
.B System Facilities
@@ -225,8 +243,9 @@
also knows the special facility
.BR $all .
This facility indicates that a service should be inserted
-at the end of all services. Clearly all services using
-this facility will be grouped into one starting order.
+at the end of all services at starting and at the very begining
+at stopping. Clearly all services using this facility will be
+grouped into one starting or stopping order.
.\"
.SH OPTIONS
Currently there exists nine options for
@@ -258,7 +277,9 @@
This may restore an edited runlevel link scheme.
.TP
.BR \-f ,\ \-\-force
-Ignore if a required service is missed.
+Ignore if a required service is missed. Beside this if start and or
+stop levels are specified on the command line the default levels of
+the script will be ignored.
.TP
.BR \-h ,\ \-\-help
Print out short usage message.
@@ -332,6 +353,10 @@
by placing a file with the new LSB comment header using the same
name as the boot or init script in the directory
.IR /etc/insserv/overrides/ .
+For third party boot scripts without LSB header it is possible to
+add a file with the same name in the directory
+.I /usr/share/insserv/overrides/
+to make them completely LSB compliant.
.\"
.SH EXIT CODES
The exit codes have the following conditions:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/insserv-1.12.0/insserv.c new/insserv-1.13.0/insserv.c
--- old/insserv-1.12.0/insserv.c 2008-07-29 15:27:50.000000000 +0200
+++ new/insserv-1.13.0/insserv.c 2009-08-19 13:56:57.000000000 +0200
@@ -38,6 +38,9 @@
# include
# include
#endif /* USE_RPMLIB */
+#ifdef SUSE
+# include
+#endif /* SUSE */
#include "listing.h"
#ifdef SUSE
@@ -97,6 +100,7 @@
#define DEFAULT_START DEFAULT START VALUE
#define DEFAULT_STOP DEFAULT STOP VALUE
#define DESCRIPTION COMM "description" VALUE
+#define INTERACTIVE COMM "(x[-_]+[a-z0-9_-]*)?interactive" VALUE
/* System facility search within /etc/insserv.conf */
#define EQSIGN "([[:blank:]]*[=:][[:blank:]]*|[[:blank:]]+)"
@@ -133,6 +137,7 @@
char *default_start;
char *default_stop;
char *description;
+ char *interactive;
} attribute((aligned(sizeof(char*)))) lsb_t;
/* Search results points here */
@@ -147,6 +152,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 {
@@ -217,6 +223,7 @@
typedef struct repl {
list_t r_list;
string_t r[1];
+ ushort flags;
} __align repl_t;
#define getrepl(arg) list_entry((arg), struct repl, r_list)
@@ -290,8 +297,13 @@
requires(here, need, type);
break;
case '$':
+ if (strcasecmp(token, "$null") == 0)
+ break;
if (strcasecmp(token, "$all") == 0) {
- serv->attr.flags |= SERV_ALL;
+ if (bit & REQ_KILL)
+ serv->attr.flags |= SERV_FIRST;
+ else
+ serv->attr.flags |= SERV_ALL;
break;
}
/* Expand the `$' token recursively down */
@@ -614,7 +626,8 @@
/*
* Last but not least the `$all' scripts will be set to the
- * end of the current start order.
+ * beginning of the future stop order respectivly to the
+ * end of the future start order.
*/
static inline void all_script(void) attribute((always_inline));
static inline void all_script(void)
@@ -624,28 +637,57 @@
list_for_each(pos, s_start) {
service_t * serv = getservice(pos);
list_t * tmp;
- int neworder;
if (serv->attr.flags & SERV_DUPLET)
continue; /* Duplet */
- if (!(serv->attr.flags & SERV_ALL))
+ if (!(serv->attr.flags & SERV_FIRST))
continue;
if (serv->attr.script == (char*)0)
continue;
- neworder = 0;
list_for_each(tmp, s_start) {
service_t * cur = getservice(tmp);
if (cur->attr.flags & SERV_DUPLET)
continue; /* Duplet */
- if ((serv->start->lvl & cur->start->lvl) == 0)
+ if ((serv->stopp->lvl & cur->stopp->lvl) == 0)
+ continue;
+
+ if (cur == serv)
continue;
- if (cur->attr.script == (char*)0)
+ if (cur->attr.flags & SERV_FIRST)
+ continue;
+
+ rememberreq(serv, REQ_SHLD|REQ_KILL, cur->name);
+ }
+
+ setorder(serv->attr.script, 'K', 1, false);
+ }
+
+ list_for_each(pos, s_start) {
+ service_t * serv = getservice(pos);
+ list_t * tmp;
+
+ if (serv->attr.flags & SERV_DUPLET)
+ continue; /* Duplet */
+
+ if (!(serv->attr.flags & SERV_ALL))
+ continue;
+
+ if (serv->attr.script == (char*)0)
+ continue;
+
+ list_for_each(tmp, s_start) {
+ service_t * cur = getservice(tmp);
+
+ if (cur->attr.flags & SERV_DUPLET)
+ continue; /* Duplet */
+
+ if ((serv->start->lvl & cur->start->lvl) == 0)
continue;
if (cur == serv)
@@ -654,19 +696,8 @@
if (cur->attr.flags & SERV_ALL)
continue;
- cur->attr.sorder = getorder(cur->attr.script, 'S');
-
- if (cur->attr.sorder > neworder)
- neworder = cur->attr.sorder;
+ rememberreq(serv, REQ_SHLD, cur->name);
}
- neworder++;
-
- if (neworder > MAX_DEEP)
- neworder = maxstart;
- else if (neworder > maxstart)
- maxstart = neworder;
-
- setorder(serv->attr.script, 'S', neworder, false);
}
}
@@ -771,85 +802,51 @@
continue;
#endif /* not MINIMAL_RULES */
- if (list_empty(&serv->sort.req))
- continue;
-
if (serv->start->lvl & LVL_BOOT)
out = boot;
else
out = start;
- mark = false;
- if (serv->attr.flags & SERV_ALL) {
- list_for_each(pos, s_start) {
- service_t * dep = getservice(pos);
- const char * name;
-
- if (!dep)
- continue;
-
- if (dep->attr.flags & SERV_DUPLET)
- continue; /* Duplet */
-
-#if defined(MINIMAL_RULES) && (MINIMAL_RULES != 0)
- if (dep->attr.ref <= 0)
- continue;
-#endif /* not MINIMAL_RULES */
-
- /*
- * No self dependcies or from the last
- */
- if (dep == serv || (dep->attr.flags & SERV_ALL))
- continue;
-
- if ((serv->start->lvl & dep->start->lvl) == 0)
- continue;
+ if (list_empty(&serv->sort.req))
+ continue;
- if ((name = dep->attr.script) == (char*)0)
- continue;
+ mark = false;
- if (!mark) {
- fprintf(out, "%s:", target);
- mark = true;
- }
- fprintf(out, " %s", name);
- }
- } else {
- np_list_for_each(pos, &serv->sort.req) {
- req_t * req = getreq(pos);
- service_t * dep = req->serv;
- const char * name;
+ np_list_for_each(pos, &serv->sort.req) {
+ req_t * req = getreq(pos);
+ service_t * dep = req->serv;
+ const char * name;
- if (!dep)
- continue;
+ if (!dep)
+ continue;
- if (dep->attr.flags & SERV_DUPLET)
- continue;
+ if (dep->attr.flags & SERV_DUPLET)
+ continue;
#if defined(MINIMAL_RULES) && (MINIMAL_RULES != 0)
- if (dep->attr.ref <= 0)
- continue;
+ if (dep->attr.ref <= 0)
+ continue;
#endif /* not MINIMAL_RULES */
- /*
- * No self dependcies or from the last
- */
- if (dep == serv || (dep->attr.flags & SERV_ALL))
- continue;
+ /*
+ * No self dependcies or from the last
+ */
+ if (dep == serv || (dep->attr.flags & SERV_ALL))
+ continue;
- if ((serv->start->lvl & dep->start->lvl) == 0)
- continue;
+ if ((serv->start->lvl & dep->start->lvl) == 0)
+ continue;
- if ((name = dep->attr.script) == (char*)0)
- continue;
+ if ((name = dep->attr.script) == (char*)0)
+ continue;
- if (!mark) {
- fprintf(out, "%s:", target);
- mark = true;
- }
- fprintf(out, " %s", name);
+ if (!mark) {
+ fprintf(out, "%s:", target);
+ mark = true;
}
+ fprintf(out, " %s", name);
}
+
if (mark) fputc('\n', out);
}
@@ -1132,6 +1129,7 @@
regcompiler(®.def_start, DEFAULT_START, REG_EXTENDED|REG_ICASE|REG_NEWLINE);
regcompiler(®.def_stop, DEFAULT_STOP, REG_EXTENDED|REG_ICASE|REG_NEWLINE);
regcompiler(®.desc, DESCRIPTION, REG_EXTENDED|REG_ICASE|REG_NEWLINE);
+ regcompiler(®.interact, INTERACTIVE, REG_EXTENDED|REG_ICASE|REG_NEWLINE);
}
static inline void scan_script_reset(void) attribute((always_inline));
@@ -1147,6 +1145,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 +1176,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 +1273,14 @@
description = empty;
}
+ if (!interactive && regexecutor(®.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 +1349,7 @@
#undef default_start
#undef default_stop
#undef description
+#undef interactive
return ret;
}
@@ -1503,6 +1512,7 @@
regfree(®.def_start);
regfree(®.def_stop);
regfree(®.desc);
+ regfree(®.interact);
}
static struct {
@@ -1696,6 +1706,11 @@
}
lsb = scan_script_defaults(dfd, d->d_name, override_path, &name, true, ignore);
+ if (!name) {
+ warn("warning: script is corrupt or invalid: %s/%s%s\n", path, rcd, d->d_name);
+ continue;
+ }
+
if (!script_inf.provides || script_inf.provides == empty)
script_inf.provides = xstrdup(ptr);
@@ -1776,6 +1791,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)
@@ -1849,6 +1867,7 @@
if (posix_memalign((void*)&subst, sizeof(void*), alignof(repl_t)) != 0)
error("%s", strerror(errno));
insert(&subst->r_list, r_list->prev);
+ subst->flags = 0;
r = &subst->r[0];
if (posix_memalign((void*)&r->ref, sizeof(void*), alignof(typeof(r->ref))+strsize(token)) != 0)
error("%s", strerror(errno));
@@ -1877,6 +1896,7 @@
if (posix_memalign((void*)&subst, sizeof(void*), alignof(repl_t)) != 0)
error("%s", strerror(errno));
insert(&subst->r_list, r_list->prev);
+ subst->flags = 0;
r = &subst->r[0];
if (posix_memalign((void*)&r->ref, sizeof(void*), alignof(typeof(r->ref))+strsize(token)) != 0)
error("%s", strerror(errno));
@@ -2028,33 +2048,32 @@
goto out;
}
- if ((*deep)++ > 10) {
- warn("The nested level of the system facilities in the insserv.conf file(s) is to large\n");
- goto out;
- }
-
list_for_each_safe(tmp, safe, ptr) {
repl_t * rnxt = getrepl(tmp);
+ if (rnxt->flags & 0x0001) {
+ error("Loop detected during expanding system facilities in the insserv.conf file(s): %s\n",
+ rnxt->r[0].name);
+ }
if (*rnxt->r[0].name == '$') {
- expand_faci(tmp, head, deep);
- } else {
- if (*deep == 1) {
- if (--(*rent->r[0].ref) <= 0)
- free(rent->r[0].ref);
- rent->r[0] = rnxt->r[0];
- ++(*rent->r[0].ref);
- } else {
- repl_t *restrict subst;
- if (posix_memalign((void*)&subst, sizeof(void*), alignof(repl_t)) != 0)
- error("%s", strerror(errno));
- insert(&subst->r_list, head);
- subst->r[0] = rnxt->r[0];
- ++(*subst->r[0].ref);
+ if (*deep > 10) {
+ warn("The nested level of the system facilities in the insserv.conf file(s) is to large\n");
+ goto out;
}
+ (*deep)++;
+ rnxt->flags |= 0x0001;
+ expand_faci(tmp, head, deep);
+ rnxt->flags &= ~0x0001;
+ (*deep)--;
+ } else if (*deep > 0) {
+ repl_t *restrict subst;
+ if (posix_memalign((void*)&subst, sizeof(void*), alignof(repl_t)) != 0)
+ error("%s", strerror(errno));
+ insert(&subst->r_list, head->prev);
+ subst->r[0] = rnxt->r[0];
+ (*subst->r[0].ref) = 1;
}
}
out:
- (*deep)--;
return;
}
@@ -2064,9 +2083,12 @@
list_for_each(ptr, sysfaci_start) {
list_t * rlist, * safe, * head = &getfaci(ptr)->replace;
list_for_each_safe(rlist, safe, head) {
- if (*getrepl(rlist)->r[0].name == '$') {
+ repl_t * tmp = getrepl(rlist);
+ if (*tmp->r[0].name == '$') {
int deep = 0;
+ tmp->flags |= 0x0001;
expand_faci(rlist, rlist, &deep);
+ tmp->flags &= ~0x0001;
}
}
}
@@ -2114,6 +2136,7 @@
static inline boolean underrpm(void)
{
boolean ret = false;
+ boolean mnt = true;
const pid_t pp = getppid();
char buf[PATH_MAX], *argv[3], *ptr;
# if defined(USE_RPMLIB) && (USE_RPMLIB > 0)
@@ -2123,8 +2146,15 @@
ssize_t len;
snprintf(buf, sizeof(buf)-1, "/proc/%lu/cmdline", (unsigned long)pp);
- if ((fd = open(buf, O_NOCTTY|O_RDONLY)) < 0)
- goto out;
+ do {
+ if ((fd = open(buf, O_NOCTTY|O_RDONLY)) >= 0)
+ break;
+ if (!mnt || (errno != ENOENT))
+ goto out;
+ if (mount("proc", "/proc", "proc", 0, NULL) < 0)
+ error ("underrpm() can not mount /proc: %s\n", strerror(errno));
+ mnt = false;
+ } while (1);
memset(buf, '\0', sizeof(buf));
if ((len = read(fd , buf, sizeof(buf)-1)) < 0)
@@ -2185,6 +2215,8 @@
out:
if (fd >= 0)
close(fd);
+ if (!mnt)
+ umount("/proc");
return ret;
}
@@ -2238,6 +2270,7 @@
boolean del = false;
boolean defaults = false;
boolean ignore = false;
+ boolean loadarg = false;
myname = basename(*argv);
@@ -2305,7 +2338,9 @@
argv += optind;
argc -= optind;
- if (!argc && del)
+ if (argc)
+ loadarg = true;
+ else if (del)
error("usage: %s [[-r] init_script|init_directory]\n", myname);
if (*argv) {
@@ -2357,7 +2392,19 @@
if (strcmp(path, INITDIR) != 0) {
char * tmp;
- root = xstrdup(path);
+ if (*path != '/') {
+ char * pwd = getcwd((char*)0, 0);
+ size_t len = strlen(pwd)+1+strlen(path);
+ root = (char*)malloc(len);
+ if (!root)
+ error("%s", strerror(errno));
+ strcpy(root, pwd);
+ if (pwd[1])
+ strcat(root, "/");
+ strcat(root, path);
+ free(pwd);
+ } else
+ root = xstrdup(path);
if ((tmp = strstr(root, INITDIR))) {
*tmp = '\0';
} else {
@@ -2405,7 +2452,7 @@
scan_conf(insconf);
/*
- * Expand system facilities to real serivces
+ * Expand system facilities to real services
*/
expand_conf();
@@ -2490,17 +2537,45 @@
/*
* Scan now all scripts found in the init.d/ directory
*/
- while ((d = readdir(initdir)) != (struct dirent*)0) {
- const boolean isarg = chkfor(d->d_name, argv, argc);
+ for (;;) {
service_t * service = (service_t*)0;
char * token;
char * begin = (char*)0; /* hold start pointer of strings handled by strsep() */
boolean hard = false;
+ boolean isarg = false;
uchar lsb = 0;
#if defined(DEBUG) && (DEBUG > 0)
int nobug = 0;
#endif
+ if ((d = readdir(initdir)) == (struct dirent*)0) {
+ /*
+ * If first script in argument list was loaded in advance, then
+ * rewind the init.d/ directory stream and attempt to load all
+ * other scripts.
+ */
+ if (loadarg) {
+ loadarg = false;
+ rewinddir(initdir);
+ continue;
+ }
+ break;
+ }
+
+ isarg = chkfor(d->d_name, argv, argc);
+
+ /*
+ * Load first script in argument list before all other scripts. This
+ * avoids problems with loading scripts in underterministic sequence
+ * returned by readdir(3).
+ */
+ if (loadarg && !isarg)
+ continue;
+ if (loadarg && isarg && (curr_argc != 0))
+ continue;
+ if (!loadarg && isarg && (curr_argc == 0))
+ continue;
+
if (*d->d_name == '.')
continue;
errno = 0;
@@ -2807,6 +2882,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) {
@@ -2985,16 +3063,17 @@
char * ptr = argr[curr_argc];
struct _mark {
const char * wrd;
+ const boolean sk;
char * order;
char ** str;
} mark[] = {
- {"start=", (char*)0, &script_inf.default_start},
- {"stop=", (char*)0, &script_inf.default_stop },
+ {"start=", true, (char*)0, &script_inf.default_start},
+ {"stop=", false, (char*)0, &script_inf.default_stop },
#if 0
- {"reqstart=", (char*)0, &script_inf.required_start},
- {"reqstop=", (char*)0, &script_inf.required_stop },
+ {"reqstart=", false, (char*)0, &script_inf.required_start},
+ {"reqstop=", false, (char*)0, &script_inf.required_stop },
#endif
- {(char*)0, (char*)0, (char**)0}
+ {(char*)0, false, (char*)0, (char**)0}
};
for (c = 0; mark[c].wrd; c++) {
@@ -3016,6 +3095,14 @@
char * ptr = mark[c].order + len - 1;
if (*ptr == ',') *ptr = '\0';
}
+ if (ignore) {
+ service_t *arg = findservice(getprovides(d->d_name));
+ arg = getorig(arg);
+ if (mark[c].sk)
+ arg->start->lvl = 0;
+ else
+ arg->stopp->lvl = 0;
+ }
xreset(*(mark[c].str));
*(mark[c].str) = xstrdup(mark[c].order);
}
@@ -3094,6 +3181,11 @@
nonlsb_script();
/*
+ * Handle the `$all' scripts
+ */
+ all_script();
+
+ /*
* Now generate for all scripts the dependencies
*/
follow_all();
@@ -3107,11 +3199,6 @@
active_script();
/*
- * Move the `$all' scripts to the end of all
- */
- all_script();
-
- /*
* Sorry but we support only [KS][0-9][0-9]<name>
*/
if (maxstart > MAX_DEEP || maxstop > MAX_DEEP)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/insserv-1.12.0/listing.c new/insserv-1.13.0/listing.c
--- old/insserv-1.12.0/listing.c 2008-07-03 18:14:27.000000000 +0200
+++ new/insserv-1.13.0/listing.c 2009-08-19 11:56:31.000000000 +0200
@@ -317,6 +317,7 @@
}
for (tmp = dir; tmp; tmp = getnextlink(l_list)) {
+ const typeof(attof(tmp)->flags) sflags = attof(tmp)->flags;
register boolean recursion = true;
handle_t * ptmp = (mode == 'K') ? &tmp->stopp : &tmp->start;
uchar * order = &ptmp->deep;
@@ -364,6 +365,7 @@
* Do not count the dependcy deep of the system facilities
* but follow them to count the replacing provides.
*/
+
if (*ptmp->name == '$')
warn("System facilities not fully expanded, see %s!\n", dir->name);
else if (++deep > MAX_DEEP) {
@@ -381,6 +383,7 @@
np_list_for_each(dent, l_list) {
dir_t * target = getlink(dent)->target;
handle_t * ptrg = (mode == 'K') ? &target->stopp : &target->start;
+ const typeof(attof(target)->flags) kflags = attof(target)->flags;
if ((peg->run.lvl & ptrg->run.lvl) == 0)
continue; /* Not same boot level */
@@ -398,6 +401,20 @@
break; /* Loop detected, stop recursion */
}
+ if (mode == 'K') {
+ if (kflags & SERV_FIRST) {
+ warn("Stopping %s depends on %s and therefore on system facility `$all' which can not be true!\n",
+ tmp->script ? tmp->script : tmp->name, target->script ? target->script : target->name);
+ continue;
+ }
+ } else {
+ if (sflags & SERV_ALL) {
+ warn("Starting %s depends on %s and therefore on system facility `$all' which can not be true!\n",
+ target->script ? target->script : target->name, tmp->script ? tmp->script : tmp->name);
+ continue;
+ }
+ }
+
if (ptrg->deep >= deep) /* Nothing new */
continue;
/* The inner recursion */
@@ -841,7 +858,7 @@
list_for_each(tmp, d_start) {
maxorder = &maxstart;
guess_order(getdir(tmp), 'S');
- maxorder = &maxstart;
+ maxorder = &maxstop;
guess_order(getdir(tmp), 'K');
}
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/insserv-1.12.0/listing.h new/insserv-1.13.0/listing.h
--- old/insserv-1.12.0/listing.h 2008-07-29 14:25:56.000000000 +0200
+++ new/insserv-1.13.0/listing.h 2009-08-18 14:17:32.000000000 +0200
@@ -92,7 +92,7 @@
#endif
#define __packed attribute((packed))
-#define alignof(type) (sizeof(type)+(sizeof(type)%sizeof(void*)))
+#define alignof(type) ((sizeof(type)+(sizeof(void*)-1)) & ~(sizeof(void*)-1))
#define strsize(string) ((strlen(string)+1)*sizeof(char))
typedef struct list_struct {
@@ -368,6 +368,7 @@
#define SERV_SCRIPT 0x0080
#define SERV_NOSTOP 0x0100
#define SERV_CMDLINE 0x0200
+#define SERV_FIRST 0x0400
/*
* Bits of the runlevels
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/insserv-1.12.0/tests/suite new/insserv-1.13.0/tests/suite
--- old/insserv-1.12.0/tests/suite 2008-07-22 14:07:09.000000000 +0200
+++ new/insserv-1.13.0/tests/suite 2009-08-17 14:55:22.000000000 +0200
@@ -79,6 +79,22 @@
$time hwclock
<interactive> udev mountdevsubfs checkroot checkfs console-screen
EOF
+ update_conf ()
+ {
+ set +C
+ cat <<-'EOF' > $insconf
+ $local_fs +mountall +umountfs
+ $network +networking +ifupdown
+ $named +named +dnsmasq +lwresd +bind9 $network
+ $remote_fs $local_fs +mountnfs +mountnfs-bootclean +umountnfs +sendsigs
+ $syslog +syslog +sysklogd
+ $portmap portmap
+ $time hwclock
+ <interactive> udev mountdevsubfs checkroot checkfs console-screen
+ EOF
+ set -C
+ }
+
fi
chmod u+w,a+r $insconf
@@ -94,6 +110,12 @@
$insserv $debug -c $insconf -p $initddir -o $overridedir -r $script
}
+initdir_purge ()
+{
+ rm -rf ${initddir}/../rc*.d ${initddir}
+ mkdir -p ${initddir}
+}
+
relpath ()
{
local OLDIFS IFS
@@ -201,6 +223,13 @@
chmod u+w,a+rx $script
}
+remscript ()
+{
+ local scriptname=$1
+ local script=${initddir}/$scriptname
+ rm -f $script
+}
+
insertscript ()
{
local scriptname=$1
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org