We should not use options for rc-update, as add, delete and such are commands.
This commit is contained in:
parent
a1783d552d
commit
38f8eee495
@ -1,4 +1,4 @@
|
|||||||
.\" Copyright 2007 Roy Marples
|
.\" Copyright 2007-2008 Roy Marples
|
||||||
.\" All rights reserved
|
.\" All rights reserved
|
||||||
.\"
|
.\"
|
||||||
.\" Redistribution and use in source and binary forms, with or without
|
.\" Redistribution and use in source and binary forms, with or without
|
||||||
@ -22,7 +22,7 @@
|
|||||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
.\" SUCH DAMAGE.
|
.\" SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.Dd Dec 15, 2007
|
.Dd Jan 15, 2008
|
||||||
.Dt RC-UPDATE 8 SMM
|
.Dt RC-UPDATE 8 SMM
|
||||||
.Os OpenRC
|
.Os OpenRC
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -30,16 +30,16 @@
|
|||||||
.Nd add and remove services to and from a runlevel
|
.Nd add and remove services to and from a runlevel
|
||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
.Nm
|
.Nm
|
||||||
.Fl a , -add
|
.Ar add
|
||||||
.Ar service
|
.Ar service
|
||||||
.Op Ar runlevel ...
|
.Op Ar runlevel ...
|
||||||
.Nm
|
.Nm
|
||||||
.Fl d , -delete
|
.Ar delete
|
||||||
.Ar service
|
.Ar service
|
||||||
.Op Ar runlevel ...
|
.Op Ar runlevel ...
|
||||||
.Nm
|
.Nm
|
||||||
.Fl s , -show
|
|
||||||
.Op Fl v , -verbose
|
.Op Fl v , -verbose
|
||||||
|
.Ar show
|
||||||
.Op Ar runlevel ...
|
.Op Ar runlevel ...
|
||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
OpenRC uses named runlevels. Rather than editing some obscure
|
OpenRC uses named runlevels. Rather than editing some obscure
|
||||||
@ -61,13 +61,13 @@ to the
|
|||||||
or the current one if none given.
|
or the current one if none given.
|
||||||
Services added to the boot runlevel must exist in
|
Services added to the boot runlevel must exist in
|
||||||
.Pa /etc/init.d .
|
.Pa /etc/init.d .
|
||||||
.It Fl d , -delete Ar service
|
.It Ar delete Ar service
|
||||||
Delete the
|
Delete the
|
||||||
.Ar service
|
.Ar service
|
||||||
from the
|
from the
|
||||||
.Ar runlevel
|
.Ar runlevel
|
||||||
or the current one if none given.
|
or the current one if none given.
|
||||||
.It Fl s , -show
|
.It Ar show
|
||||||
Show all enabled services and the runlevels they belong to. If you specify
|
Show all enabled services and the runlevels they belong to. If you specify
|
||||||
runlevels to show, then only those will be included in the output.
|
runlevels to show, then only those will be included in the output.
|
||||||
.It Fl v , -verbose
|
.It Fl v , -verbose
|
||||||
|
@ -30,7 +30,11 @@ static void usage (int exit_status)
|
|||||||
const char * const has_arg[] = { "", "<arg>", "[arg]" };
|
const char * const has_arg[] = { "", "<arg>", "[arg]" };
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
#ifdef usagestring
|
||||||
|
printf (usagestring);
|
||||||
|
#else
|
||||||
printf ("Usage: %s [options] ", applet);
|
printf ("Usage: %s [options] ", applet);
|
||||||
|
#endif
|
||||||
#ifdef extraopts
|
#ifdef extraopts
|
||||||
printf (extraopts);
|
printf (extraopts);
|
||||||
#endif
|
#endif
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2007 Roy Marples
|
* Copyright 2007-2008 Roy Marples
|
||||||
* All rights reserved
|
* All rights reserved
|
||||||
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -129,17 +129,15 @@ static void show (char **runlevels, bool verbose)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#include "_usage.h"
|
#include "_usage.h"
|
||||||
#define getoptstring "ads" getoptstring_COMMON
|
#define usagestring "" \
|
||||||
|
"Usage: rc-update [options] service <runlevel>\n" \
|
||||||
|
" rc-update [options] del service <runlevel>\n" \
|
||||||
|
" rc-update [options] show"
|
||||||
|
#define getoptstring getoptstring_COMMON
|
||||||
static struct option longopts[] = {
|
static struct option longopts[] = {
|
||||||
{ "add", 0, NULL, 'a'},
|
|
||||||
{ "delete", 0, NULL, 'd'},
|
|
||||||
{ "show", 0, NULL, 's'},
|
|
||||||
longopts_COMMON
|
longopts_COMMON
|
||||||
};
|
};
|
||||||
static const char * const longopts_help[] = {
|
static const char * const longopts_help[] = {
|
||||||
"Add the init.d to runlevels",
|
|
||||||
"Delete init.d from runlevels",
|
|
||||||
"Show init.d's in runlevels",
|
|
||||||
longopts_help_COMMON
|
longopts_help_COMMON
|
||||||
};
|
};
|
||||||
#include "_usage.c"
|
#include "_usage.c"
|
||||||
@ -165,17 +163,7 @@ int rc_update (int argc, char **argv)
|
|||||||
longopts, (int *) 0)) != -1)
|
longopts, (int *) 0)) != -1)
|
||||||
{
|
{
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case 'a':
|
case_RC_COMMON_GETOPT
|
||||||
action |= DOADD;
|
|
||||||
break;
|
|
||||||
case 'd':
|
|
||||||
action |= DODELETE;
|
|
||||||
break;
|
|
||||||
case 's':
|
|
||||||
action |= DOSHOW;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case_RC_COMMON_GETOPT
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -187,23 +175,21 @@ int rc_update (int argc, char **argv)
|
|||||||
eerrorx ("%s: cannot mix commands", applet);
|
eerrorx ("%s: cannot mix commands", applet);
|
||||||
|
|
||||||
/* We need to be backwards compatible */
|
/* We need to be backwards compatible */
|
||||||
if (! action) {
|
if (optind < argc) {
|
||||||
if (optind < argc) {
|
if (strcmp (argv[optind], "add") == 0)
|
||||||
if (strcmp (argv[optind], "add") == 0)
|
action = DOADD;
|
||||||
action = DOADD;
|
else if (strcmp (argv[optind], "delete") == 0 ||
|
||||||
else if (strcmp (argv[optind], "delete") == 0 ||
|
strcmp (argv[optind], "del") == 0)
|
||||||
strcmp (argv[optind], "del") == 0)
|
action = DODELETE;
|
||||||
action = DODELETE;
|
else if (strcmp (argv[optind], "show") == 0)
|
||||||
else if (strcmp (argv[optind], "show") == 0)
|
action = DOSHOW;
|
||||||
action = DOSHOW;
|
if (action)
|
||||||
if (action)
|
optind++;
|
||||||
optind++;
|
else
|
||||||
else
|
eerrorx ("%s: invalid command `%s'", applet, argv[optind]);
|
||||||
eerrorx ("%s: invalid command `%s'", applet, argv[optind]);
|
|
||||||
}
|
|
||||||
if (! action)
|
|
||||||
usage (EXIT_FAILURE);
|
|
||||||
}
|
}
|
||||||
|
if (! action)
|
||||||
|
action = DOSHOW;
|
||||||
|
|
||||||
if (optind >= argc) {
|
if (optind >= argc) {
|
||||||
if (! action & DOSHOW)
|
if (! action & DOSHOW)
|
||||||
|
Loading…
Reference in New Issue
Block a user