mirror of
https://github.com/troglobit/finit.git
synced 2026-10-27 12:20:54 +00:00
Add support for SysV-only scripts in runparts
This patch extens the SysV compatibility support in Finit by adding support for limiting `runparts` to run only SNNfoo, or KNNfoo, style scripts from a directory. Additionally, by default `runparts` now runs entirely in the background without any progress. To enable progress, an optional argument has been added to the runparts command line. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
846806747b
commit
6ae1083c99
17 files changed
+118
-42
No files matched your search
+6
-1
@@ -2,9 +2,12 @@ SUBDIRS = lib src
|
||||
|
||||
EXTRA_DIST = skel/bin/busybox-x86_64.sha256 skel/sbin/service.sh skel/etc/env \
|
||||
skel/bin/pre.sh skel/bin/post.sh skel/bin/ready.sh skel/bin/slay \
|
||||
skel/sbin/fail.sh skel/usr/share/runlevel/ref.log \
|
||||
skel/sbin/fail.sh skel/usr/share/runparts/ref.log \
|
||||
skel/usr/share/runparts/sysv.log \
|
||||
skel/etc/rc.d/foo.sh skel/etc/rc.d/S01abc.sh \
|
||||
skel/etc/rc.d/test.sh skel/etc/rc.d/S02def.sh \
|
||||
skel/etc/rcS.d/foo.sh skel/etc/rcS.d/test.sh \
|
||||
skel/etc/rcS.d/S01abc.sh skel/etc/rcS.d/S02def.sh \
|
||||
skel/cdrom/.empty skel/dev/shm/.empty skel/dev/pts/.empty \
|
||||
skel/etc/inittab skel/etc/hostname skel/etc/fstab \
|
||||
skel/etc/init.d/rcS skel/etc/init.d/rcK skel/tmp/.empty \
|
||||
@@ -41,6 +44,7 @@ EXTRA_DIST += runlevel.sh
|
||||
EXTRA_DIST += run-restart-forever.sh
|
||||
EXTRA_DIST += run-task-tricks.sh
|
||||
EXTRA_DIST += runparts.sh
|
||||
EXTRA_DIST += sysvparts.sh
|
||||
EXTRA_DIST += start-stop-service.sh
|
||||
EXTRA_DIST += start-stop-service-sub-config.sh
|
||||
EXTRA_DIST += start-kill-service.sh
|
||||
@@ -80,6 +84,7 @@ TESTS += rclocal.sh
|
||||
TESTS += ready-serv.sh
|
||||
TESTS += restart-self.sh
|
||||
TESTS += runlevel.sh
|
||||
TESTS += sysvparts.sh
|
||||
TESTS += run-restart-forever.sh
|
||||
TESTS += run-task-tricks.sh
|
||||
TESTS += runparts.sh
|
||||
|
||||
+2
-2
@@ -37,5 +37,5 @@ while true; do
|
||||
sleep 1
|
||||
done
|
||||
|
||||
texec diff -u /usr/share/runlevel/ref.log /tmp/runparts.log
|
||||
texec cmp /usr/share/runlevel/ref.log /tmp/runparts.log || fail "runparts in wrong order"
|
||||
texec diff -u /usr/share/runparts/ref.log /tmp/runparts.log
|
||||
texec cmp /usr/share/runparts/ref.log /tmp/runparts.log || fail "runparts in wrong order"
|
||||
Executable
+3
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "$0 $*" >> /tmp/sysv.log
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
S01abc.sh
|
||||
Executable
+3
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "$0" >> /tmp/sysv.log
|
||||
Executable
+3
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "$0" >> /tmp/sysv.log
|
||||
File renamed without changes.
@@ -0,0 +1,2 @@
|
||||
/etc/rcS.d/S01abc.sh start
|
||||
/etc/rcS.d/S02def.sh start
|
||||
Executable
+42
@@ -0,0 +1,42 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Verifies SysV runparts behavior: to run all scripts in a directory at
|
||||
# the end of system bootstrap, right before calling /etc/rc.local:
|
||||
#
|
||||
# - only SNNfoo or KNNfoo executable scripts should be called
|
||||
# - always in alphabetical order
|
||||
# - SNNfoo should be called with a 'start' argument
|
||||
# - KNNfoo should be called with a 'stop' argument
|
||||
#
|
||||
|
||||
TEST_DIR=$(dirname "$0")
|
||||
#DEBUG=1
|
||||
|
||||
# shellcheck disable=SC2034
|
||||
BOOTSTRAP="runparts sysv /etc/rcS.d"
|
||||
|
||||
# shellcheck source=/dev/null
|
||||
. "$TEST_DIR/lib/setup.sh"
|
||||
|
||||
test_setup()
|
||||
{
|
||||
say "Test start $(date)"
|
||||
}
|
||||
|
||||
test_teardown()
|
||||
{
|
||||
say "Test done $(date)"
|
||||
}
|
||||
|
||||
while true; do
|
||||
lvl=$(texec initctl runlevel)
|
||||
say "Current runlevel $lvl"
|
||||
if [ "$lvl" = "N 2" ]; then
|
||||
break;
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
|
||||
texec cat /tmp/sysv.log
|
||||
texec diff -u /usr/share/runparts/sysv.log /tmp/sysv.log
|
||||
texec cmp /usr/share/runparts/sysv.log /tmp/sysv.log || fail "runparts sysv in wrong order"
|
||||
Reference in new issue
Block a user