21 lines
1.1 KiB
Python
21 lines
1.1 KiB
Python
#!/usr/bin/env python3
|
|
"""Observe baseline firmware boot and retain failed OS preparation diagnostics."""
|
|
import json
|
|
from pathlib import Path
|
|
import platform
|
|
import subprocess
|
|
|
|
assert 'QEMU' in Path('/sys/class/dmi/id/sys_vendor').read_text()
|
|
assert subprocess.check_output(['findmnt','-n','-o','SOURCE','/'],text=True).strip()=='/dev/vda'
|
|
assert platform.release()=='6.12.107+deb13-amd64'
|
|
print('BASELINE_KERNEL',platform.release(),platform.version())
|
|
print('BOOT_ID',Path('/proc/sys/kernel/random/boot_id').read_text())
|
|
assert platform.release() in Path('/boot/grub/grub.cfg').read_text()
|
|
# Historical legacy evidence is read-only; all new operations use the sibling.
|
|
roots = (Path('/var/lib/archipelago-os-update'), Path('/var/lib/archipelago/os-update'))
|
|
for path in sorted(p for root in roots for p in (root/'transactions').glob('*/apt-*.log')):
|
|
print('RETAINED_APT_LOG',str(path),path.read_text())
|
|
for path in sorted(p for root in roots for p in (root/'transactions').glob('*/status.json')):
|
|
print('RETAINED_STATUS',str(path),path.read_text())
|
|
print('BASELINE_COLD_BOOT_OBSERVED_NOT_OTA_ACCEPTANCE')
|