#!/usr/bin/env bash # Build the Phoebus installer + live-desktop ISO. # # The live medium is a Debian rootfs carrying the Mango + DankMaterialShell # desktop; the installed target is Gentoo. The desktop stack comes from the # signed Debian testing archive (wlroots 0.20, scenefx 0.5, quickshell) plus # pinned, SHA-256-verified upstream releases for Mango (built from source) and # DankMaterialShell (prebuilt release tarball). No `curl | sh`, no live/git # packages and no disabled signature checks anywhere. # # The build is rootless: mmdebstrap runs in an unprivileged user namespace and # the rootfs is materialised as a tar, extracted and packed with mksquashfs. # Nothing on the host is modified. The installed system is always Gentoo; # Debian packages never enter the Gentoo target. # # Requirements: mmdebstrap, xorriso, squashfs-tools, curl, dpkg-deb, unshare, # and the static installer built first (see README.md). set -euo pipefail here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" root="$(cd "$here/../.." && pwd)" # The rootless build maps a subuid for the unprivileged user namespace, which # cannot traverse a 0750 home directory. The default work directory is therefore # world-traversable; override with WORKDIR. work="${WORKDIR:-/var/tmp/phoebus-live/build}" out="${OUT:-$here/phoebus-installer-amd64.iso}" base="${BASE_ISO:-$root/debian-live-standard.iso}" suite="${SUITE:-testing}" mirror="${MIRROR:-http://deb.debian.org/debian}" mango_version="${MANGO_VERSION:-0.17.2}" dms_version="${DMS_VERSION:-1.6.2}" target="x86_64-unknown-linux-gnu" release_src="$root/installer-rs/target/$target/release" base_url="https://cdimage.debian.org/debian-cd/current-live/amd64/iso-hybrid/debian-live-13.7.0-amd64-standard.iso" base_sha="$(awk '{print $1}' "$here/base.sha256")" say() { printf '\n== %s ==\n' "$*"; } # --------------------------------------------------------------------------- say "preflight" for c in mmdebstrap xorriso mksquashfs curl dpkg-deb unshare sha256sum; do command -v "$c" >/dev/null || { echo "missing tool: $c" >&2; exit 1; } done if ! command -v magick >/dev/null 2>&1 \ && ! command -v convert >/dev/null 2>&1 \ && ! command -v inkscape >/dev/null 2>&1; then echo "missing an SVG rasteriser for the boot background (magick, convert or inkscape)" >&2 exit 1 fi for b in phoebus-installer sys; do [[ -x "$release_src/$b" ]] || { echo "missing $release_src/$b; build it first:" >&2 echo " cd installer-rs && RUSTFLAGS=\"-C target-feature=+crt-static\" \\" >&2 echo " cargo build --release -p phoebus-installer --target $target" >&2 exit 1 } done mkdir -p "$work/src" "$work/assets" "$work/release" # mmdebstrap's rootless user namespace reads and writes these as a mapped uid. chmod 0777 "$work" chmod 0755 "$work/src" "$work/assets" "$work/release" install -m 0755 "$release_src/phoebus-installer" "$work/release/phoebus-installer" install -m 0755 "$release_src/sys" "$work/release/sys" release_dir="$work/release" # --------------------------------------------------------------------------- say "base ISO" if [[ ! -f "$base" ]]; then echo "downloading $base_url" curl -fL --retry 3 -o "$base" "$base_url" fi echo "$base_sha $base" | sha256sum -c - >/dev/null || { echo "base ISO checksum mismatch" >&2; exit 1; } echo "base OK: $base" # --------------------------------------------------------------------------- say "fetch and verify pinned desktop releases" fetch_verified() { local url="$1" file="$2" if [[ ! -f "$work/src/$file" ]]; then echo "fetching $file" curl -fL --retry 3 -o "$work/src/$file" "$url" fi if ! (cd "$work/src" && sha256sum -c "$here/releases.sha256" --ignore-missing) >/dev/null 2>&1; then echo "checksum mismatch for $file (see $here/releases.sha256)" >&2 exit 1 fi } fetch_verified \ "https://github.com/mangowm/mango/archive/refs/tags/${mango_version}.tar.gz" \ "mango-${mango_version}.tar.gz" fetch_verified \ "https://github.com/AvengeMedia/DankMaterialShell/releases/download/v${dms_version}/dms-full-amd64.tar.gz" \ "dms-full-amd64.tar.gz" (cd "$work/src" && sha256sum -c "$here/releases.sha256") echo "releases OK" # --------------------------------------------------------------------------- say "emit shared desktop assets" assets=( session-mango session-dwl assistant install welcome menu lock idle mango-config mango-session-target install-desktop wayland-session-mango wayland-session-dwl waybar-config waybar-style greetd-live brand-emblem brand-wordmark brand-wallpaper brand-tokens nvidia-load nvidia-service gpu-report ) for name in "${assets[@]}"; do "$release_dir/phoebus-installer" --emit-asset "$name" > "$work/assets/$name" || { echo "failed to emit asset $name" >&2; exit 1; } [[ -s "$work/assets/$name" ]] || { echo "empty asset $name" >&2; exit 1; } done echo "emitted ${#assets[@]} assets" # --------------------------------------------------------------------------- say "build live desktop rootfs (mmdebstrap, rootless)" # Debian archive keyrings (the host may not ship them). apt's modern # `trusted.gpg.d` only reads `.gpg`/`.asc`, so the Debian `.pgp` files are # copied with a `.gpg` suffix into a directory handed to mmdebstrap. if [[ ! -d "$work/apt-keys" ]]; then keydeb="$work/debian-archive-keyring.deb" curl -fsS -o "$keydeb" \ "https://deb.debian.org/debian/pool/main/d/debian-archive-keyring/debian-archive-keyring_2025.1_all.deb" dpkg-deb -x "$keydeb" "$work/keyring-extract" install -d "$work/apt-keys" for f in "$work/keyring-extract/usr/share/keyrings/"debian-archive-*.pgp; do base="$(basename "$f" .pgp)" cp "$f" "$work/apt-keys/$base.gpg" done fi include_csv="$(grep -vE '^[[:space:]]*(#|$)' "$here/live-packages.list" | paste -sd, -)" [[ -n "$include_csv" ]] || { echo "live-packages.list is empty" >&2; exit 1; } # The live kernel is pinned to Debian **stable** (trixie), not testing. Debian # testing's current kernel (7.2) removed the `strncpy` declaration the 550 # NVIDIA driver still uses, so `nvidia-kernel-dkms` cannot build against it. # Stable is also the project's "stability over novelty" choice, and its 6.12 LTS # kernel is exactly what the base live ISO already ships. The rootfs otherwise # stays on testing for wlroots 0.20 / scenefx 0.5 / Quickshell. say "resolve the stable live kernel" trixie_packages() { curl -fsS "http://deb.debian.org/debian/dists/trixie/main/binary-amd64/Packages.gz" | zcat } trixie_meta_dep() { # meta-package -> the exact versioned dependency atom trixie_packages | awk -v p="$1" 'BEGIN{RS=""} $0 ~ "^Package: "p"\\n" {print; exit}' \ | awk '/^Depends:/{for(i=1;i<=NF;i++){gsub(/[(),]/,"",$i); if($i ~ /^linux-(image|headers)-[0-9]/){print $i; exit}}}' } kernel_image="$(trixie_meta_dep linux-image-amd64)" kernel_headers="$(trixie_meta_dep linux-headers-amd64)" [[ -n "$kernel_image" && -n "$kernel_headers" ]] || { echo "could not resolve the trixie kernel packages" >&2; exit 1; } kernel_base="$(printf '%s' "$kernel_image" | sed -E 's/^linux-image-([0-9][^-+]*).*/\1/')" kernel_kbuild="linux-kbuild-$kernel_base" echo "live kernel: $kernel_image ($kernel_kbuild)" # Drop the rolling kernel metas; install the pinned stable kernel explicitly. include_csv="$(printf '%s' "$include_csv" | tr ',' '\n' \ | grep -vE '^(linux-image-amd64|linux-headers-amd64)$' | paste -sd, -)" include_csv="$include_csv,$kernel_image,$kernel_headers,$kernel_kbuild" # The setup hook runs as the mapped uid, which cannot traverse a 0750 home # directory, so it is staged into the world-traversable work directory. It adds # the trixie suite and pins only the kernel packages to it. setup_hook="$work/phoebus-setup.sh" cat > "$setup_hook" <<'SETUP' #!/bin/bash set -euo pipefail root="$1" mkdir -p "$root/etc/apt/sources.list.d" "$root/etc/apt/preferences.d" echo "deb http://deb.debian.org/debian trixie main contrib non-free non-free-firmware" \ > "$root/etc/apt/sources.list.d/trixie.list" cat > "$root/etc/apt/preferences.d/phoebus-kernel" <<'PREFS' Package: linux-image-* linux-headers-* linux-kbuild-* Pin: release n=trixie Pin-Priority: 1001 PREFS SETUP chmod 0755 "$setup_hook" # The hook runs as the mapped uid, which cannot traverse a 0750 home directory, # so it is staged into the world-traversable work directory. hook_script="$work/livefs-hook.sh" install -m 0755 "$here/livefs-hook.sh" "$hook_script" rootfs_tar="$work/livefs.tar" if [[ "${PHOEBUS_REUSE_ROOTFS:-0}" == "1" && -s "$rootfs_tar" ]]; then echo "reusing existing $rootfs_tar" else rm -f "$rootfs_tar" hook="PHOEBUS_SRC='$work/src' PHOEBUS_RELEASE='$work/release' PHOEBUS_ASSETS='$work/assets' \ MANGO_VERSION='$mango_version' DMS_VERSION='$dms_version' '$hook_script' \"\$1\"" mmdebstrap \ --mode=unshare \ --format=tar \ --variant=standard \ --components=main,contrib,non-free,non-free-firmware \ --keyring="$work/apt-keys" \ --setup-hook="$setup_hook" \ --include="$include_csv" \ --customize-hook="$hook" \ "$suite" "$rootfs_tar" "$mirror" fi [[ -s "$rootfs_tar" ]] || { echo "mmdebstrap did not produce $rootfs_tar" >&2; exit 1; } say "unpack the rootfs" rootfs="$work/rootfs" rm -rf "$rootfs" mkdir -p "$rootfs" # Device nodes cannot be created without privileges and are supplied by # devtmpfs at boot, so `/dev` is recreated empty. tar -xf "$rootfs_tar" -C "$rootfs" --exclude='./dev' install -d -m 0755 "$rootfs/dev" # The live hostname must not leak the build host's name from mmdebstrap. echo "${LIVE_HOSTNAME:-phoebus-live}" > "$rootfs/etc/hostname" printf '127.0.1.1\t%s\n' "${LIVE_HOSTNAME:-phoebus-live}" >> "$rootfs/etc/hosts" say "install the live payload" # Everything below is installed after the (cached) rootfs is extracted, so # PHOEBUS_REUSE_ROOTFS=1 still picks up new binaries, UI and branding. iso_version="${PHOEBUS_VERSION:-0.1.0}" build_id="${PHOEBUS_BUILD_ID:-$(date -u +%Y%m%dT%H%M%SZ)}" install -d -m 0755 "$rootfs/etc/phoebus" install -D -m 0755 "$release_dir/phoebus-installer" "$rootfs/usr/local/bin/phoebus-installer" install -D -m 0755 "$release_dir/sys" "$rootfs/usr/local/bin/sys" install_asset() { local name="$1" dest="$2" mode="${3:-0644}" local src="$work/assets/$name" [[ -f "$src" ]] || { echo "missing emitted asset $name" >&2; exit 1; } install -D -m "$mode" "$src" "$rootfs/$dest" } install_asset session-mango /usr/local/bin/phoebus-session-mango 0755 install_asset session-dwl /usr/local/bin/phoebus-session 0755 install_asset assistant /usr/local/bin/phoebus-assistant 0755 install_asset install /usr/local/bin/phoebus-install 0755 install_asset welcome /usr/local/bin/phoebus-welcome 0755 install_asset menu /usr/local/bin/phoebus-menu 0755 install_asset lock /usr/local/bin/phoebus-lock 0755 install_asset idle /usr/local/bin/phoebus-idle 0755 install_asset mango-config /etc/xdg/mango/config.conf install_asset mango-session-target /usr/lib/systemd/user/mango-session.target install_asset install-desktop /usr/share/applications/phoebus-install.desktop install_asset wayland-session-mango /usr/share/wayland-sessions/phoebus-mango.desktop install_asset wayland-session-dwl /usr/share/wayland-sessions/phoebus-dwl.desktop install_asset waybar-config /etc/xdg/waybar/config install_asset waybar-style /etc/xdg/waybar/style.css # Live-only automatic login (never copied to an installed system). install_asset greetd-live /etc/greetd/config.toml # NVIDIA accelerated driver: load it before greetd/Mango, and provide # diagnostics. The driver modules themselves are built into the rootfs by # livefs-hook.sh; nouveau blacklisting and module options come from Debian's # nvidia-kernel-common, which is the distro's supported configuration. install_asset nvidia-load /usr/local/bin/phoebus-nvidia-load 0755 install_asset gpu-report /usr/local/bin/phoebus-gpu-report 0755 install_asset nvidia-service /usr/lib/systemd/system/phoebus-nvidia.service install -d -m 0755 "$rootfs/etc/systemd/system/multi-user.target.wants" ln -sf /usr/lib/systemd/system/phoebus-nvidia.service \ "$rootfs/etc/systemd/system/multi-user.target.wants/phoebus-nvidia.service" # nvidia-kernel-common loads nvidia-drm unconditionally at boot. On a machine # with no NVIDIA GPU that can leave a failed unit, so remove it and rely on the # gated service above (which is a no-op without an NVIDIA display device). rm -f "$rootfs/etc/modules-load.d/nvidia.conf" # Build-time gate: the assembled rootfs (cached or fresh) MUST carry a complete # NVIDIA payload for its exact kernel, or the build fails. This also writes # /etc/phoebus/nvidia with the bundled driver version, module flavor and kernel. nvidia_version="$(awk '/^Package: nvidia-driver$/{p=1} p&&/^Version:/{print $2; exit}' \ "$rootfs/var/lib/dpkg/status" 2>/dev/null)" [[ -n "$nvidia_version" ]] || { echo "live rootfs has no nvidia-driver package; refusing to ship without the driver" >&2 exit 1 } "$release_dir/phoebus-installer" --verify-live-nvidia "$rootfs" \ --nvidia-version "$nvidia_version" --nvidia-flavor proprietary || { echo "live rootfs NVIDIA payload is incomplete or mismatched" >&2 exit 1 } echo "NVIDIA payload recorded: see /etc/phoebus/nvidia" # Branding: shared vector assets, the app icon and the live-only marker. install_asset brand-emblem /usr/share/phoebus/branding/emblem.svg install_asset brand-wordmark /usr/share/phoebus/branding/wordmark.svg install_asset brand-wallpaper /usr/share/phoebus/branding/wallpaper.svg install_asset brand-tokens /usr/share/phoebus/branding/tokens.json install -D -m 0644 "$work/assets/brand-emblem" \ "$rootfs/usr/share/icons/hicolor/scalable/apps/phoebus.svg" install -D -m 0644 "$here/install-help.txt" "$rootfs/usr/share/phoebus/install-help.txt" printf '%s\n' "$iso_version" > "$rootfs/etc/phoebus/version" printf 'PHOEBUS_BUILD_ID=%s\n' "$build_id" > "$rootfs/etc/phoebus/build" # The live marker gates live-only autostart; it is never written to a target. : > "$rootfs/etc/phoebus/live" # Suppress DankMaterialShell's upstream first-run dialogs on the live medium: # the installer is the first thing the user should see. DMS writes these # markers itself when the dialogs are dismissed; pre-seeding them is its # supported "already welcomed" state. The tmpfiles `Z /home/phoebus` rule # chowns them to the live user at boot. The changelog marker is versioned by # DMS (major.minor), so it is derived from the pinned DMS release. install -d -m 0700 "$rootfs/home/phoebus/.config/DankMaterialShell" : > "$rootfs/home/phoebus/.config/DankMaterialShell/.firstlaunch" : > "$rootfs/home/phoebus/.config/DankMaterialShell/.changelog-${dms_version%.*}" # Quickshell frontend: the welcome window and the graphical installer, each a # self-contained config with the shared Common module materialised. if [[ -d "$here/desktop" ]]; then for cfgname in phoebus-welcome phoebus-install; do [[ -f "$here/desktop/$cfgname/shell.qml" ]] || { echo "live build: missing desktop config $cfgname" >&2; exit 1; } install -d -m 0755 "$rootfs/etc/xdg/quickshell/$cfgname" cp -rL "$here/desktop/$cfgname/." "$rootfs/etc/xdg/quickshell/$cfgname/" done fi # Fail clearly rather than shipping a text ISO labelled as a desktop image. for bin in usr/bin/mango usr/bin/dms; do [[ -e "$rootfs/$bin" ]] || { echo "live rootfs is missing $bin" >&2; exit 1; } done if [[ ! -e "$rootfs/usr/bin/qs" && ! -e "$rootfs/usr/bin/quickshell" ]]; then echo "live rootfs is missing quickshell (qs/quickshell)" >&2 exit 1 fi [[ -f "$rootfs/etc/greetd/config.toml" ]] || { echo "live rootfs has no greetd config" >&2; exit 1; } grep -q "initial_session" "$rootfs/etc/greetd/config.toml" || { echo "live rootfs greetd config is missing live autologin" >&2; exit 1; } [[ -f "$rootfs/usr/share/applications/phoebus-install.desktop" ]] || { echo "live rootfs has no Install Phoebus launcher" >&2; exit 1; } for check in \ usr/local/bin/phoebus-welcome \ etc/xdg/quickshell/phoebus-welcome/shell.qml \ etc/xdg/quickshell/phoebus-install/shell.qml \ usr/share/phoebus/branding/emblem.svg \ usr/share/phoebus/branding/wallpaper.svg \ etc/phoebus/live \ usr/local/bin/phoebus-nvidia-load \ usr/local/bin/phoebus-gpu-report \ usr/lib/systemd/system/phoebus-nvidia.service \ etc/modprobe.d/phoebus-nvidia.conf \ etc/phoebus/nvidia; do [[ -e "$rootfs/$check" ]] || { echo "live rootfs is missing payload: $check" >&2; exit 1; } done echo "desktop payload verified" # --------------------------------------------------------------------------- say "pack live filesystem" # A writable home for the live user. The squashfs is packed all-root, so the # live user's home ownership is restored at boot (the live root is a writable # overlay). install -d -m 0755 "$rootfs/etc/tmpfiles.d" cat > "$rootfs/etc/tmpfiles.d/phoebus-live.conf" <<'EOF' d /home/phoebus 0700 phoebus phoebus - Z /home/phoebus 0700 phoebus phoebus - EOF # `tar` run as an unprivileged user drops setuid/setgid/sticky bits; restore # them from the archive so e.g. `sudo` and `pkexec` work in the live image. # `mksquashfs -all-root` then makes those files setuid/setgid root. python3 - "$rootfs_tar" "$rootfs" <<'PY' import os, sys, tarfile tar_path, rootfs = sys.argv[1], sys.argv[2] with tarfile.open(tar_path) as tar: for member in tar: special = member.mode & 0o7000 if not special: continue target = os.path.join(rootfs, member.name.lstrip("./")) if os.path.lexists(target): current = os.lstat(target).st_mode os.chmod(target, (current & 0o7777) | special) PY # Autoload the VirtIO GPU so the compositor gets a DRM node and a logind seat # (the module is not always pulled in by the initramfs). install -d -m 0755 "$rootfs/etc/modules-load.d" printf 'virtio_gpu\n' > "$rootfs/etc/modules-load.d/phoebus-live-gpu.conf" squashfs="$work/filesystem.squashfs" rm -f "$squashfs" mksquashfs "$rootfs" "$squashfs" \ -noappend -comp zstd -all-root -no-progress >/dev/null echo "squashfs: $(du -h "$squashfs" | cut -f1)" # Package list for the live medium (informational). grep -a '^Package: ' "$rootfs/var/lib/dpkg/status" 2>/dev/null \ | awk '{print $2}' | sort -u > "$work/filesystem.packages" || true # Kernel and initramfs generated inside the rootfs. vmlinuz="$(ls -1 "$rootfs"/boot/vmlinuz-* 2>/dev/null | sort | tail -1 || true)" initrd="$(ls -1 "$rootfs"/boot/initrd.img-* 2>/dev/null | sort | tail -1 || true)" [[ -f "$vmlinuz" ]] || { echo "live rootfs has no vmlinuz" >&2; exit 1; } [[ -f "$initrd" ]] || { echo "live rootfs has no initrd" >&2; exit 1; } cp "$vmlinuz" "$work/vmlinuz" cp "$initrd" "$work/initrd.img" # --------------------------------------------------------------------------- say "patch boot config for serial console and Phoebus branding" bootcfg="$work/bootcfg"; mkdir -p "$bootcfg" xorriso -osirrox on -indev "$base" \ -extract /boot/grub/grub.cfg "$bootcfg/grub.cfg" \ -extract /boot/grub/config.cfg "$bootcfg/config.cfg" \ -extract /boot/grub/live-theme/theme.txt "$bootcfg/theme.txt" >/dev/null 2>&1 chmod u+w "$bootcfg/grub.cfg" "$bootcfg/config.cfg" "$bootcfg/theme.txt" sed -i 's#boot=live components quiet splash findiso=#boot=live components console=ttyS0,115200 noautologin findiso=#' "$bootcfg/grub.cfg" python3 - "$bootcfg/config.cfg" <<'PY' import sys p = sys.argv[1] t = open(p).read() t = t.replace("set default=0\n", "set default=0\nset timeout=5\nserial --unit=0 --speed=115200\n" "terminal_input console serial\nterminal_output console serial\n", 1) t = t.replace("terminal_output gfxterm", "terminal_output gfxterm serial") open(p, "w").write(t) PY # Phoebus identity on the boot menu: rename the entries and use the brand # colours and wallpaper. This only rewrites text/theme files; the boot path is # untouched. python3 - "$bootcfg/grub.cfg" <<'PY' import sys p = sys.argv[1] t = open(p).read() t = t.replace('menuentry "Live system (amd64)"', 'menuentry "Start Phoebus OS (live medium)"') t = t.replace('menuentry "Live system (amd64 fail-safe mode)"', 'menuentry "Phoebus OS (fail-safe graphics)"') # The fail-safe entry is the documented fallback when NVIDIA (or any KMS) # initialisation misbehaves: it disables modesetting and blacklists the NVIDIA # modules for that boot, leaving the basic framebuffer in charge. The normal # entry is unaffected. This is a recovery path, not the default. t = t.replace( 'nosplash vga=788', 'nosplash vga=788 nomodeset ' 'modprobe.blacklist=nvidia,nvidia_modeset,nvidia_uvm,nvidia_drm') open(p, "w").write(t) PY cat > "$bootcfg/theme.cfg" <<'EOF' set color_normal=light-gray/black set color_highlight=black/brown if [ -e /boot/grub/splash.png ]; then set theme=/boot/grub/live-theme/theme.txt else set menu_color_normal=light-gray/black set menu_color_highlight=white/brown fi EOF python3 - "$bootcfg/theme.txt" <<'PY' import sys p = sys.argv[1] t = open(p).read() t = t.replace('title-text: "Live Boot Menu with GRUB"', 'title-text: "Phoebus OS"') t = t.replace('title-color: "#ffffff"', 'title-color: "#e8a33d"') t = t.replace('item_color = "#a8a8a8"', 'item_color = "#f4efe6"') t = t.replace('selected_item_color= "#ffffff"', 'selected_item_color= "#e8a33d"') t = t.replace('fg_color = "#ffffff"', 'fg_color = "#e8a33d"') t = t.replace('bg_color = "#a8a8a8"', 'bg_color = "#3a3a42"') t = t.replace('border_color = "#ffffff"', 'border_color = "#e8a33d"') open(p, "w").write(t) PY # Rasterise the brand wallpaper for the GRUB background (GRUB does not read # SVG). ImageMagick or Inkscape is required; the build fails clearly otherwise. if command -v magick >/dev/null 2>&1; then magick -background none "$work/assets/brand-wallpaper" -resize 1024x768 "$bootcfg/splash.png" elif command -v convert >/dev/null 2>&1; then convert -background none "$work/assets/brand-wallpaper" -resize 1024x768 "$bootcfg/splash.png" elif command -v inkscape >/dev/null 2>&1; then inkscape "$work/assets/brand-wallpaper" -w 1024 -h 768 -o "$bootcfg/splash.png" else echo "no SVG rasteriser (magick/convert/inkscape) for the boot background" >&2 exit 1 fi [[ -s "$bootcfg/splash.png" ]] || { echo "branded boot background is empty" >&2; exit 1; } # --------------------------------------------------------------------------- say "assemble ISO" rm -f "$out" # Replace every kernel/initrd path the base ISO ships (both the canonical # /live/vmlinuz and the versioned name its GRUB config may reference), plus the # live squashfs and serial-patched GRUB config. `-boot_image any keep` preserves # the UEFI/BIOS boot equipment. kmap=() while IFS= read -r path; do [ -n "$path" ] || continue case "$path" in *vmlinuz*) kmap+=(-map "$work/vmlinuz" "$path") ;; *initrd*) kmap+=(-map "$work/initrd.img" "$path") ;; esac done < <(xorriso -indev "$base" -find /live 2>/dev/null \ | tr -d "'" | grep -E '^/live/(vmlinuz|initrd)' | sort -u) xorriso -indev "$base" -outdev "$out" \ -map "$squashfs" /live/filesystem.squashfs \ -map "$work/filesystem.packages" /live/filesystem.packages \ "${kmap[@]}" \ -map "$bootcfg/grub.cfg" /boot/grub/grub.cfg \ -map "$bootcfg/config.cfg" /boot/grub/config.cfg \ -map "$bootcfg/theme.cfg" /boot/grub/theme.cfg \ -map "$bootcfg/theme.txt" /boot/grub/live-theme/theme.txt \ -map "$bootcfg/splash.png" /boot/grub/splash.png \ -boot_image any keep >/dev/null sha256sum "$out" | tee "$out.sha256" ls -lh "$out" echo echo "Built with Mango ${mango_version} + DankMaterialShell ${dms_version}." echo "Live login is automatic; an installed system authenticates via greetd."