From ca0c5b8a50fbf34200912c2635bb8c4b12a820d2 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Thu, 6 Jul 2017 21:45:50 +0200 Subject: Initial commit --- buff-di-wuff | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 buff-di-wuff 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 -- cgit v1.2.3-70-g09d2