summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-06-06 12:13:11 +0200
committerErich Eckner <git@eckner.net>2018-06-06 12:13:11 +0200
commit7528ff747e340f6398a5cd565f2aaa41bd2ef9c6 (patch)
treec45c93863c14ede79aae959fe1e878cef67978aa
parent5eb1b8fb9ecb7032ef9d674f1e32833f01e2084e (diff)
downloadbuff-di-wuff-7528ff747e340f6398a5cd565f2aaa41bd2ef9c6.tar.xz
buff-di-wuff: save files in dirs by checksum type
-rwxr-xr-xbuff-di-wuff17
1 files changed, 10 insertions, 7 deletions
diff --git a/buff-di-wuff b/buff-di-wuff
index e69510a..7e28b72 100755
--- a/buff-di-wuff
+++ b/buff-di-wuff
@@ -4,7 +4,10 @@ set -e
cache_dir='/srv/arch-mirror/sources.archlinux32'
-mkdir -p "${cache_dir}"
+mkdir -p \
+ "${cache_dir}/sha1sum" \
+ "${cache_dir}/sha256sum" \
+ "${cache_dir}/sha512sum"
grep '^[^#]' "$(dirname "$0")/downloads.list" | \
while read -r url; do
@@ -47,15 +50,15 @@ grep '^[^#]' "$(dirname "$0")/downloads.list" | \
sha1sum "${cache_dir}/tmp" | \
cut -d' ' -f1
)
- if [ ! -f "${cache_dir}/${sum512}" ]; then
- mv "${cache_dir}/tmp" "${cache_dir}/${sum512}"
+ if [ ! -f "${cache_dir}/sha512sum/${sum512}" ]; then
+ mv "${cache_dir}/tmp" "${cache_dir}/sha512sum/${sum512}"
else
rm "${cache_dir}/tmp"
fi
- if [ ! -f "${cache_dir}/${sum256}" ]; then
- ln "${cache_dir}/${sum512}" "${cache_dir}/${sum256}"
+ if [ ! -f "${cache_dir}/sha256sum/${sum256}" ]; then
+ ln "${cache_dir}/sha512sum/${sum512}" "${cache_dir}/sha256sum/${sum256}"
fi
- if [ ! -f "${cache_dir}/${sum1}" ]; then
- ln "${cache_dir}/${sum512}" "${cache_dir}/${sum1}"
+ if [ ! -f "${cache_dir}/sha1sum/${sum1}" ]; then
+ ln "${cache_dir}/sha512sum/${sum512}" "${cache_dir}/sha1sum/${sum1}"
fi
done