1 |
commit: 8b9349208696e5caed1a8b34f066cec4ee642194 |
2 |
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com> |
3 |
AuthorDate: Sun Apr 26 18:31:49 2015 +0000 |
4 |
Commit: William Hubbs <williamh <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Apr 27 16:21:29 2015 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=8b934920 |
7 |
|
8 |
convert all references from runscript to openrc-run |
9 |
|
10 |
init.d/sysctl.GNU.in | 2 +- |
11 |
sh/.gitignore | 2 +- |
12 |
sh/Makefile | 4 ++-- |
13 |
sh/{runscript.sh.in => openrc-run.sh.in} | 2 +- |
14 |
sh/rc-functions.sh.in | 2 +- |
15 |
src/librc/librc-daemon.c | 12 ++++++------ |
16 |
src/rc/Makefile | 4 ++-- |
17 |
src/rc/{runscript.c => openrc-run.c} | 21 +++++++++++++-------- |
18 |
src/rc/rc-applets.c | 12 ++++++------ |
19 |
9 files changed, 33 insertions(+), 28 deletions(-) |
20 |
|
21 |
diff --git a/init.d/sysctl.GNU.in b/init.d/sysctl.GNU.in |
22 |
index 7139824..1bc325e 100644 |
23 |
--- a/init.d/sysctl.GNU.in |
24 |
+++ b/init.d/sysctl.GNU.in |
25 |
@@ -1,4 +1,4 @@ |
26 |
-#!@PREFIX@/sbin/runscript |
27 |
+#!@PREFIX@/sbin/openrc-run |
28 |
# Copyright (c) 2007-2009 Roy Marples <roy@×××××××.name> |
29 |
# Released under the 2-clause BSD license. |
30 |
#FIXME: Modify for GNU/Hurd |
31 |
|
32 |
diff --git a/sh/.gitignore b/sh/.gitignore |
33 |
index c83b730..f814f4a 100644 |
34 |
--- a/sh/.gitignore |
35 |
+++ b/sh/.gitignore |
36 |
@@ -1,7 +1,7 @@ |
37 |
functions.sh |
38 |
gendepends.sh |
39 |
rc-functions.sh |
40 |
-runscript.sh |
41 |
+openrc-run.sh |
42 |
cgroup-release-agent.sh |
43 |
init.sh |
44 |
init-early.sh |
45 |
|
46 |
diff --git a/sh/Makefile b/sh/Makefile |
47 |
index 8f742dc..ee9d74d 100644 |
48 |
--- a/sh/Makefile |
49 |
+++ b/sh/Makefile |
50 |
@@ -1,8 +1,8 @@ |
51 |
DIR= ${LIBEXECDIR}/sh |
52 |
SRCS= init.sh.in functions.sh.in gendepends.sh.in \ |
53 |
- rc-functions.sh.in runscript.sh.in tmpfiles.sh.in ${SRCS-${OS}} |
54 |
+ openrc-run.sh.in rc-functions.sh.in tmpfiles.sh.in ${SRCS-${OS}} |
55 |
INC= rc-mount.sh functions.sh rc-functions.sh |
56 |
-BIN= gendepends.sh init.sh runscript.sh tmpfiles.sh ${BIN-${OS}} |
57 |
+BIN= gendepends.sh init.sh openrc-run.sh tmpfiles.sh ${BIN-${OS}} |
58 |
|
59 |
INSTALLAFTER= _installafter |
60 |
|
61 |
|
62 |
diff --git a/sh/runscript.sh.in b/sh/openrc-run.sh.in |
63 |
similarity index 99% |
64 |
rename from sh/runscript.sh.in |
65 |
rename to sh/openrc-run.sh.in |
66 |
index 4c47260..a6d2c0b 100644 |
67 |
--- a/sh/runscript.sh.in |
68 |
+++ b/sh/openrc-run.sh.in |
69 |
@@ -1,5 +1,5 @@ |
70 |
#!@SHELL@ |
71 |
-# Shell wrapper for runscript |
72 |
+# Shell wrapper for openrc-run |
73 |
|
74 |
# Copyright (c) 2007-2009 Roy Marples <roy@×××××××.name> |
75 |
# Released under the 2-clause BSD license. |
76 |
|
77 |
diff --git a/sh/rc-functions.sh.in b/sh/rc-functions.sh.in |
78 |
index d52b82e..911d65a 100644 |
79 |
--- a/sh/rc-functions.sh.in |
80 |
+++ b/sh/rc-functions.sh.in |
81 |
@@ -85,7 +85,7 @@ get_bootparam() |
82 |
return 1 |
83 |
} |
84 |
|
85 |
-# Called from runscript.sh or gendepends.sh |
86 |
+# Called from openrc-run.sh or gendepends.sh |
87 |
_depend() { |
88 |
depend |
89 |
local _rc_svcname=$(shell_var "$RC_SVCNAME") _deptype= _depends= |
90 |
|
91 |
diff --git a/src/librc/librc-daemon.c b/src/librc/librc-daemon.c |
92 |
index 3811a04..4986f70 100644 |
93 |
--- a/src/librc/librc-daemon.c |
94 |
+++ b/src/librc/librc-daemon.c |
95 |
@@ -99,7 +99,7 @@ rc_find_pids(const char *exec, const char *const *argv, uid_t uid, pid_t pid) |
96 |
pid_t p; |
97 |
char buffer[PATH_MAX]; |
98 |
struct stat sb; |
99 |
- pid_t runscript_pid = 0; |
100 |
+ pid_t openrc_pid = 0; |
101 |
char *pp; |
102 |
RC_PIDLIST *pids = NULL; |
103 |
RC_PID *pi; |
104 |
@@ -108,7 +108,7 @@ rc_find_pids(const char *exec, const char *const *argv, uid_t uid, pid_t pid) |
105 |
return NULL; |
106 |
|
107 |
/* |
108 |
- We never match RC_RUNSCRIPT_PID if present so we avoid the below |
109 |
+ We never match RC_OPENRC_PID if present so we avoid the below |
110 |
scenario |
111 |
|
112 |
/etc/init.d/ntpd stop does |
113 |
@@ -118,9 +118,9 @@ rc_find_pids(const char *exec, const char *const *argv, uid_t uid, pid_t pid) |
114 |
nasty |
115 |
*/ |
116 |
|
117 |
- if ((pp = getenv("RC_RUNSCRIPT_PID"))) { |
118 |
- if (sscanf(pp, "%d", &runscript_pid) != 1) |
119 |
- runscript_pid = 0; |
120 |
+ if ((pp = getenv("RC_OPENRC_PID"))) { |
121 |
+ if (sscanf(pp, "%d", &openrc_pid) != 1) |
122 |
+ openrc_pid = 0; |
123 |
} |
124 |
|
125 |
/* |
126 |
@@ -146,7 +146,7 @@ rc_find_pids(const char *exec, const char *const *argv, uid_t uid, pid_t pid) |
127 |
while ((entry = readdir(procdir)) != NULL) { |
128 |
if (sscanf(entry->d_name, "%d", &p) != 1) |
129 |
continue; |
130 |
- if (runscript_pid != 0 && runscript_pid == p) |
131 |
+ if (openrc_pid != 0 && openrc_pid == p) |
132 |
continue; |
133 |
if (pid != 0 && pid != p) |
134 |
continue; |
135 |
|
136 |
diff --git a/src/rc/Makefile b/src/rc/Makefile |
137 |
index fc88ff2..65b5811 100644 |
138 |
--- a/src/rc/Makefile |
139 |
+++ b/src/rc/Makefile |
140 |
@@ -1,8 +1,8 @@ |
141 |
PROG= openrc |
142 |
-SRCS= checkpath.c fstabinfo.c mountinfo.c start-stop-daemon.c \ |
143 |
+SRCS= checkpath.c fstabinfo.c mountinfo.c openrc-run.c \ |
144 |
rc-applets.c rc-depend.c rc-logger.c \ |
145 |
rc-misc.c rc-plugin.c rc-service.c rc-status.c rc-update.c \ |
146 |
- runscript.c rc.c swclock.c |
147 |
+ rc.c start-stop-daemon.c swclock.c |
148 |
|
149 |
ifeq (${MKSELINUX},yes) |
150 |
SRCS+= rc-selinux.c |
151 |
|
152 |
diff --git a/src/rc/runscript.c b/src/rc/openrc-run.c |
153 |
similarity index 98% |
154 |
rename from src/rc/runscript.c |
155 |
rename to src/rc/openrc-run.c |
156 |
index e59c6ae..989779b 100644 |
157 |
--- a/src/rc/runscript.c |
158 |
+++ b/src/rc/openrc-run.c |
159 |
@@ -1,5 +1,5 @@ |
160 |
/* |
161 |
- * runscript.c |
162 |
+ * openrc-run.c |
163 |
* Handle launching of init scripts. |
164 |
*/ |
165 |
|
166 |
@@ -370,18 +370,18 @@ svc_exec(const char *arg1, const char *arg2) |
167 |
dup2(slave_tty, STDERR_FILENO); |
168 |
} |
169 |
|
170 |
- if (exists(RC_SVCDIR "/runscript.sh")) { |
171 |
- execl(RC_SVCDIR "/runscript.sh", |
172 |
- RC_SVCDIR "/runscript.sh", |
173 |
+ if (exists(RC_SVCDIR "/openrc-run.sh")) { |
174 |
+ execl(RC_SVCDIR "/openrc-run.sh", |
175 |
+ RC_SVCDIR "/openrc-run.sh", |
176 |
service, arg1, arg2, (char *) NULL); |
177 |
- eerror("%s: exec `" RC_SVCDIR "/runscript.sh': %s", |
178 |
+ eerror("%s: exec `" RC_SVCDIR "/openrc-run.sh': %s", |
179 |
service, strerror(errno)); |
180 |
_exit(EXIT_FAILURE); |
181 |
} else { |
182 |
- execl(RC_LIBEXECDIR "/sh/runscript.sh", |
183 |
- RC_LIBEXECDIR "/sh/runscript.sh", |
184 |
+ execl(RC_LIBEXECDIR "/sh/openrc-run.sh", |
185 |
+ RC_LIBEXECDIR "/sh/openrc-run.sh", |
186 |
service, arg1, arg2, (char *) NULL); |
187 |
- eerror("%s: exec `" RC_LIBEXECDIR "/sh/runscript.sh': %s", |
188 |
+ eerror("%s: exec `" RC_LIBEXECDIR "/sh/openrc-run.sh': %s", |
189 |
service, strerror(errno)); |
190 |
_exit(EXIT_FAILURE); |
191 |
} |
192 |
@@ -1162,6 +1162,11 @@ openrc_run(int argc, char **argv) |
193 |
subshells the init script may create so that our mark_service_* |
194 |
functions can always instruct us of this change */ |
195 |
snprintf(pidstr, sizeof(pidstr), "%d", (int) getpid()); |
196 |
+ setenv("RC_OPENRC_PID", pidstr, 1); |
197 |
+ /* |
198 |
+ * RC_RUNSCRIPT_PID is deprecated, but we will keep it for a while |
199 |
+ * for safety. |
200 |
+ */ |
201 |
setenv("RC_RUNSCRIPT_PID", pidstr, 1); |
202 |
|
203 |
/* eprefix is kinda klunky, but it works for our purposes */ |
204 |
|
205 |
diff --git a/src/rc/rc-applets.c b/src/rc/rc-applets.c |
206 |
index 8fe2d22..9b84ce4 100644 |
207 |
--- a/src/rc/rc-applets.c |
208 |
+++ b/src/rc/rc-applets.c |
209 |
@@ -329,7 +329,7 @@ do_mark_service(int argc, char **argv) |
210 |
bool ok = false; |
211 |
char *svcname = getenv("RC_SVCNAME"); |
212 |
char *service = NULL; |
213 |
- char *runscript_pid; |
214 |
+ char *openrc_pid; |
215 |
/* char *mtime; */ |
216 |
pid_t pid; |
217 |
RC_SERVICE bit; |
218 |
@@ -350,7 +350,7 @@ do_mark_service(int argc, char **argv) |
219 |
eerrorx("%s: unknown applet", applet); |
220 |
|
221 |
/* If we're marking ourselves then we need to inform our parent |
222 |
- runscript process so they do not mark us based on our exit code */ |
223 |
+ openrc-run process so they do not mark us based on our exit code */ |
224 |
/* |
225 |
* FIXME: svcname and service are almost always equal except called from a |
226 |
* shell with just argv[1] - So that doesn't seem to do what Roy initially |
227 |
@@ -359,8 +359,8 @@ do_mark_service(int argc, char **argv) |
228 |
* openrc@g.o). |
229 |
*/ |
230 |
if (ok && svcname && strcmp(svcname, service) == 0) { |
231 |
- runscript_pid = getenv("RC_RUNSCRIPT_PID"); |
232 |
- if (runscript_pid && sscanf(runscript_pid, "%d", &pid) == 1) |
233 |
+ openrc_pid = getenv("RC_OPENRC_PID"); |
234 |
+ if (openrc_pid && sscanf(openrc_pid, "%d", &pid) == 1) |
235 |
if (kill(pid, SIGHUP) != 0) |
236 |
eerror("%s: failed to signal parent %d: %s", |
237 |
applet, pid, strerror(errno)); |
238 |
@@ -369,10 +369,10 @@ do_mark_service(int argc, char **argv) |
239 |
in control as well */ |
240 |
/* |
241 |
l = strlen(RC_SVCDIR "/exclusive") + strlen(svcname) + |
242 |
- strlen(runscript_pid) + 4; |
243 |
+ strlen(openrc_pid) + 4; |
244 |
mtime = xmalloc(l); |
245 |
snprintf(mtime, l, RC_SVCDIR "/exclusive/%s.%s", |
246 |
- svcname, runscript_pid); |
247 |
+ svcname, openrc_pid); |
248 |
if (exists(mtime) && unlink(mtime) != 0) |
249 |
eerror("%s: unlink: %s", applet, strerror(errno)); |
250 |
free(mtime); |