aboutsummaryrefslogtreecommitdiffstats
path: root/main/openrc/0006-rc-pull-in-sysinit-and-boot-as-stacked-levels-when-n.patch
blob: b31d7b34d5ff9ef33cbe2ffb789d8f8f41baa63d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
From 284053cf953511fd4c5c2d0da144e623fd92cdb7 Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Wed, 17 Aug 2016 17:19:20 +0200
Subject: [PATCH 6/7] rc: pull in sysinit and boot as stacked levels when
 needed

We need start services from sysinit and boot runlevel, even if the new
runlevel is empty.

This fixes problem introduced with commit 7716bf31 (Fix stacked runlevel
support), at which the start_services list are no longer used to start
the services.

This also make sure that all services in sysinit and boot runlevels are
started before switching to next. This was not guaranteed when switching
to a non-empty runlevel.

Fixes issue #54.
---
 src/rc/rc.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/rc/rc.c b/src/rc/rc.c
index ed06bf7..a9cfd11 100644
--- a/src/rc/rc.c
+++ b/src/rc/rc.c
@@ -741,6 +741,7 @@ int main(int argc, char **argv)
 	static RC_STRINGLIST *types_nw;
 	static RC_STRINGLIST *types_nwua;
 	static RC_DEPTREE *deptree;
+	RC_STRINGLIST *runlevel_chain;
 	RC_STRINGLIST *deporder = NULL;
 	RC_STRINGLIST *tmplist;
 	RC_STRING *service;
@@ -996,6 +997,7 @@ int main(int argc, char **argv)
 	hotplugged_services = rc_services_in_state(RC_SERVICE_HOTPLUGGED);
 	start_services = rc_services_in_runlevel_stacked(newlevel ?
 	    newlevel : runlevel);
+	runlevel_chain = rc_runlevel_stacks(newlevel ? newlevel : runlevel);
 	if (strcmp(newlevel ? newlevel : runlevel, RC_LEVEL_SHUTDOWN) != 0 &&
 	    strcmp(newlevel ? newlevel : runlevel, RC_LEVEL_SYSINIT) != 0)
 	{
@@ -1013,6 +1015,7 @@ int main(int argc, char **argv)
 				tmplist = rc_services_in_runlevel(bootlevel);
 				TAILQ_CONCAT(start_services, tmplist, entries);
 				free(tmplist);
+				rc_stringlist_add(runlevel_chain, bootlevel);
 			}
 			if (hotplugged_services) {
 				TAILQ_FOREACH(service, hotplugged_services,
@@ -1021,6 +1024,7 @@ int main(int argc, char **argv)
 					service->value);
 			}
 		}
+		rc_stringlist_add(runlevel_chain, RC_LEVEL_SYSINIT);
 	}
 
 	parallel = rc_conf_yesno("rc_parallel");
@@ -1077,9 +1081,6 @@ int main(int argc, char **argv)
 
 	/* If we have a list of services to start then... */
 	if (start_services) {
-		/* Get a list of the chained runlevels which compose the target runlevel */
-		RC_STRINGLIST *runlevel_chain = rc_runlevel_stacks(runlevel);
-
 		/* Loop through them in reverse order. */
 		RC_STRING *rlevel;
 		TAILQ_FOREACH_REVERSE(rlevel, runlevel_chain, rc_stringlist, entries)
-- 
2.9.3