mirror of
https://gitlab.com/hacklab01/pivilion.git
synced 2026-08-06 16:08:22 +00:00
Activate offline mode changes on next boot
This commit is contained in:
parent
eda151065c
commit
b5e19f08f6
9 changed files with 94 additions and 14 deletions
13
tests/run.sh
13
tests/run.sh
|
|
@ -46,7 +46,7 @@ state_contract() {
|
|||
grep -q "printf 'desired_mode" "$ROOT/usr/local/lib/pivilion/common.sh" &&
|
||||
grep -q "printf 'active_mode" "$ROOT/usr/local/lib/pivilion/common.sh" &&
|
||||
grep -q "printf 'health" "$ROOT/usr/local/lib/pivilion/common.sh" &&
|
||||
grep -q 'degraded' "$ROOT/usr/local/lib/pivilion/mode.sh"
|
||||
grep -q 'pivilion_write_state none.*failed' "$ROOT/usr/local/lib/pivilion/mode.sh"
|
||||
}
|
||||
|
||||
tty_banner_contract() {
|
||||
|
|
@ -67,6 +67,16 @@ boot_config_contract() {
|
|||
grep -q 'config-sync.sh set-wifi' "$ROOT/usr/local/bin/pikey"
|
||||
}
|
||||
|
||||
same_boot_mode_contract() {
|
||||
grep -q 'ExecStart=/usr/local/lib/pivilion/mode.sh --boot-selected' "$ROOT/etc/systemd/system/pivilion-mode.service" &&
|
||||
grep -q 'Requires=pivilion-config.service' "$ROOT/etc/systemd/system/pivilion-mode.service" &&
|
||||
grep -q 'RequiresMountsFor=/boot /boot/firmware' "$ROOT/etc/systemd/system/pivilion-config.service" &&
|
||||
grep -q 'PIVILION_SELECTED_MODE_FILE' "$ROOT/usr/local/lib/pivilion/config-sync.sh" &&
|
||||
grep -q 'MODE=$(pivilion_selected_mode)' "$ROOT/usr/local/lib/pivilion/mode.sh" &&
|
||||
grep -q 'wait_for_diagnostics hotspot' "$ROOT/usr/local/lib/pivilion/mode.sh" &&
|
||||
grep -q 'wait_for_diagnostics onion' "$ROOT/usr/local/lib/pivilion/mode.sh"
|
||||
}
|
||||
|
||||
shellcheck_scripts() {
|
||||
command -v shellcheck >/dev/null 2>&1 || return 0
|
||||
shellcheck "$ROOT/install.sh" "$ROOT"/usr/local/lib/pivilion/*.sh "$ROOT"/usr/local/bin/pivilion* "$ROOT/usr/local/bin/hotspot" "$ROOT/usr/local/bin/onion" "$ROOT/usr/local/bin/pikey"
|
||||
|
|
@ -81,6 +91,7 @@ run "transactional installer safety contract" installer_safety
|
|||
run "truthful runtime state contract" state_contract
|
||||
run "agetty login-banner contract" tty_banner_contract
|
||||
run "canonical boot configuration contract" boot_config_contract
|
||||
run "same-boot hotspot and onion activation contract" same_boot_mode_contract
|
||||
run "ShellCheck (when installed)" shellcheck_scripts
|
||||
|
||||
[ "$failures" -eq 0 ] || { echo "$failures test group(s) failed." >&2; exit 1; }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue