Make clean-clone OS rebuilds autonomous
A fresh clone can now bootstrap a complete armv7 rootfs, apply the Bananarchy overlay, regenerate boot artifacts, and produce a flashable image without local build artifacts. - Add a shared package list and Docker-based rootfs bootstrap, wired into rebuild-image.sh and chroot-shell.sh. - Add offline rebuild preflight checks and prebuilt-to-overlay artifact synchronization. - Vendor the patched EDL client and provision host flashing dependencies. - Remove the hardcoded credential from the power menu helper. - Refresh documentation and changelog for the autonomous workflow.
This commit is contained in:
1 parent
a9b72700ac
commit
0ab9367e28
31 files changed
+3809
-181
No files matched your search
Executable
+83
@@ -0,0 +1,83 @@
|
||||
#!/bin/sh
|
||||
# Keep the tracked overlay/rootfs snapshot in sync with prebuilt/ artifacts.
|
||||
# prebuilt/ is the single source of truth; this script mirrors every artifact
|
||||
# that also exists in overlay/rootfs back into the overlay.
|
||||
set -eu
|
||||
|
||||
BASE_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
CHECK_ONLY=0
|
||||
|
||||
for arg in "$@"; do
|
||||
case "$arg" in
|
||||
--check|-c)
|
||||
CHECK_ONLY=1
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 [--check]" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
python3 - "$BASE_DIR" "$CHECK_ONLY" <<'PYEOF'
|
||||
import hashlib
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
|
||||
base = sys.argv[1]
|
||||
check_only = sys.argv[2] == "1"
|
||||
prebuilt_root = os.path.join(base, "prebuilt")
|
||||
overlay_root = os.path.join(base, "overlay", "rootfs")
|
||||
|
||||
|
||||
def digest(path):
|
||||
with open(path, "rb") as handle:
|
||||
return hashlib.sha256(handle.read()).hexdigest()
|
||||
|
||||
|
||||
def regular_files(root):
|
||||
result = []
|
||||
for parent, _, names in os.walk(root):
|
||||
for name in names:
|
||||
path = os.path.join(parent, name)
|
||||
if not os.path.islink(path) and os.path.isfile(path):
|
||||
result.append(path)
|
||||
return result
|
||||
|
||||
|
||||
by_name = {}
|
||||
for path in regular_files(prebuilt_root):
|
||||
by_name.setdefault(os.path.basename(path), []).append(path)
|
||||
|
||||
drift = []
|
||||
matched = 0
|
||||
for target in regular_files(overlay_root):
|
||||
rel = os.path.relpath(target, overlay_root)
|
||||
candidates = by_name.get(os.path.basename(target), [])
|
||||
source = None
|
||||
for candidate in candidates:
|
||||
stripped = os.path.relpath(candidate, prebuilt_root).split(os.sep, 1)[-1]
|
||||
if stripped == rel:
|
||||
source = candidate
|
||||
break
|
||||
if source is None and candidates:
|
||||
source = candidates[0]
|
||||
if source is None:
|
||||
continue
|
||||
matched += 1
|
||||
if digest(source) == digest(target):
|
||||
continue
|
||||
drift.append((source, target))
|
||||
if not check_only:
|
||||
shutil.copy2(source, target)
|
||||
|
||||
if check_only:
|
||||
for source, target in drift:
|
||||
print("out of sync: " + os.path.relpath(target, base))
|
||||
print("artifact drift: %d of %d mirrored file(s)" % (len(drift), matched))
|
||||
sys.exit(1 if drift else 0)
|
||||
|
||||
print("synced %d artifact(s) into overlay/rootfs; %d already in sync" % (
|
||||
len(drift), matched - len(drift)))
|
||||
PYEOF
|
||||
Reference in new issue
Block a user