File insserv-1.12.0.dif of Package insserv
--- insserv.8.in
+++ insserv.8.in 2008-08-12 15:03:04.628184000 +0200
@@ -195,7 +195,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 +215,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
@@ -332,6 +344,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 2008-09-12 12:33:05.868217615 +0200
@@ -290,6 +290,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;
@@ -1696,6 +1698,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);
@@ -2238,6 +2245,7 @@ int main (int argc, char *argv[])
boolean del = false;
boolean defaults = false;
boolean ignore = false;
+ boolean loadarg = false;
myname = basename(*argv);
@@ -2305,7 +2313,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 +2367,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 +2512,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;