From 225ad54930697e1164e2eb2dd2a01354801b80a7 Mon Sep 17 00:00:00 2001 From: shenlei Date: Tue, 10 Nov 2026 09:57:58 +0900 Subject: [PATCH] feat(image): bake easytier mesh binaries and service into rootfs export --- scripts/Audit-Server-Image.sh | 2 +- scripts/Harden-Server-Image.sh | 2 +- scripts/build-candidate-images.py | 17 +++++++++++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/scripts/Audit-Server-Image.sh b/scripts/Audit-Server-Image.sh index 64bd51c..9d5bca5 100755 --- a/scripts/Audit-Server-Image.sh +++ b/scripts/Audit-Server-Image.sh @@ -31,7 +31,7 @@ for package in device-xiaomi-platina firmware-xiaomi-platina linux-postmarketos- grep -q "^$package=" /etc/apk/world done python3 /usr/local/libexec/platina-image-runtime audit -for service in sshd dbus networkmanager usb-moded chronyd local avahi-daemon platina-power-chord platina-battery-guard; do +for service in sshd dbus networkmanager usb-moded chronyd local avahi-daemon platina-power-chord platina-battery-guard easytier; do test -L "/etc/runlevels/default/$service" done for key in /etc/ssh/ssh_host_*_key; do diff --git a/scripts/Harden-Server-Image.sh b/scripts/Harden-Server-Image.sh index b8cc8e3..a1b5745 100755 --- a/scripts/Harden-Server-Image.sh +++ b/scripts/Harden-Server-Image.sh @@ -55,7 +55,7 @@ for package in device-xiaomi-platina firmware-xiaomi-platina linux-postmarketos- set -- "$@" "$package=$version" done apk add --no-network "$@" -for service in sshd dbus networkmanager usb-moded chronyd local avahi-daemon platina-power-chord platina-battery-guard; do +for service in sshd dbus networkmanager usb-moded chronyd local avahi-daemon platina-power-chord platina-battery-guard easytier; do rc-update add "$service" default done printf 'Image configured for SSH keys and passwordless sudo for the dedicated administrator.\n' diff --git a/scripts/build-candidate-images.py b/scripts/build-candidate-images.py index dda17eb..2b9d8dd 100644 --- a/scripts/build-candidate-images.py +++ b/scripts/build-candidate-images.py @@ -125,6 +125,23 @@ def main(): archive.seek(0) subprocess.run(PMB + ['chroot', '--image', '--', 'tar', '-xf', '-', '-C', '/', '--no-same-owner'], cwd=ROOT, stdin=archive, check=True) + # Install standalone EasyTier mesh networking binaries if available on host + for bin_dir in (Path('/opt/easytier'), ROOT / 'vendor/bin/aarch64', ROOT / 'tools/bin/aarch64'): + if (bin_dir / 'easytier-core').is_file(): + with tempfile.TemporaryFile() as bin_archive: + with tarfile.open(fileobj=bin_archive, mode='w') as bstream: + for bname in ('easytier-core', 'easytier-cli'): + bpath = bin_dir / bname + if bpath.is_file(): + tinfo = tarfile.TarInfo(name=f'usr/local/bin/{bname}') + tinfo.size = bpath.stat().st_size + tinfo.mode = 0o755 + with bpath.open('rb') as bf: + bstream.addfile(tinfo, bf) + bin_archive.seek(0) + subprocess.run(PMB + ['chroot', '--image', '--', 'tar', '-xf', '-', '-C', '/', + '--no-same-owner'], cwd=ROOT, stdin=bin_archive, check=True) + break record('hardening-and-auditing-image') # Each pmbootstrap chroot entry restores build DNS/repositories. Configure # and audit in one entry, then export without entering the image again.