summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHendrik Jäger <gitcommit@henk.geekmail.org>2022-05-22 15:36:47 +0200
committerHendrik Jäger <gitcommit@henk.geekmail.org>2022-07-25 23:53:04 +0200
commitcdf99a6c762c799eb1c71385391813f804096328 (patch)
tree92e1b9909c8850d32e95971a797c92edb79c2888
parent50a5fa416e558000e56c0bbea7815da02c16e2a1 (diff)
fix: wait until s6-svscan is ready
-rw-r--r--files/etc/init.d/s617
-rw-r--r--files/usr/local/bin/s6-svscanboot11
-rw-r--r--files/usr/local/bin/s6-svscanboot.buster11
3 files changed, 22 insertions, 17 deletions
diff --git a/files/etc/init.d/s6 b/files/etc/init.d/s6
index a307908..371e53e 100644
--- a/files/etc/init.d/s6
+++ b/files/etc/init.d/s6
@@ -15,7 +15,6 @@ DESC="s6 system service supervision suite"
DAEMON="/usr/local/bin/s6-svscanboot"
SCANDIR="/etc/s6-scandir/"
DAEMON_ARGS=${SCANDIR}
-PIDFILE="/var/run/s6.pid"
SCRIPTNAME="/etc/init.d/${NAME}"
test -x $DAEMON || exit 0
@@ -37,23 +36,15 @@ case "$1" in
--start \
--oknodo \
--chdir "${SCANDIR}" \
- --startas "${DAEMON}" \
- --background \
- --make-pidfile \
- --pidfile "${PIDFILE}" \
+ --exec "${DAEMON}" \
-- "${DAEMON_ARGS}"
log_end_msg $?
fi
;;
stop)
log_daemon_msg "Stopping ${DESC}" "${NAME}"
- /sbin/start-stop-daemon \
- --stop \
- --oknodo \
- --retry TERM/60/QUIT/60 \
- --remove-pidfile \
- --pidfile "${PIDFILE}"
- if test $? = 2; then
+ /usr/bin/s6-svscanctl -t "${SCANDIR}"
+ if test $? = 111; then
/sbin/start-stop-daemon \
--stop \
--oknodo \
@@ -72,7 +63,7 @@ case "$1" in
$0 start
;;
status)
- status_of_proc -p ${PIDFILE} ${DAEMON} s6 && exit 0 || exit $?
+ status_of_proc ${DAEMON} s6 && exit 0 || exit $?
;;
*)
echo "Usage: ${SCRIPTNAME} {start|stop|restart|force-reload|status}"
diff --git a/files/usr/local/bin/s6-svscanboot b/files/usr/local/bin/s6-svscanboot
index 7a5f549..f2b6e35 100644
--- a/files/usr/local/bin/s6-svscanboot
+++ b/files/usr/local/bin/s6-svscanboot
@@ -29,5 +29,12 @@ if { chmod 0755 ${1}/s6-svscan-log/run }
redirfd -r 0 /dev/null
redirfd -wnb 1 ${1}/s6-svscan-log/fifo
fdmove -c 2 1
-s6-svscan -- ${1}
-
+piperw 3 4
+background {
+ fdclose 3
+ s6-setsid
+ s6-svscan -d4 -- ${1}
+}
+fdclose 4
+fdmove 1 3
+head -n 1
diff --git a/files/usr/local/bin/s6-svscanboot.buster b/files/usr/local/bin/s6-svscanboot.buster
index ef6de1b..28aa5a1 100644
--- a/files/usr/local/bin/s6-svscanboot.buster
+++ b/files/usr/local/bin/s6-svscanboot.buster
@@ -29,5 +29,12 @@ if { chmod 0755 ${1}/s6-svscan-log/run }
redirfd -r 0 /dev/null
redirfd -wnb 1 ${1}/s6-svscan-log/fifo
fdmove -c 2 1
-s6-svscan -- ${1}
-
+piperw 3 4
+background {
+ fdclose 3
+ s6-setsid
+ s6-svscan -d4 -- ${1}
+}
+fdclose 4
+fdmove 1 3
+head -n 1