diff options
-rwxr-xr-x | buff-di-wuff | 17 |
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 |