diff --git a/Makefile b/Makefile index 9fbf15a..1a88406 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ export REPO_DIR:=$(CURDIR)/repo export REPOKEY:=D0391BF9 export RETAIN:=1 -export DATABASE:=$(shell find $(REPO_DIR) -maxdepth 1 -mindepth 1 -name '*.db.tar.xz' -or -name '*.db.tar.zst') +export DATABASE:=$(REPO_DIR)/luzifer.db.tar.zst maintanance: do_updates do_cleanup list_packages upload @@ -12,6 +12,7 @@ do_updates: repo_update do_cleanup: cleanup_repo do_cleanup: cleanup_orphan_signatures do_cleanup: sign_database +do_cleanup: cleanup_files download: vault2env --key=secret/aws/private -- aws s3 sync \ @@ -59,6 +60,9 @@ cleanup_orphan_signatures: cleanup_repo: check_tools bash ./scripts/do_cleanup.sh +clear_database: + rm -f $(REPO_DIR)/*.db* $(REPO_DIR)/*.files* + list_packages: tar -tf $(DATABASE) | grep -v '/desc' | sed -E 's/(.*)-([^-]+-[0-9]+)\//\1\t\2/' | sort | column -t >$(REPO_DIR)/packages.txt diff --git a/scripts/do_cleanup.sh b/scripts/do_cleanup.sh index 20e8430..5e94199 100644 --- a/scripts/do_cleanup.sh +++ b/scripts/do_cleanup.sh @@ -10,10 +10,6 @@ syncdir="${REPO_DIR:-$(pwd)}" log "Cleaning up old package versions..." BASE_PATH="${syncdir}" python scripts/remove_old_versions.py -# Ensure removal of previous repo files -log "Cleaning up old database files..." -find "${syncdir}" -regextype egrep -regex '^.*\.(db|files)(|\.tar|\.tar\.xz|\.tar\.zst)$' -delete - log "Adding remaining packages to database..." packages=($(find "${syncdir}" -regextype egrep -regex '^.*\.pkg\.tar(\.xz|\.zst)$' | sort)) @@ -23,7 +19,7 @@ if [ "${#packages[@]}" -eq 0 ]; then fi log "Adding packages..." -repo-add --new --prevent-downgrade "${syncdir}/luzifer.db.tar.xz" "${packages[@]}" +repo-add --new --prevent-downgrade "${DATABASE}" "${packages[@]}" log "All packages added, removing *.old copies..." find "${syncdir}" -name '*.old' -delete