Undocument pause action, fix --nodeps and --ifstarted, #190045.

This commit is contained in:
Roy Marples 2007-08-28 13:06:44 +00:00
parent 849b983c3f
commit 144d9653e1
5 changed files with 35 additions and 24 deletions

View File

@ -3,6 +3,7 @@
28 Aug 2007; Roy Marples <uberlord@gentoo.org>:
Undocument pause action, fix --nodeps and --ifstarted, #190045.
Fix ksoftlevel handling, #190420.
26 Aug 2007; Mike Frysinger <vapier@gentoo.org>:

View File

@ -75,7 +75,8 @@ RC_FORCE_AUTO="no"
#RC_ULIMIT="-u 30"
# It's possible to define extra dependencies for services like so
#RC_CONFIG="/etc/foo"
#RC_NEED="openvpn"
#RC_USE="net.eth0"
#RC_AFTER="clock"
#RC_BEFORE="local"

View File

@ -32,7 +32,7 @@ else
NL=
fi
default_opts="describe start stop restart pause zap"
default_opts="describe start stop restart zap"
extra_opts="$(. "${myscript}" 2>/dev/null ; echo "${opts}")"
if [ "${BE_VERBOSE}" = "yes" ] ; then

View File

@ -977,8 +977,11 @@ int main (int argc, char **argv)
strcmp (PREVLEVEL, "S") == 0 ||
strcmp (PREVLEVEL, "N") == 0))
{
if (get_ksoftlevel (ksoftbuffer, sizeof (ksoftbuffer)))
newlevel = ksoftbuffer;
/* Try not to join boot and ksoftlevels together */
if (! newlevel ||
strcmp (newlevel, getenv ("RC_BOOTLEVEL")) != 0)
if (get_ksoftlevel (ksoftbuffer, sizeof (ksoftbuffer)))
newlevel = ksoftbuffer;
} else if (! RUNLEVEL ||
(strcmp (RUNLEVEL, "1") != 0 &&
strcmp (RUNLEVEL, "S") != 0 &&

View File

@ -830,7 +830,7 @@ static void svc_stop (bool deps)
rc_service_in_runlevel (service, RC_LEVEL_BOOT))
ewarn ("WARNING: you are stopping a boot service");
if (deps || ! rc_service_state (service, rc_service_wasinactive)) {
if (deps && ! rc_service_state (service, rc_service_wasinactive)) {
int depoptions = RC_DEP_TRACE;
char *svc;
int i;
@ -977,18 +977,18 @@ static void svc_restart (bool deps)
restart_services = NULL;
}
#define getoptstring "dCDNqvh"
#include "_usage.h"
#define getoptstring "dDqsv" getoptstring_COMMON
static struct option longopts[] = {
{ "debug", 0, NULL, 'd'},
{ "nocolor", 0, NULL, 'C'},
{ "nocolour", 0, NULL, 'C'},
{ "ifstarted", 0, NULL, 's'},
{ "nodeps", 0, NULL, 'D'},
{ "quiet", 0, NULL, 'q'},
{ "verbose", 0, NULL, 'v'},
{ "help", 0, NULL, 'h'},
longopts_COMMON
{ NULL, 0, NULL, 0}
};
// #include "_usage.c"
#include "_usage.c"
int runscript (int argc, char **argv)
{
@ -1124,6 +1124,10 @@ int runscript (int argc, char **argv)
execl (RCSCRIPT_HELP, RCSCRIPT_HELP, service, (char *) NULL);
eerrorx ("%s: failed to exec `" RCSCRIPT_HELP "': %s",
applet, strerror (errno));
case 's':
if (! rc_service_state (service, rc_service_started))
exit (EXIT_FAILURE);
break;
case 'C':
setenv ("RC_NOCOLOR", "yes", 1);
break;
@ -1137,7 +1141,7 @@ int runscript (int argc, char **argv)
setenv ("RC_VERBOSE", "yes", 1);
break;
default:
exit (EXIT_FAILURE);
usage (EXIT_FAILURE);
}
/* Save the IN_BACKGROUND env flag so it's ONLY passed to the service
@ -1240,23 +1244,25 @@ int runscript (int argc, char **argv)
} else if (strcmp (optarg, "start") == 0) {
svc_start (deps);
} else if (strcmp (optarg, "stop") == 0) {
if (in_background)
if (deps && in_background)
get_started_services ();
svc_stop (deps);
if (! in_background &&
! rc_runlevel_stopping () &&
rc_service_state (service, rc_service_stopped))
uncoldplug ();
if (deps) {
if (! in_background &&
! rc_runlevel_stopping () &&
rc_service_state (service, rc_service_stopped))
uncoldplug ();
if (in_background &&
rc_service_state (service, rc_service_inactive))
{
int j;
STRLIST_FOREACH (restart_services, svc, j)
if (rc_service_state (svc, rc_service_stopped))
rc_schedule_start_service (service, svc);
if (in_background &&
rc_service_state (service, rc_service_inactive))
{
int j;
STRLIST_FOREACH (restart_services, svc, j)
if (rc_service_state (svc, rc_service_stopped))
rc_schedule_start_service (service, svc);
}
}
} else if (strcmp (optarg, "zap") == 0) {
einfo ("Manually resetting %s to stopped state", applet);