summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2017-07-06 21:45:50 +0200
committerErich Eckner <git@eckner.net>2017-07-06 21:45:50 +0200
commitca0c5b8a50fbf34200912c2635bb8c4b12a820d2 (patch)
tree9b13bbd6e981806c8cc066e431103a0a6c569fce
downloadbuff-di-wuff-ca0c5b8a50fbf34200912c2635bb8c4b12a820d2.tar.xz
Initial commit
-rwxr-xr-xbuff-di-wuff23
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