- tests: match localrepo packages by exact name (foo no longer satisfied by foo-bar-*.pkg.tar.zst). - update.sh: copy the db/files by name so repo-add's *.old backups stay off the medium. - build-end4-deps.sh: rebuild a local PKGBUILD when it is newer than the built package (a quickshell _commit bump used to be skipped). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
60 lines
2.2 KiB
Bash
Executable File
60 lines
2.2 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}/"
|
|
# explicit names: a .db* glob would also ship repo-add's *.tar.gz.old backups
|
|
cp -fL "${repo_dir}/${repo_name}".{db,db.tar.gz,files,files.tar.gz} "${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[@]}" |