1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
|
#!/bin/sh
set -e
check_init_is_runit () {
echo "detecting runit-init"
if [ -f /etc/runit/stopit ]; then
echo "OK"
else
echo "init is not runit"
exit 1
fi
}
check_services_are_running () {
echo "detecting gettys"
if pidof getty; then
echo "OK"
elif pidof fgetty; then
echo "OK"
else
echo " no getty to perform login with "
exit 1
fi
echo "getting the runsvdir log:"
ps aux | grep runsvdir
echo "Detecting active services.."
sv status /etc/service/*
service udev status
# service --status-all #not usable since hwclock.sh writes to stderr with [?]
pstree
echo "OK"
}
if [ -z "$AUTOPKGTEST_REBOOT_MARK" ]; then
if [ -d /run/systemd/system ]; then
init=systemd
elif [ -e /run/initctl ]; then
init=sysv
else
init=unknown-init
fi
echo "testbed is running with $init"
# Installation runit-init must be done inside the test
# until it becomes a dependency of 'init' package
echo "installing runit-init"
#2 steps because of changes in apt(2.3.12) #1005881
#apt-get remove -y -allow-remove-essential init # no longer works....use dpkg
dpkg -r --force-remove-protected init
apt-get install -y --allow-remove-essential systemd-sysv- runit-init
ls -l /etc/service/
update-service --remove dbus.dep-fixer
if [ -e /tmp/autopkgtest-reboot ]; then
if [ ! -h /etc/service/getty-ttyS0 ]; then
echo "WARNING: serial getty is disabled"
ln -s /etc/sv/getty-ttyS0 /etc/service/
echo "serial getty: enabled"
fi
echo "preparing for reboot"
/tmp/autopkgtest-reboot-prepare runit1
reboot
else
echo "testbed does not support reboot"
echo "can't perform this test"
exit 1
fi
elif [ "$AUTOPKGTEST_REBOOT_MARK" = runit1 ]; then
check_init_is_runit
check_services_are_running
echo "Attempting a reboot with runit"
/tmp/autopkgtest-reboot-prepare runit2
reboot
else
check_init_is_runit
check_services_are_running
echo "init-switch test completed"
echo "OK: test done" && exit 0
fi
echo "FAIL: init-switch test failed" && exit 1
|