Files
os-build/scripts/common.sh
Blake Ridgway bb031ca92f chore: base Arcline OS on Debian trixie (current stable)
Bookworm became oldstable in July 2026 (standard support ended
2026-07-11). A new distro should be built on the current stable, which
is now Trixie (13.6): newer kernel (6.12 LTS vs 6.1, whose LTS ends Dec
2026), newer systemd/containers/toolchains, KDE 6 for the workstation
edition, and a year of stability behind it (full support until
2028-08-09).

- versions.mk / common.sh: DEBIAN_SUITE bookworm -> trixie, kernel 6.1 -> 6.12
- package list header comments: bookworm -> trixie
- GitLab CI: debian:bookworm -> debian:trixie build images
- docs (architecture, building): base references updated

All packages used across the three editions exist in Trixie unchanged.
2026-08-21 14:06:29 -05:00

80 lines
4.2 KiB
Bash
Executable File

#!/usr/bin/env bash
# ─────────────────────────────────────────────────────────────────────────────
# Arcline OS — shared build environment + helpers
#
# Every script under scripts/ sources this first. Values mirror versions.mk;
# when invoked through the Makefile the exported variables take precedence, so
# versions.mk stays the single source of truth.
# ─────────────────────────────────────────────────────────────────────────────
set -euo pipefail
# ── identity ────────────────────────────────────────────────────────────────
: "${DISTRO_NAME:=Arcline OS}"
: "${DISTRO_ID:=arclineos}"
: "${VERSION:=0.1.0}"
: "${RELEASE_NAME:=arclines}"
: "${DEBIAN_SUITE:=trixie}"
: "${DEBIAN_MIRROR:=http://deb.debian.org/debian}"
: "${SECURITY_MIRROR:=http://security.debian.org/debian-security}"
: "${ARCH:=amd64}"
: "${KERNEL_PACKAGE:=linux-image-amd64}"
: "${KERNEL_VERSION:=6.12}"
# Toolchain policy for image builds:
# auto (default) install the Arcline tools if build/debs/*.deb exist,
# otherwise build without them (with a warning)
# skip never install the tools, even if debs are present
# require fail the build if no toolchain debs are available
: "${ARCLINE_TOOLCHAIN:=auto}"
# ── paths (relative to the repo root) ───────────────────────────────────────
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
: "${BUILD_DIR:=$ROOT/build}"
: "${ROOTFS_DIR:=$BUILD_DIR/rootfs}"
: "${IMAGE_DIR:=$BUILD_DIR/iso}"
: "${DEB_DIR:=$BUILD_DIR/debs}"
: "${LOG_DIR:=$BUILD_DIR/logs}"
: "${ARTIFACT_DIR:=$BUILD_DIR/artifacts}"
# Valid edition names, mirroring versions.mk.
EDITIONS=(server workstation cloud)
# ── tool resolution ─────────────────────────────────────────────────────────
# Many build tools (debootstrap, sgdisk, losetup, partprobe, mkfs.vfat,
# grub-install, update-grub) live in /usr/sbin or /sbin. Non-root users and
# service accounts (CI runners, systemd timers) often omit those from PATH,
# which makes `command -v` report them as missing even though the packages are
# installed — and makes direct invocations fail. Prepend the sbin dirs so
# every script finds them regardless of who runs the build.
case ":$PATH:" in
*":/usr/local/sbin:"*|*":/usr/sbin:"*|*":/sbin:"*) ;;
*) export PATH="/usr/local/sbin:/usr/sbin:/sbin:$PATH" ;;
esac
# ── output helpers ──────────────────────────────────────────────────────────
log() { printf '\033[1;34m[arcline]\033[0m %s\n' "$*"; }
warn() { printf '\033[1;33m[arcline]\033[0m warning: %s\n' "$*" >&2; }
die() { printf '\033[1;31m[arcline]\033[0m error: %s\n' "$*" >&2; exit 1; }
# ── path helpers ────────────────────────────────────────────────────────────
edition_dir() { printf '%s/editions/%s' "$ROOT" "$1"; }
validate_edition() {
local e
for e in "${EDITIONS[@]}"; do [[ "$e" == "$1" ]] && return 0; done
die "unknown edition '$1' (expected: ${EDITIONS[*]})"
}
# ── privilege helper ────────────────────────────────────────────────────────
# Builds need root (debootstrap / chroot / mount). If we are not root and sudo
# is present, re-exec under sudo so the rest of the script can assume root.
require_root() {
if [[ $EUID -eq 0 ]]; then
return 0
elif command -v sudo >/dev/null; then
exec sudo -E "$0" "$@"
else
die "build requires root: run with sudo or as root (debootstrap + chroot need it)"
fi
}