mirror of
https://github.com/troglobit/finit.git
synced 2026-10-01 05:22:48 +07:00
test: new, verify runparts order
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
@@ -38,6 +38,7 @@ EXTRA_DIST += restart-self.sh
|
||||
EXTRA_DIST += runlevel.sh
|
||||
EXTRA_DIST += run-restart-forever.sh
|
||||
EXTRA_DIST += run-task-tricks.sh
|
||||
EXTRA_DIST += runparts.sh
|
||||
EXTRA_DIST += start-stop-service.sh
|
||||
EXTRA_DIST += start-stop-service-sub-config.sh
|
||||
EXTRA_DIST += start-kill-service.sh
|
||||
@@ -79,6 +80,7 @@ TESTS += restart-self.sh
|
||||
TESTS += runlevel.sh
|
||||
TESTS += run-restart-forever.sh
|
||||
TESTS += run-task-tricks.sh
|
||||
TESTS += runparts.sh
|
||||
TESTS += start-stop-service.sh
|
||||
TESTS += start-stop-service-sub-config.sh
|
||||
TESTS += start-kill-service.sh
|
||||
|
||||
@@ -305,6 +305,15 @@ if [ -n "$BOOTSTRAP" ]; then
|
||||
say "Setting up bootstrap tasks ..."
|
||||
echo "$BOOTSTRAP" >> "$SYSROOT$FINIT_CONF"
|
||||
fi
|
||||
|
||||
if [ -n "$RUNPARTS" ]; then
|
||||
say "Setting up runparts task ..."
|
||||
echo "runparts /etc/rc.d" >> "$SYSROOT$FINIT_CONF"
|
||||
mkdir "$SYSROOT/etc/rc.d"
|
||||
echo "$RUNPARTS" > "$SYSROOT/etc/rc.d/start.sh"
|
||||
chmod +x "$SYSROOT/etc/rc.d/start.sh"
|
||||
fi
|
||||
|
||||
if [ -n "$RCLOCAL" ]; then
|
||||
while [ -f "$SYSROOT/etc/rc.local" ]; do
|
||||
echo "$SYSROOT/etc/rc.local busy ... waiting ..."
|
||||
|
||||
Executable
+41
@@ -0,0 +1,41 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Verifies basic runparts behavior: to run all scripts in a directory at
|
||||
# the end of system bootstrap, right before calling /etc/rc.local:
|
||||
#
|
||||
# - only 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 /etc/rc.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 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"
|
||||
Executable
+3
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "$0 $*" >> /tmp/runparts.log
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
S01abc.sh
|
||||
Executable
+3
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "$0" >> /tmp/runparts.log
|
||||
Executable
+3
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "$0" >> /tmp/runparts.log
|
||||
Reference in New Issue
Block a user