2021-10-20 19:25:37 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
function log() {
|
|
|
|
echo "[$(date +%H:%M:%S)] $@" >&2
|
|
|
|
}
|
|
|
|
|
|
|
|
syncdir="${REPO_DIR:-$(pwd)}"
|
|
|
|
|
|
|
|
log "Cleaning up old package versions..."
|
|
|
|
BASE_PATH="${syncdir}" python scripts/remove_old_versions.py
|
|
|
|
|
|
|
|
log "Adding remaining packages to database..."
|
|
|
|
packages=($(find "${syncdir}" -regextype egrep -regex '^.*\.pkg\.tar(\.xz|\.zst)$' | sort))
|
|
|
|
|
|
|
|
if [ "${#packages[@]}" -eq 0 ]; then
|
|
|
|
log "No packages found to add to repo, this looks like an error!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
log "Adding packages..."
|
2021-10-20 21:48:38 +00:00
|
|
|
repo-add --new --prevent-downgrade "${DATABASE}" "${packages[@]}"
|
2021-10-20 19:25:37 +00:00
|
|
|
|
|
|
|
log "All packages added, removing *.old copies..."
|
|
|
|
find "${syncdir}" -name '*.old' -delete
|