aptosaurus.sh: don't run rm via xargs if file list is empty
This commit is contained in:
parent
0430fc5109
commit
e3afca72e0
1 changed files with 1 additions and 1 deletions
|
@ -202,7 +202,7 @@ task_delete-old() {
|
||||||
task_begin "Deleting packages more than ${keep_versions} versions ago";
|
task_begin "Deleting packages more than ${keep_versions} versions ago";
|
||||||
# Find and delete old package versions
|
# Find and delete old package versions
|
||||||
export -f __analyse_package_simple;
|
export -f __analyse_package_simple;
|
||||||
find sources/ -type f -name "*.deb" -print0 | xargs -0 -n1 -P "$(nproc)" -I{} bash -c '__analyse_package_simple "{}"' | sort -k1,2Vr | uniq | awk -v keep_ago=${keep_versions} '{ package=$1; gsub(/^.*\//, "", package); gsub(/_.*+$/, "", package); arch=$1; gsub(/^.*_/, "", arch); gsub(/\.deb$/, "", arch); counts[package arch]++; if(counts[package arch] > keep_ago) print($1); }' | xargs --verbose rm
|
find sources/ -type f -name "*.deb" -print0 | xargs -0 -n1 -P "$(nproc)" -I{} bash -c '__analyse_package_simple "{}"' | sort -k1,2Vr | uniq | awk -v keep_ago=${keep_versions} '{ package=$1; gsub(/^.*\//, "", package); gsub(/_.*+$/, "", package); arch=$1; gsub(/^.*_/, "", arch); gsub(/\.deb$/, "", arch); counts[package arch]++; if(counts[package arch] > keep_ago) print($1); }' | xargs --verbose --no-run-if-empty rm
|
||||||
# Result resultant broken symlinks
|
# Result resultant broken symlinks
|
||||||
find "${dir_repo}" -xtype l -delete -print0 | xargs -0 -n1 echo Deleting;
|
find "${dir_repo}" -xtype l -delete -print0 | xargs -0 -n1 echo Deleting;
|
||||||
task_end "$?";
|
task_end "$?";
|
||||||
|
|
Loading…
Reference in a new issue