diff options
author | Erich Eckner <git@eckner.net> | 2020-06-11 10:22:59 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2020-06-11 10:37:44 +0200 |
commit | e0bfe72eed6b01df5a61710522b2f2d65ad736f9 (patch) | |
tree | 45e3e906e28937da7a494e19179cb7125bc598a8 | |
parent | 5df7268bbaf18c880b3b5dcdf92318417c2b1ea1 (diff) | |
download | arch-mirror-e0bfe72eed6b01df5a61710522b2f2d65ad736f9.tar.xz |
arch-mirror: also delete files from "any/" which are not referenced
-rwxr-xr-x | arch-mirror | 24 |
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 |