Merge omacom/omarchy-iso#241: region from the timezone in one ISO
Drop our --region build, prepare-region.sh, region skel, the preselected China timezone, the explicit region in the configurator's JSON, Rime bundling and its pin.
This commit is contained in:
commit
75d00a2036
14 files changed
+409
-618
No files matched your search
+37
-43
@@ -4,11 +4,6 @@ set -e
|
||||
|
||||
OMARCHY_ISO_REF="${OMARCHY_ISO_REF:-quattro}"
|
||||
OMARCHY_MIRROR="${OMARCHY_MIRROR:-stable}"
|
||||
OMARCHY_REGION="${OMARCHY_REGION:-global}"
|
||||
case "$OMARCHY_REGION" in
|
||||
global|cn) ;;
|
||||
*) echo "Unsupported region: $OMARCHY_REGION" >&2; exit 1 ;;
|
||||
esac
|
||||
|
||||
# Edge, dev, and local-source ISOs install the dev packages explicitly. Those
|
||||
# package recipes track the quattro branch. This avoids relying on pacman's
|
||||
@@ -35,7 +30,7 @@ pacman --noconfirm -Sy archlinux-keyring
|
||||
# so this container can be months behind the mirror it installs from. A plain
|
||||
# -Sy install is then a partial upgrade — new packages linked against a glibc
|
||||
# the container doesn't have yet.
|
||||
pacman --noconfirm -Syu archiso git sudo base-devel jq grub imagemagick neovim nodejs npm tree-sitter-cli go
|
||||
pacman --noconfirm -Syu archiso git sudo base-devel jq grub imagemagick neovim nodejs npm tree-sitter-cli
|
||||
|
||||
# Pre-import the omarchy signing key (so pacman trusts our [omarchy] repo
|
||||
# during the build without keyserver lookups).
|
||||
@@ -75,7 +70,6 @@ cp -r /configs/* "$build_cache_dir/"
|
||||
mkdir -p "$build_cache_dir/airootfs/usr/share/omarchy-iso"
|
||||
echo "$OMARCHY_MIRROR" > "$build_cache_dir/airootfs/root/omarchy_mirror"
|
||||
echo "$OMARCHY_ISO_REF" > "$build_cache_dir/airootfs/root/omarchy_iso_ref"
|
||||
echo "$OMARCHY_REGION" > "$build_cache_dir/airootfs/root/omarchy_region"
|
||||
cat > "$build_cache_dir/airootfs/usr/share/omarchy-iso/package-targets" <<EOF
|
||||
OMARCHY_RUNTIME_PACKAGE=$OMARCHY_RUNTIME_PACKAGE
|
||||
OMARCHY_SETTINGS_PACKAGE=$OMARCHY_SETTINGS_PACKAGE
|
||||
@@ -89,7 +83,6 @@ if [[ ${OMARCHY_INSTALL_DEBUG:-} == "1" ]]; then
|
||||
echo "built_at=$(date -Is)"
|
||||
echo "ref=$OMARCHY_ISO_REF"
|
||||
echo "mirror=$OMARCHY_MIRROR"
|
||||
echo "region=$OMARCHY_REGION"
|
||||
echo "runtime_package=$OMARCHY_RUNTIME_PACKAGE"
|
||||
echo "settings_package=$OMARCHY_SETTINGS_PACKAGE"
|
||||
echo "nvim_package=$OMARCHY_NVIM_PACKAGE"
|
||||
@@ -113,7 +106,7 @@ if [[ -d /omarchy-source && -d /omarchy-pkgs ]]; then
|
||||
bash /builder/build-omarchy-packages.sh "$offline_mirror_dir"
|
||||
LOCAL_OMARCHY_BUILD=1
|
||||
# Published builds of these lack the local changes, so the target pins them.
|
||||
printf '%s\n' "$OMARCHY_RUNTIME_PACKAGE" "$OMARCHY_SETTINGS_PACKAGE" rime-ice-installer \
|
||||
printf '%s\n' "$OMARCHY_RUNTIME_PACKAGE" "$OMARCHY_SETTINGS_PACKAGE" \
|
||||
> "$build_cache_dir/airootfs/usr/share/omarchy-iso/pinned-packages"
|
||||
fi
|
||||
|
||||
@@ -127,20 +120,6 @@ echo "$NODE_SHA /tmp/$NODE_FILENAME" | sha256sum -c -
|
||||
mkdir -p "$build_cache_dir/airootfs/opt/packages/"
|
||||
cp "/tmp/$NODE_FILENAME" "$build_cache_dir/airootfs/opt/packages/"
|
||||
|
||||
# Rime Ice and Wanxiang for offline China installs.
|
||||
rime_dir="$build_cache_dir/airootfs/opt/packages/rime-ice"
|
||||
mkdir -p "$rime_dir"
|
||||
bundle_release_asset() {
|
||||
local url digest
|
||||
read -r url digest < <(curl -fsSL "https://api.github.com/repos/$1/releases/tags/$2" |
|
||||
jq -r --arg name "$3" '.assets[] | select(.name == $name) | "\(.browser_download_url) \(.digest)"') ||
|
||||
{ echo "ERROR: $3 is missing from the $1 $2 release" >&2; exit 1; }
|
||||
curl -fsSL "$url" -o "$rime_dir/$3"
|
||||
echo "${digest#sha256:} $rime_dir/$3" | sha256sum -c -
|
||||
}
|
||||
bundle_release_asset iDvel/rime-ice nightly full.zip
|
||||
bundle_release_asset amzxyz/RIME-LMDG LTS wanxiang-lts-zh-hans.gram
|
||||
|
||||
# Packages installed into the live ISO environment itself (NOT the target system).
|
||||
# The selected omarchy-settings package is needed here so its post_install hook
|
||||
# drops Omarchy's plymouthd.conf into /etc/plymouth before mkarchiso builds the
|
||||
@@ -167,7 +146,7 @@ sed -i -E '/^(linux|broadcom-wl)$/d' "$build_cache_dir/packages.x86_64"
|
||||
# already in the mirror and we filter them out below. Without it, pacman -Syw
|
||||
# pulls the published omarchy* from the network mirror like any other package.
|
||||
if [[ -d /omarchy-source ]]; then
|
||||
runtime_root=/omarchy-source
|
||||
regions_source=/omarchy-source/default/regions
|
||||
base_pkg_lists=(/omarchy-source/install/omarchy-base.packages /omarchy-source/install/omarchy-other.packages)
|
||||
setup_form=/omarchy-source/install/provisioning/setup-form.sh
|
||||
else
|
||||
@@ -184,18 +163,23 @@ else
|
||||
fi
|
||||
mkdir -p /tmp/omarchy-pkglists
|
||||
bsdtar -xf "$omarchy_pkg" -C /tmp/omarchy-pkglists usr/share/omarchy/install/omarchy-base.packages usr/share/omarchy/install/omarchy-other.packages
|
||||
runtime_root=/tmp/omarchy-pkglists/usr/share/omarchy
|
||||
if ! bsdtar -xf "$omarchy_pkg" -C /tmp/omarchy-pkglists \
|
||||
usr/share/omarchy/default/regions/cn usr/share/omarchy/bin/omarchy-apply-pacman; then
|
||||
echo "ERROR: runtime lacks region support; publish a matching runtime or use --local-source." >&2
|
||||
exit 1
|
||||
fi
|
||||
base_pkg_lists=(/tmp/omarchy-pkglists/usr/share/omarchy/install/omarchy-base.packages /tmp/omarchy-pkglists/usr/share/omarchy/install/omarchy-other.packages)
|
||||
# Extracted on its own, tolerating a miss: bsdtar exits non-zero for a member
|
||||
# it can't find, so asking for this alongside the package lists would abort the
|
||||
# build here (set -e) with a bare "Not found in archive" instead of the
|
||||
# actionable error below.
|
||||
bsdtar -xf "$omarchy_pkg" -C /tmp/omarchy-pkglists usr/share/omarchy/install/provisioning/setup-form.sh 2>/dev/null || true
|
||||
# Region profiles live under default/, which the settings package ships,
|
||||
# not the runtime. Its own cache dir keeps the runtime lookup above from
|
||||
# ever matching it.
|
||||
settings_cache_dir="$bootstrap_cache_dir/settings"
|
||||
mkdir -p "$settings_cache_dir"
|
||||
pacman --config /configs/pacman-online-${OMARCHY_MIRROR}.conf --noconfirm -Syw "$OMARCHY_SETTINGS_PACKAGE" --cachedir "$settings_cache_dir" --dbpath /tmp/offlinedb-bootstrap >/dev/null
|
||||
regions_source=$(find "$settings_cache_dir" -maxdepth 1 -type f -name "$OMARCHY_SETTINGS_PACKAGE-*.pkg.tar.zst" | sort | head -1)
|
||||
if [[ -z $regions_source ]]; then
|
||||
echo "ERROR: downloaded package for $OMARCHY_SETTINGS_PACKAGE not found in $settings_cache_dir" >&2
|
||||
exit 1
|
||||
fi
|
||||
setup_form=/tmp/omarchy-pkglists/usr/share/omarchy/install/provisioning/setup-form.sh
|
||||
fi
|
||||
|
||||
@@ -203,16 +187,6 @@ mkdir -p "$build_cache_dir/airootfs/usr/share/omarchy-iso"
|
||||
cp "${base_pkg_lists[0]}" "$build_cache_dir/airootfs/usr/share/omarchy-iso/omarchy-base.packages"
|
||||
cp "${base_pkg_lists[1]}" "$build_cache_dir/airootfs/usr/share/omarchy-iso/omarchy-other.packages"
|
||||
|
||||
# Work on writable copies, leaving the mounted runtime and ISO configs intact.
|
||||
online_config=/tmp/omarchy-pacman-online.conf
|
||||
cp "/configs/pacman-online-${OMARCHY_MIRROR}.conf" "$online_config"
|
||||
# Every ISO offers China on its first screen, whatever region it preselects.
|
||||
bash /builder/prepare-region.sh cn "$runtime_root" "$build_cache_dir/airootfs" "$online_config"
|
||||
base_pkg_lists=(
|
||||
"$build_cache_dir/airootfs/usr/share/omarchy-iso/omarchy-base.packages"
|
||||
"$build_cache_dir/airootfs/usr/share/omarchy-iso/omarchy-other.packages"
|
||||
)
|
||||
|
||||
# The configurator's setup form comes from the runtime this ISO bundles, so the
|
||||
# installer and the first-boot setup that finishes a deferred install can never
|
||||
# disagree. A runtime predating the split ships no such file, which would leave
|
||||
@@ -232,6 +206,24 @@ if [[ ! -f $setup_form ]]; then
|
||||
fi
|
||||
cp "$setup_form" "$build_cache_dir/airootfs/usr/share/omarchy-iso/setup-form.sh"
|
||||
|
||||
# Every region's packages ride in the offline mirror, and its community
|
||||
# repositories join a writable copy of the online config to download them.
|
||||
online_config=/tmp/omarchy-pacman-online.conf
|
||||
cp "/configs/pacman-online-${OMARCHY_MIRROR}.conf" "$online_config"
|
||||
bash /builder/prepare-regions.sh "$regions_source" \
|
||||
"$build_cache_dir/airootfs/usr/share/omarchy-iso" "$online_config"
|
||||
|
||||
# Profiles ship in the settings package, but the finalizer that applies them
|
||||
# ships in the runtime. A runtime without it would ignore the region marker,
|
||||
# leaving regional targets with the keyring but none of the repositories.
|
||||
if [[ -n ${omarchy_pkg:-} && -d $build_cache_dir/airootfs/usr/share/omarchy-iso/regions ]]; then
|
||||
runtime_listing=$(bsdtar -tf "$omarchy_pkg")
|
||||
if ! grep -qx 'usr/bin/omarchy-apply-pacman' <<<"$runtime_listing"; then
|
||||
echo "ERROR: $OMARCHY_SETTINGS_PACKAGE ships region profiles, but $OMARCHY_RUNTIME_PACKAGE lacks omarchy-apply-pacman to apply them." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Collect every package we want available in the offline mirror.
|
||||
declare -a all_packages
|
||||
mapfile -t all_packages < <(
|
||||
@@ -239,6 +231,9 @@ mapfile -t all_packages < <(
|
||||
cat "$build_cache_dir/packages.x86_64"
|
||||
grep -hv '^#\|^$' "${base_pkg_lists[@]}"
|
||||
grep -hv '^#\|^$' /builder/archinstall.packages
|
||||
# Downloaded but not installed: the installer adds a region's packages
|
||||
# only to targets in that region.
|
||||
grep -hsv '^#\|^$' "$build_cache_dir"/airootfs/usr/share/omarchy-iso/regions/*/packages || true
|
||||
# Always include the selected Omarchy packages so the target install can
|
||||
# find the runtime and companion packages in the offline mirror.
|
||||
printf '%s\n' "$OMARCHY_RUNTIME_PACKAGE" "$OMARCHY_SETTINGS_PACKAGE" "$OMARCHY_NVIM_PACKAGE"
|
||||
@@ -271,8 +266,7 @@ if [[ -n ${LOCAL_OMARCHY_BUILD:-} ]]; then
|
||||
grep -Fxv \
|
||||
-e "$OMARCHY_RUNTIME_PACKAGE" \
|
||||
-e "$OMARCHY_SETTINGS_PACKAGE" \
|
||||
-e "$OMARCHY_NVIM_PACKAGE" \
|
||||
-e rime-ice-installer || true
|
||||
-e "$OMARCHY_NVIM_PACKAGE" || true
|
||||
)
|
||||
fi
|
||||
|
||||
@@ -309,7 +303,7 @@ mapfile -t required_package_files <<< "$resolved_package_files"
|
||||
# that the local build left exactly one file for each selected package name.
|
||||
if [[ -n ${LOCAL_OMARCHY_BUILD:-} ]]; then
|
||||
for local_package_name in \
|
||||
"$OMARCHY_RUNTIME_PACKAGE" "$OMARCHY_SETTINGS_PACKAGE" "$OMARCHY_NVIM_PACKAGE" rime-ice-installer; do
|
||||
"$OMARCHY_RUNTIME_PACKAGE" "$OMARCHY_SETTINGS_PACKAGE" "$OMARCHY_NVIM_PACKAGE"; do
|
||||
local_package_file=""
|
||||
for candidate in "$offline_mirror_dir/$local_package_name-"*.pkg.tar.*; do
|
||||
[[ -f $candidate && $candidate != *.sig ]] || continue
|
||||
|
||||
Reference in new issue
Block a user