From 08f6a05f508b04e38d76c2442ec56b5896492fb1 Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 16 Jul 2026 12:57:08 +0200 Subject: [PATCH] refactor: enhance build script readability and update output messages --- build-rootfs.sh | 91 ++++++++++++++++++------------------------------- 1 file changed, 33 insertions(+), 58 deletions(-) diff --git a/build-rootfs.sh b/build-rootfs.sh index 557322f..6e1421b 100644 --- a/build-rootfs.sh +++ b/build-rootfs.sh @@ -5,14 +5,6 @@ set -euo pipefail # ========================================== # EspOS OpenRC RootFS Builder # Debian 13 Trixie + EspOS unstable -# -# Output: -# espos-openrc-rootfs.tar.xz -# -# No incluye: -# - live user -# - escritorio -# - instalador # ========================================== @@ -27,6 +19,7 @@ ESPOS_SUITE="espos-unstable" ROOTFS="$(pwd)/rootfs" OUTPUT="espos-openrc-rootfs.tar.xz" + KEYRING_PACKAGE="espos-archive-keyring" KEYRING_PATH="/usr/share/keyrings/espos-archive-keyring.gpg" @@ -49,7 +42,6 @@ init-system-helpers " - ESPOS_PACKAGES=" base-files espos-release @@ -72,7 +64,7 @@ trap cleanup EXIT -echo "[+] Removing old rootfs" +echo "[+] Removing previous rootfs" rm -rf "$ROOTFS" @@ -90,13 +82,13 @@ debootstrap \ -echo "[+] Copying DNS" +echo "[+] Copy DNS" cp /etc/resolv.conf "$ROOTFS/etc/resolv.conf" -echo "[+] Mounting virtual filesystems" +echo "[+] Mounting filesystems" mount --bind /dev "$ROOTFS/dev" @@ -107,7 +99,7 @@ mount -t sysfs sys "$ROOTFS/sys" -echo "[+] Installing ca-certificates first" +echo "[+] Installing Debian CA certificates" chroot "$ROOTFS" apt update @@ -117,17 +109,6 @@ chroot "$ROOTFS" apt install -y \ -echo "[+] Blocking systemd packages" - - -cat > "$ROOTFS/etc/apt/preferences.d/no-systemd" </dev/null || true +chroot "$ROOTFS" apt update -echo "[+] Installing EspOS archive keyring" +echo "[+] Installing EspOS keyring from repository" -if ls "$ROOTFS/tmp/packages/${KEYRING_PACKAGE}"*.deb >/dev/null 2>&1 -then - - chroot "$ROOTFS" dpkg -i \ - /tmp/packages/${KEYRING_PACKAGE}*.deb - -else - - echo "[ERROR] Missing ${KEYRING_PACKAGE}.deb" - exit 1 - -fi +chroot "$ROOTFS" apt install -y \ + "$KEYRING_PACKAGE" -echo "[+] Switching EspOS repo to signed-by" +echo "[+] Switching repository to signed-by" cat > "$ROOTFS/etc/apt/sources.list.d/espos.list" < "$ROOTFS/etc/apt/preferences.d/no-systemd" < "$ROOTFS/etc/hostname" -echo "[+] Generating locales" +echo "[+] Locales" chroot "$ROOTFS" bash -c " @@ -241,19 +220,17 @@ chroot "$ROOTFS" rc-update add sysfs boot || true -echo "[+] Cleaning apt" +echo "[+] Cleaning" chroot "$ROOTFS" apt clean - rm -rf "$ROOTFS/var/lib/apt/lists/*" - rm -rf "$ROOTFS/tmp/*" -echo "[+] Creating rootfs archive" +echo "[+] Creating artifact" tar \ @@ -264,9 +241,7 @@ tar \ echo -echo "========================================" -echo " EspOS OpenRC rootfs created" -echo -echo " Output:" +echo "=====================================" +echo " EspOS rootfs generated" echo " $OUTPUT" -echo "========================================" \ No newline at end of file +echo "=====================================" \ No newline at end of file