aboutsummaryrefslogtreecommitdiff
path: root/src/sysvinit.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sysvinit.c')
-rw-r--r--src/sysvinit.c60
1 files changed, 54 insertions, 6 deletions
diff --git a/src/sysvinit.c b/src/sysvinit.c
index be7aef8..337b922 100644
--- a/src/sysvinit.c
+++ b/src/sysvinit.c
@@ -238,11 +238,14 @@ enablecomp (struct prog *prog, void *data)
case pies_comp_boot:
case pies_comp_bootwait:
return 0;
+
+ case pies_comp_ondemand:
+ return prog->v.p.status == status_enabled;
+
case pies_comp_powerfail:
case pies_comp_powerwait:
case pies_comp_powerokwait:
case pies_comp_ctrlaltdel:
- case pies_comp_ondemand:
case pies_comp_powerfailnow:
case pies_comp_kbrequest:
return s && (s->mask & PIES_COMP_MASK (comp->mode));
@@ -301,6 +304,27 @@ sysvinit_runlevel_setup (int mask, int *wait)
*wait = s.wait;
}
+static int
+demand_prog (struct prog *prog, void *data)
+{
+ int *rl = data;
+ struct component *comp = prog->v.p.comp;
+ if (comp->mode == pies_comp_ondemand
+ && comp->runlevels
+ && strchr (comp->runlevels, *rl))
+ {
+ prog->v.p.status = status_enabled;
+ debug (1, ("%s: %s", prog_tag (prog), "enabled"));
+ }
+ return 0;
+}
+
+static void
+sysvinit_demand (int rl)
+{
+ progman_foreach (demand_prog, &rl);
+}
+
static const char valid_runlevel_arg[] = "0123456789SsQqAaBbCcUu";
int
@@ -458,10 +482,23 @@ sysvinit_fifo_handler (int fd, void *data)
default:
if (buf.req.runlevel != runlevel)
{
+ switch (buf.req.runlevel)
+ {
+ case 'A':
+ case 'B':
+ case 'C':
+ sysvinit_demand (buf.req.runlevel);
+ break;
+
+ default:
+ if (runlevel_index (buf.req.runlevel) != -1)
+ {
dfl_level = buf.req.runlevel;
inittrans ();
}
}
+ }
+ }
break;
case INIT_CMD_SETENV:
@@ -846,6 +883,15 @@ find_action_parser (const char *action)
return NULL;
}
+static char *
+strupr (char *s)
+{
+ char *p;
+ for (p = s; *p; p++)
+ *p = toupper (*p);
+ return s;
+}
+
int
inittab_parse (const char *file)
{
@@ -931,8 +977,7 @@ inittab_parse (const char *file)
if (!id || !runlevels || !action || !process)
{
- logmsg (LOG_ERR, "%s:%u: %s",
- file, line_no, _("not enough fields"));
+ logmsg (LOG_ERR, "%s:%u: %s", file, line_no, _("not enough fields"));
err = 1;
continue;
}
@@ -950,18 +995,21 @@ inittab_parse (const char *file)
continue;
}
+ if (strcmp (action, "off") == 0)
+ /* Ignore the entry */
+ continue;
+
ap = find_action_parser (action);
if (!ap)
{
- logmsg (LOG_ERR, "%s:%u: %s",
- file, line_no, _("unknown action"));
+ logmsg (LOG_ERR, "%s:%u: %s", file, line_no, _("unknown action"));
err = 1;
continue;
}
comp = component_create (id);
comp->mode = ap->mode;
- comp->runlevels = grecs_strdup (runlevels);
+ comp->runlevels = grecs_strdup (strupr (runlevels));
if (wordsplit (process, &ws, WRDSF_DEFFLAGS))
{

Return to:

Send suggestions and report system problems to the System administrator.