add soft restart option to liminix-rebuild
instead of doing a full reboot, it runs activate / and uses s6-rc-update to install the new service database
This commit is contained in:
@@ -10,6 +10,17 @@
|
||||
|
||||
set -e
|
||||
|
||||
while test -n "$1"; do
|
||||
case $1 in
|
||||
--fast)
|
||||
FAST=true
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
here=$(pwd)/tests/min-copy-closure
|
||||
top=$(pwd)
|
||||
|
||||
@@ -32,7 +43,7 @@ mkdir ./vm
|
||||
|
||||
cat ${rootfs} > rootfs
|
||||
|
||||
truncate -s 24M rootfs
|
||||
truncate -s 32M rootfs
|
||||
resize2fs rootfs
|
||||
|
||||
dd if=rootfs of=disk-image bs=512 seek=4 conv=sync
|
||||
@@ -51,9 +62,12 @@ echo "READY"
|
||||
touch known_hosts
|
||||
export SSH_COMMAND="ssh -o UserKnownHostsFile=${work}/known_hosts -o StrictHostKeyChecking=no -p 2022 -i ${here}/id"
|
||||
|
||||
(cd ${top} && liminix-rebuild root@localhost -I liminix-config=${here}/with-figlet.nix --arg device "import ./devices/qemu-armv7l")
|
||||
if test -n "$FAST"; then
|
||||
(cd ${top} && liminix-rebuild --fast root@localhost -I liminix-config=${here}/with-figlet.nix --argstr deviceName qemu-armv7l)
|
||||
cd ${work} && expect $here/wait-for-soft-restart.expect
|
||||
else
|
||||
(cd ${top} && liminix-rebuild root@localhost -I liminix-config=${here}/with-figlet.nix --arg device "import ./devices/qemu-armv7l")
|
||||
cd ${work} && expect $here/wait-for-reboot.expect
|
||||
fi
|
||||
|
||||
ls -l vm
|
||||
|
||||
cd ${work} && expect $here/wait-for-reboot.expect
|
||||
cd / ; rm -rf $work
|
||||
|
13
tests/min-copy-closure/wait-for-soft-restart.expect
Normal file
13
tests/min-copy-closure/wait-for-soft-restart.expect
Normal file
@@ -0,0 +1,13 @@
|
||||
proc chat {instr outstr} {
|
||||
expect {
|
||||
$instr { send $outstr }
|
||||
timeout { exit 1 }
|
||||
}
|
||||
}
|
||||
spawn socat unix-connect:vm/console -
|
||||
|
||||
send "exit\r"
|
||||
chat "BusyBox" "\r"
|
||||
chat "#" "stty -echo; type -p figlet\r"
|
||||
chat "figlet-armv7l-unknown-linux" "s6-rc -a list |grep w\\inkle\r"
|
||||
chat "winkle" "poweroff\r"
|
@@ -4,4 +4,11 @@
|
||||
defaultProfile.packages = with pkgs; [
|
||||
figlet
|
||||
];
|
||||
services.ripvanwinkle = pkgs.liminix.services.longrun {
|
||||
name = "winkle";
|
||||
run = ''
|
||||
echo SLEEPING > /dev/console
|
||||
sleep 3600
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user