The ISO no longer carries a cp -r'd copy of the omarchy git checkout
into /root/omarchy and the target /home/$user/.local/share/omarchy.
Instead it builds omarchy-installer + omarchy-settings + omarchy +
omarchy-limine from mounted source trees (${OMARCHY_INSTALLER_PATH:-
../omarchy-installer} and ${OMARCHY_PKGS_PATH:-../omarchy-pkgs}),
drops them in the offline mirror, and pacstraps omarchy-installer
during the target install — which deps-in the other three.
- builder/build-omarchy-packages.sh: new. Builds the four packages
inside the ISO build container using each PKGBUILD's OMARCHY_SRC
override (introduced in Chunk 2). Creates a 'builder' user because
makepkg refuses to run as root. Drops the resulting .pkg.tar.zst
files into the offline-mirror directory.
- builder/build-iso.sh: drop the git clone / -v omarchy mount path;
call build-omarchy-packages.sh first; filter out the locally-built
package names from the rest-of-mirror download so we don't try to
fetch them from the network mirror.
- configs/airootfs/root/.automated_script.sh: replace the install_omarchy
cp-and-source dance with 'arch-chroot pacman -S omarchy-installer'
followed by 'OMARCHY_INSTALL_MODE=offline omarchy-install'. Drop the
big chown/chmod block that was setting up the cloned tree.
use_omarchy_helpers extracts the installer's helpers/ tree directly
from the offline-mirror's omarchy-installer-*.pkg.tar.zst so the live
ISO has access to gum-styled logging before pacstrap.
- bin/omarchy-iso-make: always mount omarchy-installer and omarchy-pkgs
(paths configurable via OMARCHY_INSTALLER_PATH / OMARCHY_PKGS_PATH;
default to ../omarchy-installer and ../omarchy-pkgs). --local-source
is now a back-compat no-op.
114 lines
3.6 KiB
Bash
Executable File
114 lines
3.6 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Abort if anything fails
|
|
set -e
|
|
|
|
# Parse command line arguments
|
|
NO_CACHE=""
|
|
while [[ $# -gt 0 ]]; do
|
|
case $1 in
|
|
--no-cache)
|
|
NO_CACHE=1
|
|
shift
|
|
;;
|
|
--no-boot-offer)
|
|
NO_BOOT_OFFER=1
|
|
shift
|
|
;;
|
|
--local-source)
|
|
# Kept as a flag for back-compat (older callers passed it); the ISO
|
|
# build now always builds from local omarchy-installer + omarchy-pkgs
|
|
# checkouts.
|
|
OMARCHY_MIRROR=edge
|
|
shift
|
|
;;
|
|
--dev)
|
|
OMARCHY_INSTALLER_REF=dev
|
|
OMARCHY_MIRROR=edge
|
|
shift
|
|
;;
|
|
--rc)
|
|
OMARCHY_MIRROR=rc
|
|
OMARCHY_INSTALLER_REF=rc
|
|
shift
|
|
;;
|
|
*)
|
|
echo "Unknown option: $1"
|
|
echo "Usage: $0 [--no-cache] [--no-boot-offer] [--local-source] [--dev] [--rc]"
|
|
exit 1
|
|
;;
|
|
esac
|
|
done
|
|
|
|
# Clear out old packages
|
|
sudo rm -rf /var/cache/pacman/pkg/*
|
|
|
|
# Ensure we have the submodule checked out
|
|
git submodule update --init --recursive --jobs=8
|
|
|
|
# Prepare build repo
|
|
BUILD_SCRIPT="builder/build-iso.sh"
|
|
BUILD_ROOT=$(realpath "${BASH_SOURCE[0]%/*}/..")
|
|
BUILD_RELEASE_PATH="$BUILD_ROOT/release"
|
|
mkdir -p "$BUILD_RELEASE_PATH"
|
|
|
|
OMARCHY_INSTALLER_REPO="${OMARCHY_INSTALLER_REPO:-basecamp/omarchy}"
|
|
OMARCHY_INSTALLER_REF="${OMARCHY_INSTALLER_REF:-master}"
|
|
OMARCHY_MIRROR="${OMARCHY_MIRROR:-stable}"
|
|
|
|
# Source paths for the local package builds. The ISO builder pacstraps
|
|
# locally-built omarchy* packages from /omarchy-installer and /omarchy-pkgs,
|
|
# so these must point at checkouts of those repos.
|
|
OMARCHY_INSTALLER_PATH="${OMARCHY_INSTALLER_PATH:-$BUILD_ROOT/../omarchy-installer}"
|
|
OMARCHY_PKGS_PATH="${OMARCHY_PKGS_PATH:-$BUILD_ROOT/../omarchy-pkgs}"
|
|
[[ -d $OMARCHY_INSTALLER_PATH ]] || { echo "Error: omarchy-installer checkout not found at $OMARCHY_INSTALLER_PATH" >&2; exit 1; }
|
|
[[ -d $OMARCHY_PKGS_PATH ]] || { echo "Error: omarchy-pkgs checkout not found at $OMARCHY_PKGS_PATH" >&2; exit 1; }
|
|
OMARCHY_INSTALLER_PATH=$(realpath "$OMARCHY_INSTALLER_PATH")
|
|
OMARCHY_PKGS_PATH=$(realpath "$OMARCHY_PKGS_PATH")
|
|
|
|
DOCKER_ARGS=(
|
|
--rm
|
|
--privileged
|
|
-e "OMARCHY_INSTALLER_REPO=$OMARCHY_INSTALLER_REPO"
|
|
-e "OMARCHY_INSTALLER_REF=$OMARCHY_INSTALLER_REF"
|
|
-e "OMARCHY_MIRROR=$OMARCHY_MIRROR"
|
|
-e "HOST_UID=$(id -u)"
|
|
-e "HOST_GID=$(id -g)"
|
|
-v "$BUILD_RELEASE_PATH/:/out/"
|
|
-v "$BUILD_ROOT/$BUILD_SCRIPT:/$BUILD_SCRIPT:ro"
|
|
-v "$BUILD_ROOT/archiso:/archiso:ro"
|
|
-v "$BUILD_ROOT/builder:/builder:ro"
|
|
-v "$BUILD_ROOT/configs:/configs:ro"
|
|
-v "$OMARCHY_INSTALLER_PATH:/omarchy-installer:ro"
|
|
-v "$OMARCHY_PKGS_PATH:/omarchy-pkgs:ro"
|
|
)
|
|
|
|
# Use local pacman cache if you already have one on host to speed up repeat runs
|
|
if [ -d "/var/cache/pacman/pkg" ]; then
|
|
DOCKER_ARGS+=(-v "/var/cache/pacman/pkg:/var/cache/pacman/pkg")
|
|
fi
|
|
|
|
# Mount the build cache directory where packages are downloaded
|
|
if [[ -z "$NO_CACHE" ]]; then
|
|
# using a dated dir on the host to refresh daily if building multiple times
|
|
BUILD_DATE=$(date +%Y-%m-%d)
|
|
OFFLINE_REPO_BUILD_CACHE_DIR="$HOME/.cache/omarchy/iso_${BUILD_DATE}/airootfs/var/cache/omarchy"
|
|
mkdir -p "$OFFLINE_REPO_BUILD_CACHE_DIR"
|
|
# Mount to /var/cache/airootfs/var/cache/omarchy since that's where repo packages go in the ISO
|
|
DOCKER_ARGS+=(-v "$OFFLINE_REPO_BUILD_CACHE_DIR:/var/cache/airootfs/var/cache/omarchy")
|
|
fi
|
|
|
|
# Run the builder with assembled args
|
|
docker run "${DOCKER_ARGS[@]}" archlinux/archlinux:latest /$BUILD_SCRIPT
|
|
|
|
# Move as install ref
|
|
latest_iso=$(\ls -t "$BUILD_RELEASE_PATH"/*.iso | head -n1)
|
|
iso_ref="${latest_iso%.*}-$OMARCHY_INSTALLER_REF.iso"
|
|
mv -f "$latest_iso" "$iso_ref"
|
|
|
|
# Offer to boot the new build
|
|
if [[ -z "$NO_BOOT_OFFER" ]]; then
|
|
echo
|
|
gum confirm "Boot $iso_ref?" && omarchy-iso-boot "$iso_ref"
|
|
fi
|