mirror of
https://github.com/Luzifer/archrepo.git
synced 2024-12-30 01:41:23 +00:00
Fix: Sign database when modifying
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
f71e60ab8e
commit
18292fdd30
1 changed files with 7 additions and 4 deletions
|
@ -2,9 +2,12 @@
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
function log() {
|
function log() {
|
||||||
echo "[$(date +%H:%M:%S)] $@" >&2
|
echo "[$(date +%H:%M:%S)] $@" >&2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
add_opts=()
|
||||||
|
[[ -z ${REPOKEY:-} ]] || add_opts+=(-s --key ${REPOKEY})
|
||||||
|
|
||||||
syncdir="${REPO_DIR:-$(pwd)}"
|
syncdir="${REPO_DIR:-$(pwd)}"
|
||||||
|
|
||||||
log "Cleaning up old package versions..."
|
log "Cleaning up old package versions..."
|
||||||
|
@ -14,12 +17,12 @@ log "Adding remaining packages to database..."
|
||||||
packages=($(find "${syncdir}" -regextype egrep -regex '^.*\.pkg\.tar(\.xz|\.zst)$' | sort))
|
packages=($(find "${syncdir}" -regextype egrep -regex '^.*\.pkg\.tar(\.xz|\.zst)$' | sort))
|
||||||
|
|
||||||
if [ "${#packages[@]}" -eq 0 ]; then
|
if [ "${#packages[@]}" -eq 0 ]; then
|
||||||
log "No packages found to add to repo, this looks like an error!"
|
log "No packages found to add to repo, this looks like an error!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
log "Adding packages..."
|
log "Adding packages..."
|
||||||
repo-add --new --prevent-downgrade "${DATABASE}" "${packages[@]}"
|
repo-add ${add_opts[@]} --new --prevent-downgrade "${DATABASE}" "${packages[@]}"
|
||||||
|
|
||||||
log "All packages added, removing *.old copies..."
|
log "All packages added, removing *.old copies..."
|
||||||
find "${syncdir}" -name '*.old' -delete
|
find "${syncdir}" -name '*.old' -delete
|
||||||
|
|
Loading…
Reference in a new issue