aboutsummaryrefslogtreecommitdiff
path: root/src/runscript.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/runscript.c')
-rw-r--r--src/runscript.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/runscript.c b/src/runscript.c
index 24512e25..ee32253a 100644
--- a/src/runscript.c
+++ b/src/runscript.c
@@ -824,13 +824,11 @@ int main (int argc, char **argv)
{ "nocolor", 0, NULL, 'C'},
{ "nocolour", 0, NULL, 'C'},
{ "nodeps", 0, NULL, 'D'},
+ { "quiet", 0, NULL, 'q'},
{ "verbose", 0, NULL, 'v'},
{ NULL, 0, NULL, 0}
};
- applet = strdup (basename (service));
- atexit (cleanup);
-
/* Show help if insufficient args */
if (argc < 3) {
execl (RCSCRIPT_HELP, RCSCRIPT_HELP, service, (char *) NULL);
@@ -838,6 +836,9 @@ int main (int argc, char **argv)
applet, strerror (errno));
}
+ applet = strdup (basename (service));
+ atexit (cleanup);
+
#ifdef __linux__
/* coldplug events can trigger init scripts, but we don't want to run them
until after rc sysinit has completed so we punt them to the boot runlevel */
@@ -911,19 +912,15 @@ int main (int argc, char **argv)
free (eb);
}
- /* Save the IN_BACKGROUND env flag so it's ONLY passed to the service
- that is being called and not any dependents */
- if (getenv ("IN_BACKGROUND")) {
- in_background = rc_is_env ("IN_BACKGROUND", "true");
- ibsave = strdup (getenv ("IN_BACKGROUND"));
- unsetenv ("IN_BACKGROUND");
- }
-
#ifdef __linux__
/* Ok, we are ready to go, so setup selinux if applicable */
setup_selinux (argc, argv);
#endif
+ /* Punt the first arg as it's our service name */
+ argc--;
+ argv++;
+
/* Right then, parse any options there may be */
while ((c = getopt_long (argc, argv, "dhCDNqv",
longopts, (int *) 0)) != -1)
@@ -951,6 +948,14 @@ int main (int argc, char **argv)
exit (EXIT_FAILURE);
}
+ /* Save the IN_BACKGROUND env flag so it's ONLY passed to the service
+ that is being called and not any dependents */
+ if (getenv ("IN_BACKGROUND")) {
+ in_background = rc_is_env ("IN_BACKGROUND", "true");
+ ibsave = strdup (getenv ("IN_BACKGROUND"));
+ unsetenv ("IN_BACKGROUND");
+ }
+
if (rc_is_env ("IN_HOTPLUG", "1")) {
if (! rc_is_env ("RC_HOTPLUG", "yes") || ! rc_allow_plug (applet))
eerrorx ("%s: not allowed to be hotplugged", applet);