refresh Phase 2A transaction and readiness gates

This commit is contained in:
makearmy 2026-07-12 17:36:55 -04:00
parent 2cf249d6f2
commit da03be61a9
23 changed files with 2409 additions and 37 deletions

View file

@ -23,6 +23,42 @@ check_shell() {
return 0
}
capture_failed_unit_fingerprint() {
output=$1
systemctl --failed --no-legend --plain --no-pager | awk '{print $1}' | LC_ALL=C sort |
while IFS= read -r unit; do
[ -n "$unit" ] || continue
printf '%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s\n' \
"$(systemctl show "$unit" -p Id --value --no-pager)" \
"$(systemctl show "$unit" -p Type --value --no-pager)" \
"$(systemctl show "$unit" -p LoadState --value --no-pager)" \
"$(systemctl show "$unit" -p ActiveState --value --no-pager)" \
"$(systemctl show "$unit" -p SubState --value --no-pager)" \
"$(systemctl show "$unit" -p Result --value --no-pager)" \
"$(systemctl show "$unit" -p InvocationID --value --no-pager)" \
"$(systemctl show "$unit" -p StateChangeTimestamp --value --no-pager)" \
"$(systemctl show "$unit" -p FragmentPath --value --no-pager)" \
"$(systemctl show "$unit" -p ExecMainCode --value --no-pager)" \
"$(systemctl show "$unit" -p ExecMainStatus --value --no-pager)"
done > "$output"
return ${PIPESTATUS[0]}
}
validate_failed_unit_disposition() {
(cd "$script_dir/failed-unit-disposition" && sha256sum -c SHA256SUMS) \
> "$post_record/failed-unit-allowlist-checksum.txt" 2>&1
rc=$?
if [ "$rc" -ne 0 ]; then add_failure 'failed-unit-allowlist-checksum'; return 0; fi
capture_failed_unit_fingerprint "$post_record/failed-units-fingerprint.psv"
rc=$?
if [ "$rc" -ne 0 ]; then add_failure "failed-unit-fingerprint|rc=$rc"; return 0; fi
diff -u "$script_dir/failed-unit-disposition/drkonqi-failed-units.allowlist.psv" \
"$post_record/failed-units-fingerprint.psv" > "$post_record/failed-unit-disposition.diff" 2>&1
rc=$?
if [ "$rc" -ne 0 ]; then add_failure 'failed-unit-disposition-changed-after-reboot'; fi
return 0
}
validate_health_url_file() {
file=$1
if [ ! -s "$file" ]; then add_failure 'health-urls|missing'; return 0; fi
@ -123,6 +159,7 @@ main() {
printf 'HARD_STOP: run as a separate root process\n' >&2
return 10
fi
script_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd -P)
if [ -z "$maintenance" ] || [ ! -d "$maintenance" ] || [ -L "$maintenance" ]; then
printf 'HARD_STOP: supply the exact maintenance record path\n' >&2
return 11
@ -169,7 +206,7 @@ main() {
check 'running-kernel' running-kernel.txt uname -a
check_shell 'installed-kernels' installed-kernels.txt 'pacman -Q linux linux-headers linux-zen linux-zen-headers'
check 'failed-units' failed-units.txt systemctl --failed --no-legend --plain --no-pager
if [ -s "$post_record/failed-units.txt" ]; then add_failure 'failed-units-present'; fi
validate_failed_unit_disposition
check_shell 'ssh-state' ssh-state.txt \
'systemctl show sshd.service -p LoadState -p ActiveState -p SubState -p ExecMainStatus; journalctl -b -u sshd.service --no-pager'
check_shell 'docker-daemon' docker-daemon.txt \