deploy-disk.sh had its own hardcoded tool check that was out of sync with check-host-deps.sh, so builds got past the host gate and then failed at deploy time with "missing host tool mkfs.btrfs" (btrfs-progs was never in check-host-deps.sh). - check-host-deps.sh: add mkfs.btrfs/btrfs (btrfs-progs) plus curl/git so `make deps` / check-host-deps --install covers the entire build + deploy path in one go. - deploy-disk.sh: pre-flight now checks the full tool set (sgdisk, partprobe, mkfs.btrfs, btrfs, rsync, wipefs, truncate, + mkfs.vfat for efi) and reports ALL missing tools at once with the exact apt install command, instead of dying on the first one. - build-live.sh: the live image explicitly installs gdisk, parted, dosfstools, btrfs-progs, rsync so the graphical installer always has the deploy tooling regardless of edition.
95 lines
3.4 KiB
Bash
Executable File
95 lines
3.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# ─────────────────────────────────────────────────────────────────────────────
|
|
# Arcline OS — host build-dependency check
|
|
#
|
|
# scripts/check-host-deps.sh → report what's missing
|
|
# scripts/check-host-deps.sh --install → apt-get install what's missing
|
|
#
|
|
# Builds run debootstrap (rootfs), copy overlays (standard tools), and produce
|
|
# a hybrid ISO via grub-mkrescue + mksquashfs.
|
|
# ─────────────────────────────────────────────────────────────────────────────
|
|
set -euo pipefail
|
|
source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
|
|
|
|
NEEDED=(
|
|
"debootstrap|debootstrap"
|
|
"grub-mkrescue|grub2-common"
|
|
"mksquashfs|squashfs-tools"
|
|
"xorriso|xorriso"
|
|
"cpio|cpio"
|
|
"bash|bash"
|
|
# disk images / installer
|
|
"sgdisk|gdisk"
|
|
"partprobe|parted"
|
|
"rsync|rsync"
|
|
"mkfs.vfat|dosfstools"
|
|
"qemu-img|qemu-utils"
|
|
"losetup|util-linux"
|
|
# vendor packaging + secure boot
|
|
"unzip|unzip"
|
|
"dpkg-deb|dpkg"
|
|
"openssl|openssl"
|
|
"sbsign|sbsigntool"
|
|
"sbverify|sbsigntool"
|
|
# hybrid ISO: mtools builds the embedded EFI image that grub-mkrescue uses
|
|
"mformat|mtools"
|
|
# deploy path (deploy-disk.sh): partition, btrfs, and copy tooling
|
|
"mkfs.btrfs|btrfs-progs"
|
|
"btrfs|btrfs-progs"
|
|
# toolchain / vendor downloads
|
|
"curl|curl"
|
|
"git|git"
|
|
)
|
|
|
|
MISSING=()
|
|
for entry in "${NEEDED[@]}"; do
|
|
bin="${entry%%|*}"; pkg="${entry##*|}"
|
|
if ! command -v "$bin" >/dev/null 2>&1; then
|
|
# Distinguish "package not installed" from "installed but not on PATH".
|
|
if command -v dpkg-query >/dev/null 2>&1 && \
|
|
dpkg-query -W -f='${Status}' "$pkg" 2>/dev/null | grep -q "install ok installed"; then
|
|
warn "missing: $bin — package $pkg IS installed but '$bin' is not on PATH (check for /usr/sbin or /sbin in PATH)"
|
|
MISSING+=("$pkg") # still require a working resolution before building
|
|
else
|
|
MISSING+=("$pkg")
|
|
warn "missing: $bin (package: $pkg)"
|
|
fi
|
|
fi
|
|
done
|
|
|
|
# grub-mkrescue assembles the ISO bootloader from the HOST's GRUB modules.
|
|
# A missing x86_64-efi module set produces an ISO with no UEFI boot entry —
|
|
# the exact cause of "make sure there is a bootable uefi x64 image" on UEFI
|
|
# machines. Verify the module dirs directly (they are not binaries).
|
|
for spec in "/usr/lib/grub/x86_64-efi:grub-efi-amd64-bin:UEFI" \
|
|
"/usr/lib/grub/i386-pc:grub-pc-bin:BIOS"; do
|
|
dir="${spec%%:*}"; rest="${spec#*:}"; pkg="${rest%%:*}"; what="${rest##*:}"
|
|
if [[ ! -d "$dir" ]]; then
|
|
warn "missing: GRUB $what modules in $dir (package: $pkg) — ISO will not boot via $what"
|
|
MISSING+=("$pkg")
|
|
fi
|
|
done
|
|
|
|
if [[ ${#MISSING[@]} -eq 0 ]]; then
|
|
log "all host build dependencies present ✓"
|
|
exit 0
|
|
fi
|
|
|
|
if [[ "${1:-}" == "--install" ]]; then
|
|
log "installing: ${MISSING[*]}"
|
|
if [[ $EUID -ne 0 ]] && command -v sudo >/dev/null; then
|
|
sudo apt-get update
|
|
sudo apt-get install -y "${MISSING[@]}"
|
|
else
|
|
apt-get update
|
|
apt-get install -y "${MISSING[@]}"
|
|
fi
|
|
log "dependencies installed ✓"
|
|
else
|
|
echo
|
|
echo "Run the following to install them:"
|
|
echo " sudo apt-get install -y ${MISSING[*]}"
|
|
echo "or: scripts/check-host-deps.sh --install"
|
|
exit 1
|
|
fi
|