summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-06-18 10:00:56 +0200
committerErich Eckner <git@eckner.net>2018-06-18 10:00:56 +0200
commit89c4c31ce81a0ac7ee3923d4ec8d80c3c7f35220 (patch)
tree85c6f45472559765aea16bef19420f6bb13c87c2
parent7528ff747e340f6398a5cd565f2aaa41bd2ef9c6 (diff)
downloadbuff-di-wuff-89c4c31ce81a0ac7ee3923d4ec8d80c3c7f35220.tar.xz
buff-di-wuff: store by md5sum, too
-rwxr-xr-xbuff-di-wuff26
1 files changed, 17 insertions, 9 deletions
diff --git a/buff-di-wuff b/buff-di-wuff
index 7e28b72..4f4b5de 100755
--- a/buff-di-wuff
+++ b/buff-di-wuff
@@ -5,6 +5,7 @@ set -e
cache_dir='/srv/arch-mirror/sources.archlinux32'
mkdir -p \
+ "${cache_dir}/md5sum" \
"${cache_dir}/sha1sum" \
"${cache_dir}/sha256sum" \
"${cache_dir}/sha512sum"
@@ -38,27 +39,34 @@ grep '^[^#]' "$(dirname "$0")/downloads.list" | \
if ! wget -O "${cache_dir}/tmp" "${url}" 2> /dev/null; then
continue
fi
- sum512=$(
+ sha512=$(
sha512sum "${cache_dir}/tmp" | \
cut -d' ' -f1
)
- sum256=$(
+ sha256=$(
sha256sum "${cache_dir}/tmp" | \
cut -d' ' -f1
)
- sum1=$(
+ sha1=$(
sha1sum "${cache_dir}/tmp" | \
cut -d' ' -f1
)
- if [ ! -f "${cache_dir}/sha512sum/${sum512}" ]; then
- mv "${cache_dir}/tmp" "${cache_dir}/sha512sum/${sum512}"
+ md5=$(
+ md5sum "${cache_dir}/tmp" | \
+ cut -d' ' -f1
+ )
+ if [ ! -f "${cache_dir}/sha512sum/${sha512}" ]; then
+ mv "${cache_dir}/tmp" "${cache_dir}/sha512sum/${sha512}"
else
rm "${cache_dir}/tmp"
fi
- if [ ! -f "${cache_dir}/sha256sum/${sum256}" ]; then
- ln "${cache_dir}/sha512sum/${sum512}" "${cache_dir}/sha256sum/${sum256}"
+ if [ ! -f "${cache_dir}/sha256sum/${sha256}" ]; then
+ ln "${cache_dir}/sha512sum/${sha512}" "${cache_dir}/sha256sum/${sha256}"
+ fi
+ if [ ! -f "${cache_dir}/sha1sum/${sha1}" ]; then
+ ln "${cache_dir}/sha512sum/${sha512}" "${cache_dir}/sha1sum/${sha1}"
fi
- if [ ! -f "${cache_dir}/sha1sum/${sum1}" ]; then
- ln "${cache_dir}/sha512sum/${sum512}" "${cache_dir}/sha1sum/${sum1}"
+ if [ ! -f "${cache_dir}/sha1sum/${md5}" ]; then
+ ln "${cache_dir}/sha512sum/${sha512}" "${cache_dir}/sha1sum/${md5}"
fi
done