From e4677e04f39bfca06ca7b1fb92f89b7684f20e87 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Mon, 19 Jun 2017 13:47:32 +0200 Subject: switch from sshfs to rsync - to avoid needing to remount --- bin/common-functions | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'bin/common-functions') diff --git a/bin/common-functions b/bin/common-functions index 911a580..cc59e94 100755 --- a/bin/common-functions +++ b/bin/common-functions @@ -106,7 +106,7 @@ find_repository_with_commit() { return 0 fi done - >&2 echo "can't find repository with commit '$1'" + >&2 printf 'find_repository_with_commit: Cannot find repository with commit "%s"\n' "$1" exit 1 } @@ -299,18 +299,30 @@ official_or_community() { esac } -# remove_old_package_versions $package_file -# removes all other versions of $package_file in the current directory +# remove_old_package_versions $directory $package_file +# removes all other versions of $package_file in $directory on the master mirror remove_old_package_versions() { - local package="$1" + local directory="$1" + local package="$2" + local pkgname="${package%-*-*-*.pkg.tar.xz}" - ls | \ - grep "^$(str_to_regex "${pkgname}")\(-[^-]\+\)\{3\}\.pkg\.tar\.xz\(\.sig\)\?\$" | \ - grep -v "^$(str_to_regex "${package}")\(\.sig\)\?\$" | \ - xargs -rn1 rm + ${master_mirror_command} \ + --recursive \ + --delete \ + $( \ + ${master_mirror_command} \ + "${master_mirror_directory}/${directory}/" | \ + awk '{print $5}' | \ + grep "^$(str_to_regex "${pkgname}")\(-[^-]\+\)\{3\}\.pkg\.tar\.xz\(\.sig\)\?\$" | \ + grep -v "^$(str_to_regex "${package}")\(\.sig\)\?\$" | \ + sed 's|^|--include=|' + ) \ + '--exclude=*' \ + ./ \ + "${master_mirror_directory}/${directory}/" } -- cgit v1.2.3-54-g00ecf