0 | |
Description: New feature: remove a service from all runlevels
|
1 | |
Author: Benda Xu <heroxbd@gentoo.org>
|
2 | |
Forwarded: https://bugs.gentoo.org/show_bug.cgi?id=497740
|
3 | |
Last-Update: 2014-01-12
|
4 | |
|
5 | |
--- a/src/rc/rc-update.c
|
6 | |
+++ b/src/rc/rc-update.c
|
7 | |
@@ -199,13 +199,15 @@
|
8 | |
"Usage: rc-update [options] add <service> [<runlevel>...]\n" \
|
9 | |
" or: rc-update [options] del <service> [<runlevel>...]\n" \
|
10 | |
" or: rc-update [options] [show [<runlevel>...]]"
|
11 | |
-#define getoptstring "su" getoptstring_COMMON
|
12 | |
+#define getoptstring "asu" getoptstring_COMMON
|
13 | |
static const struct option longopts[] = {
|
14 | |
+ { "all", 0, NULL, 'a' },
|
15 | |
{ "stack", 0, NULL, 's' },
|
16 | |
{ "update", 0, NULL, 'u' },
|
17 | |
longopts_COMMON
|
18 | |
};
|
19 | |
static const char * const longopts_help[] = {
|
20 | |
+ "Operate on all the runlevels",
|
21 | |
"Stack a runlevel instead of a service",
|
22 | |
"Force an update of the dependency tree",
|
23 | |
longopts_help_COMMON
|
24 | |
@@ -225,7 +227,7 @@
|
25 | |
char *service = NULL;
|
26 | |
char *p;
|
27 | |
int action = 0;
|
28 | |
- bool verbose = false, stack = false;
|
29 | |
+ bool verbose = false, stack = false, all_runlevels = false;
|
30 | |
int opt;
|
31 | |
int retval = EXIT_FAILURE;
|
32 | |
int num_updated = 0;
|
33 | |
@@ -238,6 +240,9 @@
|
34 | |
case 's':
|
35 | |
stack = true;
|
36 | |
break;
|
37 | |
+ case 'a':
|
38 | |
+ all_runlevels = true;
|
39 | |
+ break;
|
40 | |
case 'u':
|
41 | |
deptree = _rc_deptree_load(-1, &ret);
|
42 | |
if (deptree)
|
43 | |
@@ -315,9 +320,14 @@
|
44 | |
}
|
45 | |
|
46 | |
if (!TAILQ_FIRST(runlevels)) {
|
47 | |
- p = rc_runlevel_get();
|
48 | |
- rc_stringlist_add(runlevels, p);
|
49 | |
- free(p);
|
50 | |
+ if (all_runlevels) {
|
51 | |
+ free(runlevels);
|
52 | |
+ runlevels = rc_runlevel_list();
|
53 | |
+ } else {
|
54 | |
+ p = rc_runlevel_get();
|
55 | |
+ rc_stringlist_add(runlevels, p);
|
56 | |
+ free(p);
|
57 | |
+ }
|
58 | |
}
|
59 | |
|
60 | |
if (!TAILQ_FIRST(runlevels)) {
|
61 | |
--- a/man/rc-update.8
|
62 | |
+++ b/man/rc-update.8
|
63 | |
@@ -21,7 +21,7 @@
|
64 | |
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
65 | |
.\" SUCH DAMAGE.
|
66 | |
.\"
|
67 | |
-.Dd May 2, 2009
|
68 | |
+.Dd Jan 13, 2014
|
69 | |
.Dt RC-UPDATE 8 SMM
|
70 | |
.Os OpenRC
|
71 | |
.Sh NAME
|
72 | |
@@ -30,11 +30,13 @@
|
73 | |
.Sh SYNOPSIS
|
74 | |
.Nm
|
75 | |
.Op Fl s , -stack
|
76 | |
+.Op Fl a , -all
|
77 | |
.Ar add
|
78 | |
.Ar service
|
79 | |
.Op Ar runlevel ...
|
80 | |
.Nm
|
81 | |
.Op Fl s , -stack
|
82 | |
+.Op Fl a , -all
|
83 | |
.Ar delete
|
84 | |
.Ar service
|
85 | |
.Op Ar runlevel ...
|
86 | |
@@ -86,9 +88,18 @@
|
87 | |
.Fl s , -stack
|
88 | |
option is given then we either add or remove the runlevel from the runlevel.
|
89 | |
This allows inheritance of runlevels.
|
90 | |
+
|
91 | |
+If the
|
92 | |
+.Fl a, -all
|
93 | |
+option is given and no runlevel is specified, we either add (not much
|
94 | |
+use though) or remove the service from all the runlevels. If a
|
95 | |
+runlevel is specified, it takes no effect. It is useful when a service
|
96 | |
+is removed and the dangling symlinks in the runlevels should be
|
97 | |
+cleaned up.
|
98 | |
.Sh SEE ALSO
|
99 | |
.Xr openrc 8 ,
|
100 | |
.Xr openrc-run 8 ,
|
101 | |
.Xr rc-status 8
|
102 | |
.Sh AUTHORS
|
103 | |
.An Roy Marples <roy@marples.name>
|
104 | |
+.An The OpenRC Team <openrc@gentoo.org>
|