summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2020-06-11 10:22:59 +0200
committerErich Eckner <git@eckner.net>2020-06-11 10:37:44 +0200
commite0bfe72eed6b01df5a61710522b2f2d65ad736f9 (patch)
tree45e3e906e28937da7a494e19179cb7125bc598a8
parent5df7268bbaf18c880b3b5dcdf92318417c2b1ea1 (diff)
downloadarch-mirror-e0bfe72eed6b01df5a61710522b2f2d65ad736f9.tar.xz
arch-mirror: also delete files from "any/" which are not referenced
-rwxr-xr-xarch-mirror24
1 files changed, 24 insertions, 0 deletions
diff --git a/arch-mirror b/arch-mirror
index f942025..b857146 100755
--- a/arch-mirror
+++ b/arch-mirror
@@ -187,6 +187,30 @@ fetch_lastsync() {
remove_unindexed_packages() {
find "$1" \
+ -type d \
+ -name any \
+ -printf '%p\n' \
+ | while read -r any_repo; do
+ {
+ find "${any_repo%/*}" \
+ -name 'any' -prune , \
+ -type l \
+ -name '*.pkg*' \
+ -printf '%f\n' \
+ | sed '
+ s@^@'"${any_repo}"'/@
+ p
+ '
+ find "${any_repo}" \
+ -mindepth 1 \
+ -maxdepth 1 \
+ -printf '%p\n'
+ } \
+ | sort \
+ | uniq -u \
+ | xargs -r rm
+ done
+ find "$1" \
-name '.~tmp~' -prune , \
-name '*.db' -printf '%p\n' \
| while read -r db; do