diff options
-rwxr-xr-x | buff-di-wuff | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/buff-di-wuff b/buff-di-wuff new file mode 100755 index 0000000..d14a239 --- /dev/null +++ b/buff-di-wuff @@ -0,0 +1,23 @@ +#!/bin/sh + +set -e + +cache_dir='/var/cache/buff-di-wuff' + +mkdir -p "${cache_dir}" + +grep '^[^#]' '/etc/buff-di-wuff.list' | \ + while read -r url; do + if ! wget -O "${cache_dir}/tmp" "${url}" 2> /dev/null; then + continue + fi + sum="$( + sha512sum "${cache_dir}/tmp" | \ + cut -d' ' -f1 + )" + if [ ! -f "${cache_dir}/${sum}" ]; then + mv "${cache_dir}/tmp" "${cache_dir}/${sum}" + else + rm "${cache_dir}/tmp" + fi + done |