feat: follow shutdowns on the boot console
This commit is contained in:
1 parent
74af283d57
commit
3fc9e2235c
16 files changed
+431
-103
No files matched your search
+6
-1
@@ -22,6 +22,11 @@ def "main start" [--units: path, --target: string] {
|
||||
print $"started ($target); watch it with: bootvine --user --target ($target) --hold 3s"
|
||||
}
|
||||
|
||||
def "main stop" [--units: path, --target: string] {
|
||||
^systemctl --user stop --no-block ...(unit-names $units)
|
||||
print $"stopping ($target); watch it with: bootvine --user --shutdown --target ($target)"
|
||||
}
|
||||
|
||||
def "main remove" [--units: path, --target: string] {
|
||||
^systemctl --user stop ...(unit-names $units)
|
||||
unit-names $units | each {|name| rm -f (user-unit-dir | path join $name) } | ignore
|
||||
@@ -29,5 +34,5 @@ def "main remove" [--units: path, --target: string] {
|
||||
}
|
||||
|
||||
def main [--units: path, --target: string] {
|
||||
print "usage: bootvine-demo-units (start | remove)"
|
||||
print "usage: bootvine-demo-units (start | stop | remove)"
|
||||
}
|
||||
+5
-1
@@ -14,6 +14,10 @@ let
|
||||
"${pkgs.coreutils}/bin/sleep ${spec.seconds}"
|
||||
]
|
||||
++ lib.optional (spec.fails or false) "${pkgs.coreutils}/bin/false";
|
||||
}
|
||||
// lib.optionalAttrs (spec ? stopSeconds) {
|
||||
RemainAfterExit = true;
|
||||
ExecStop = "${pkgs.coreutils}/bin/sleep ${spec.stopSeconds}";
|
||||
};
|
||||
};
|
||||
in
|
||||
@@ -64,7 +68,7 @@ in
|
||||
};
|
||||
|
||||
systemd.services = lib.mapAttrs (_: demoService) demoUnits.services // {
|
||||
display-manager.after = [ "multi-user.target" ];
|
||||
greetd.after = [ "multi-user.target" ];
|
||||
};
|
||||
|
||||
services.greetd = {
|
||||
|
||||
+10
-1
@@ -4,10 +4,14 @@
|
||||
enableOCR = true;
|
||||
|
||||
nodes.machine =
|
||||
{ lib, ... }:
|
||||
{ lib, pkgs, ... }:
|
||||
let
|
||||
lingerFor = seconds: lib.mkForce "${pkgs.coreutils}/bin/sleep ${seconds}";
|
||||
in
|
||||
{
|
||||
imports = [ demoHost ];
|
||||
systemd.settings.Manager.ShowStatus = lib.mkForce true;
|
||||
systemd.services.demo-db.serviceConfig.ExecStop = lingerFor "20";
|
||||
virtualisation = {
|
||||
memorySize = 2048;
|
||||
qemu.options = [
|
||||
@@ -51,5 +55,10 @@
|
||||
assert "boot already finished" in machine.succeed("journalctl -u bootvine -o cat"), "a restart after boot did not stand down"
|
||||
still_foreground = machine.succeed("cat /sys/class/tty/tty0/active").strip()
|
||||
assert still_foreground == foreground, f"a restart after boot took the console: {foreground} -> {still_foreground}"
|
||||
|
||||
machine.succeed("systemctl poweroff --no-block")
|
||||
machine.wait_for_text("demo-db")
|
||||
machine.screenshot("shutdown")
|
||||
machine.wait_for_shutdown()
|
||||
'';
|
||||
}
|
||||
+10
-2
@@ -2,14 +2,22 @@
|
||||
target = "bootvine-demo";
|
||||
initrdProbeSeconds = "6";
|
||||
services = {
|
||||
demo-disk.seconds = "2";
|
||||
demo-disk = {
|
||||
seconds = "2";
|
||||
stopSeconds = "2";
|
||||
};
|
||||
demo-db = {
|
||||
seconds = "3";
|
||||
stopSeconds = "3";
|
||||
after = [ "demo-disk" ];
|
||||
};
|
||||
demo-cache.seconds = "1.5";
|
||||
demo-cache = {
|
||||
seconds = "1.5";
|
||||
stopSeconds = "1";
|
||||
};
|
||||
demo-web = {
|
||||
seconds = "2";
|
||||
stopSeconds = "2";
|
||||
after = [
|
||||
"demo-db"
|
||||
"demo-cache"
|
||||
|
||||
@@ -23,6 +23,10 @@ let
|
||||
"${coreutils}/bin/sleep ${spec.seconds}"
|
||||
]
|
||||
++ lib.optional (spec.fails or false) "${coreutils}/bin/false";
|
||||
}
|
||||
// lib.optionalAttrs (spec ? stopSeconds) {
|
||||
RemainAfterExit = true;
|
||||
ExecStop = "${coreutils}/bin/sleep ${spec.stopSeconds}";
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user