Skip to content

Commit 41432af

Browse files
Laurent Bercotnavi-desu
authored andcommitted
Remove restart(); add framework for reload() support
OpenRC will never call restart(), so scrap the definition in openrc-run.sh and s6.sh. reload() caused a weird error message when used without supervisor=s6, so add proper support for generic reload(), instantiated for s6, and with a better default error message for other backends - which can now add support for reload() down the line. Also clarify a comment, and add info messages on s6_reload.
1 parent a951b9a commit 41432af

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed

sh/openrc-run.sh.in

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,17 @@ default_status()
203203
$func
204204
}
205205

206+
default_reload()
207+
{
208+
case "$supervisor" in
209+
s6) s6_reload ;;
210+
?*)
211+
eerror "$RC_SVCNAME: undefined function 'reload'"
212+
exit 1
213+
;;
214+
esac
215+
}
216+
206217
# Template start / stop / status functions
207218
# package init scripts may override these, but the bodies are as minimal as
208219
# possible, so that the init scripts can creatively wrap default_*
@@ -222,6 +233,11 @@ status()
222233
default_status
223234
}
224235

236+
reload()
237+
{
238+
default_reload
239+
}
240+
225241
# Start debug output
226242
yesno $RC_DEBUG && set -x
227243

sh/s6.sh

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ _s6_servicedir_create() {
115115
fi
116116

117117
{
118-
# We use execline here because it makes code generation easier.
118+
# Generating execline code here because it is much easier than generating sh.
119119
# The command will still be interpreted by sh in the end.
120120
echo "#!$_execlineb -S1"
121121
if test -n "$umask" ; then
@@ -222,12 +222,9 @@ s6_status() {
222222
fi
223223
}
224224

225-
restart() {
226-
_s6_set_variables
227-
s6-svc -r -- "$_service"
228-
}
229-
230-
reload() {
225+
s6_reload() {
231226
_s6_set_variables
227+
ebegin "Reloading $name"
232228
s6-svc -h -- "$_service"
229+
eend $? "s6-svc -h command failed"
233230
}

0 commit comments

Comments
 (0)