The edition package lists installed BOTH grub-pc and grub-efi-amd64 (+ shim-signed). Those provide the same bootloader role and conflict in apt, so every rootfs build failed with "unable to correct problems, you have held broken packages". A rootfs now carries exactly ONE bootloader, chosen by the BOOT variable (mirroring the existing --boot bios|efi deploy option): - versions.mk / common.sh: BOOT := bios (bios -> grub-pc, efi -> grub-efi-amd64 + shim-signed + mokutil), exported via the Makefile. - build-rootfs.sh validates BOOT early and injects the matching boot packages into the apt install; the static package lists no longer contain any grub package. - deploy-disk.sh / build-image.sh / install.sh default --boot from the same BOOT variable, so a rootfs and the artifact deployed from it can never disagree (BOOT=efi make image-cloud produces a UEFI image). - mokutil is now installed explicitly in the efi flavour (it was not pulled in because we install with --no-install-recommends). - docs updated (building.md knob + rationale, secureboot.md note).
76 lines
3.2 KiB
Bash
Executable File
76 lines
3.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# ─────────────────────────────────────────────────────────────────────────────
|
|
# Arcline OS — scripted installer
|
|
#
|
|
# scripts/install.sh <device> [--edition server] [--boot bios|efi]
|
|
# [--rootfs <dir> | --image <rootfs.tar.xz>]
|
|
#
|
|
# Installs an Arcline OS rootfs onto a real disk:
|
|
#
|
|
# sudo scripts/install.sh /dev/sda --edition server
|
|
# sudo scripts/install.sh /dev/nvme0n1 --edition cloud --image build/artifacts/arcline-cloud-0.1.0-amd64.tar.xz
|
|
#
|
|
# WARNING: this WIPES <device>. You are asked to confirm the exact device path
|
|
# before anything is written.
|
|
# ─────────────────────────────────────────────────────────────────────────────
|
|
set -euo pipefail
|
|
source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
|
|
|
|
DEV="${1:?usage: install.sh <device> [--edition server] [--boot bios|efi] [--rootfs <dir>|--image <tar.xz>]}"
|
|
EDITION="server"
|
|
BOOT="${BOOT:-bios}" # default from the BOOT build variable (see versions.mk)
|
|
ROOTFS_SRC=""
|
|
|
|
shift || true
|
|
while [[ $# -gt 0 ]]; do
|
|
case "$1" in
|
|
--edition) EDITION="${2:?}"; shift 2 ;;
|
|
--boot) BOOT="${2:?}"; shift 2 ;;
|
|
--rootfs) ROOTFS_SRC="${2:?}"; shift 2 ;;
|
|
--image) ROOTFS_SRC="${2:?}"; shift 2 ;;
|
|
*) die "unknown option '$1'" ;;
|
|
esac
|
|
done
|
|
|
|
require_root "$0" "$@"
|
|
validate_edition "$EDITION"
|
|
[[ "$BOOT" == "bios" || "$BOOT" == "efi" ]] || die "--boot must be bios|efi"
|
|
[[ -b "$DEV" ]] || die "'$DEV' is not a block device — refusing to install"
|
|
|
|
# ── resolve rootfs (dir or tarball) ─────────────────────────────────────────
|
|
TMPROOT=""
|
|
if [[ -n "$ROOTFS_SRC" ]]; then
|
|
if [[ -d "$ROOTFS_SRC" ]]; then
|
|
ROOTFS="$ROOTFS_SRC"
|
|
elif [[ -f "$ROOTFS_SRC" ]]; then
|
|
TMPROOT="$(mktemp -d /run/arcline-install.XXXXXX)"
|
|
log "extracting rootfs image: $ROOTFS_SRC"
|
|
tar -xJf "$ROOTFS_SRC" -C "$TMPROOT"
|
|
ROOTFS="$TMPROOT"
|
|
else
|
|
die "rootfs source '$ROOTFS_SRC' not found"
|
|
fi
|
|
else
|
|
ROOTFS="$ROOTFS_DIR/$EDITION"
|
|
[[ -d "$ROOTFS" ]] || die "no rootfs for '$EDITION' at $ROOTFS (build it: make rootfs-$EDITION, or pass --rootfs/--image)"
|
|
fi
|
|
trap '[[ -n "$TMPROOT" ]] && { rm -rf "$TMPROOT"; }' EXIT
|
|
|
|
# ── safety confirmation ─────────────────────────────────────────────────────
|
|
echo
|
|
echo "Arcline OS installer"
|
|
echo " target device : $DEV"
|
|
echo " edition : $EDITION"
|
|
echo " boot : $BOOT"
|
|
echo
|
|
echo "!!! ALL DATA ON $DEV WILL BE DESTROYED !!!"
|
|
read -r -p "Type the device path to confirm ($DEV): " CONFIRM
|
|
[[ "$CONFIRM" == "$DEV" ]] || die "confirmation mismatch — aborting"
|
|
|
|
"$ROOT/scripts/deploy-disk.sh" "$DEV" "$ROOTFS" "$EDITION" --boot "$BOOT"
|
|
|
|
echo
|
|
log "install complete. Remove the installation media and reboot."
|
|
log "After reboot: set a root password and enroll your ssh key"
|
|
log " sudo passwd root"
|