Files
AlvinArch/localrepo/update.sh
T
alvinlollo 83ed87f6a9
Tests / tests (push) Successful in 2m35s
feat(iso): build end-4 deps in-image, ship end4-pC as default shell
- customize_airootfs.sh stages dots-hyprland at /opt, runs ./setup
  install-deps as a throwaway builder, harvests the built packages into
  /opt/localrepo so pacstrap resolves them offline
- image ships its own [local-aur] (file:///opt/localrepo); CI and
  localrepo/update.sh keep that copy in sync; .gitignore covers work/,
  out/ and airootfs/opt/localrepo/
- alvin-install runs ./setup install --skip-alldeps on the target
- clone pctrade/end4-pC into /etc/skel/.config/quickshell, patch qsConfig
  ii -> end4-pC in the staged variables.lua (guarded + idempotent), and
  restore the fork after setup rsync --delete's ~/.config/quickshell
- ship user presets in skel, point fish `q` alias at end4-pC
- AGENTS.md: document the fourth package source and new gotchas
2026-09-27 10:31:49 +10:00

59 lines
2.1 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
# Sync local AUR repository: puts any package files you pass in into
# ./localrepo, rebuilds the repo database from every *.pkg.tar.zst there,
# and appends each package's name to packages.x86_64 so it gets installed
# into the ISO.
#
# Usage: ./localrepo/update.sh pkg1.pkg.tar.zst [pkg2.pkg.tar.zst ...]
# ./localrepo/update.sh # just re-add whatever is there
repo_name="local-aur"
profile_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)"
repo_dir="${profile_dir}/localrepo"
for f in "$@"; do
[[ -f "${f}" ]] || { echo "error: not a file: ${f}" >&2; exit 1; }
mv -n -- "${f}" "${repo_dir}/"
done
mapfile -t pkgs < <(find "${repo_dir}" -maxdepth 1 -name '*.pkg.tar.zst' -print | sort)
if [[ ${#pkgs[@]} -eq 0 ]]; then
echo "No .pkg.tar.zst files in ${repo_dir}" >&2
# keep the medium's copy honest too - an emptied localrepo/ must not
# leave the previous packages shipping on the next build
rm -rf "${profile_dir}/airootfs/opt/localrepo"
exit 0
fi
repo-add -R "${repo_dir}/${repo_name}.db.tar.gz" "${pkgs[@]}"
# Sync the medium's copy: the ISO ships its own [local-aur] at
# airootfs/opt/localrepo (pacman.conf on the live system points there, and
# pacstrap resolves these packages from it at install time).
img_repo="${profile_dir}/airootfs/opt/localrepo"
mkdir -p "${img_repo}"
rm -f "${img_repo}"/*.pkg.tar.zst "${img_repo}/${repo_name}".db \
"${img_repo}/${repo_name}".db.tar.gz "${img_repo}/${repo_name}".files \
"${img_repo}/${repo_name}".files.tar.gz
cp -f "${pkgs[@]}" "${img_repo}/"
cp -fL "${repo_dir}/${repo_name}".db* "${repo_dir}/${repo_name}".files* "${img_repo}/"
echo "Medium copy ready: ${img_repo}"
new_names=()
for p in "${pkgs[@]}"; do
name=$(tar -xOf "${p}" .PKGINFO | sed -n 's/^pkgname = //p' | head -1)
new_names+=("${name}")
done
pkgfile="${profile_dir}/packages.x86_64"
touch "${pkgfile}"
for name in "${new_names[@]}"; do
grep -qxF "${name}" "${pkgfile}" || echo "${name}" >> "${pkgfile}"
done
sort -u -o "${pkgfile}" "${pkgfile}"
echo "Local repo ready. packages.x86_64 now includes:"
printf ' %s\n' "${new_names[@]}"