diff options
author | Erich Eckner <git@eckner.net> | 2018-06-18 10:00:56 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2018-06-18 10:00:56 +0200 |
commit | 89c4c31ce81a0ac7ee3923d4ec8d80c3c7f35220 (patch) | |
tree | 85c6f45472559765aea16bef19420f6bb13c87c2 | |
parent | 7528ff747e340f6398a5cd565f2aaa41bd2ef9c6 (diff) | |
download | buff-di-wuff-89c4c31ce81a0ac7ee3923d4ec8d80c3c7f35220.tar.xz |
buff-di-wuff: store by md5sum, too
-rwxr-xr-x | buff-di-wuff | 26 |
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 |