1 Patch from upstream making $all work for stop sequences, placing
2 scripts first in the stop sequence. This patch invalidates
3 60_all_keyword_start_only.patch
7 Index: insserv/insserv.c
8 ===================================================================
9 --- insserv.orig/insserv.c 2009-09-26 22:35:39.000000000 +0200
10 +++ insserv/insserv.c 2009-09-26 22:35:39.000000000 +0200
14 if (strcasecmp(token, "$all") == 0) {
15 - serv->attr.flags |= SERV_ALL;
17 + serv->attr.flags |= SERV_FIRST;
19 + serv->attr.flags |= SERV_ALL;
22 /* Expand the `$' token recursively down */
27 - * Last but not least the `$all' scripts will be set to the
28 - * end of the current start order.
29 + * The `$all' scripts will be set to the end of the current start order.
31 static inline void all_script(void) attribute((always_inline));
32 static inline void all_script(void)
37 + * Last but not least the `$all' scripts will be set to the
38 + * beginning of the current stop order.
40 +static inline void first_script(void) attribute((always_inline));
41 +static inline void first_script(void)
45 + list_for_each(pos, s_start) {
46 + service_t * serv = getservice(pos);
49 + if (serv->attr.flags & SERV_DUPLET)
50 + continue; /* Duplet */
52 + if (!(serv->attr.flags & SERV_FIRST))
55 + if (serv->attr.script == (char*)0)
58 + list_for_each(tmp, s_start) {
59 + service_t * cur = getservice(tmp);
61 + if (cur->attr.flags & SERV_DUPLET)
62 + continue; /* Duplet */
64 + if ((serv->start->lvl & cur->start->lvl) == 0)
70 + if (cur->attr.flags & SERV_FIRST)
73 + rememberreq(serv, REQ_SHLD|REQ_KILL, cur->name);
76 + setorder(serv->attr.script, 'K', 1, false);
81 * Make the dependency files
83 static inline void makedep(void) attribute((always_inline));
84 @@ -3274,6 +3320,11 @@
88 + * Move the `$all' stop scripts to the very beginning
93 * Now generate for all scripts the dependencies
96 Index: insserv/listing.c
97 ===================================================================
98 --- insserv.orig/listing.c 2009-09-26 22:35:39.000000000 +0200
99 +++ insserv/listing.c 2009-09-26 22:35:39.000000000 +0200
103 for (tmp = dir; tmp; tmp = getnextlink(l_list)) {
104 + const typeof(attof(tmp)->flags) sflags = attof(tmp)->flags;
105 register boolean recursion = true;
106 handle_t * ptmp = (mode == 'K') ? &tmp->stopp : &tmp->start;
107 uchar * order = &ptmp->deep;
109 np_list_for_each(dent, l_list) {
110 dir_t * target = getlink(dent)->target;
111 handle_t * ptrg = (mode == 'K') ? &target->stopp : &target->start;
112 + const typeof(attof(target)->flags) kflags = attof(target)->flags;
114 if ((peg->run.lvl & ptrg->run.lvl) == 0)
115 continue; /* Not same boot level */
116 @@ -398,10 +400,18 @@
117 break; /* Loop detected, stop recursion */
120 - if ((mode == 'S') && (attof(tmp)->flags & SERV_ALL)) {
121 - warn("%s depends on %s and therefore on system facility `$all' which can not be true!\n",
122 - target->script ? target->script : target->name, tmp->script ? tmp->script : tmp->name);
125 + if (kflags & SERV_FIRST) {
126 + warn("Stopping %s depends on %s and therefore on system facility `$all' which can not be true!\n",
127 + tmp->script ? tmp->script : tmp->name, target->script ? target->script : target->name);
131 + if (sflags & SERV_ALL) {
132 + warn("Starting %s depends on %s and therefore on system facility `$all' which can not be true!\n",
133 + target->script ? target->script : target->name, tmp->script ? tmp->script : tmp->name);
138 if (ptrg->deep >= deep) /* Nothing new */
140 list_for_each(tmp, d_start) {
141 maxorder = &maxstart;
142 guess_order(getdir(tmp), 'S');
143 - maxorder = &maxstart;
144 + maxorder = &maxstop;
145 guess_order(getdir(tmp), 'K');
148 Index: insserv/listing.h
149 ===================================================================
150 --- insserv.orig/listing.h 2009-09-26 22:35:39.000000000 +0200
151 +++ insserv/listing.h 2009-09-26 22:35:39.000000000 +0200
153 #define SERV_SCRIPT 0x0080
154 #define SERV_NOSTOP 0x0100
155 #define SERV_CMDLINE 0x0200
156 +#define SERV_FIRST 0x0400
159 * Bits of the runlevels