VulpesOS/tundra/runtime/mark-boot-success.py
OverSu 0041cd9660 Update shared Gaia workflows and Sargo development tooling
Fix camera switching and Contacts/SMS activity routing across shared hosts.
Integrate Marketplace installation and native standalone recovery tools,
Bluetooth runtime packages and trusted certificates.

Update English/French READMEs and the shared changelog with tested scope
and remaining radio/audio/Bluetooth limitations. Preview17 remains the
existing APK; no new native image is released.

Validation: shared JavaScript and native Python tests; Android packaging
and payload parity from an isolated publication checkout.
2026-10-08 14:27:17 +02:00

38 lines
1.8 KiB
Python

#!/usr/bin/env python3
# SPDX-License-Identifier: MPL-2.0
"""Acknowledge slot A only after this standalone installation has started Gaia."""
import json
from pathlib import Path
import subprocess
import time
def eligible(boot_id, gaia, mount, cmdline, services_ready):
return (cmdline.get('androidboot.slot_suffix') == '_a'
and mount.get('source') == '/dev/mmcblk0p72'
and mount.get('fstype') == 'ext4'
and gaia.get('bootId') == boot_id and gaia.get('passed') is True
and bool(gaia.get('checks')) and all(gaia['checks'].values())
and services_ready)
def main():
cmdline=dict(x.split('=',1) for x in Path('/proc/cmdline').read_text().split() if '=' in x)
boot_id=Path('/proc/sys/kernel/random/boot_id').read_text().strip()
mounts=json.loads(subprocess.check_output(['findmnt','--json','--mountpoint','/reference/tundra-volume','--output','SOURCE,FSTYPE'],text=True))['filesystems']
if len(mounts)!=1 or mounts[0]['source']!='/dev/mmcblk0p72':
return # Container/RAM experiments must not mark a flashed slot successful.
for _ in range(120):
try:
gaia=json.loads(Path('/opt/vulpes/logs/test.json').read_text())
ready=subprocess.run(['systemctl','is-active','--quiet','tundra-hal','tundra-display','tundra-radio']).returncode==0
if eligible(boot_id,gaia,mounts[0],cmdline,ready):break
except (OSError,ValueError):pass
time.sleep(5)
else:raise RuntimeError('Gaia did not pass startup; slot success left unchanged')
subprocess.run(['/usr/libexec/tundra-qbootctl','-m','a'],check=True)
Path('/var/lib/tundra').mkdir(parents=True,exist_ok=True)
Path('/var/lib/tundra/boot-success.json').write_text(json.dumps({'bootId':boot_id,'gaiaPassed':True,'slot':'a'})+'\n')
if __name__=='__main__':main()