summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2017-10-16 09:03:38 +0200
committerErich Eckner <git@eckner.net>2017-10-16 09:03:38 +0200
commiteb23c487c95771151402deb41c8883fd5f357d78 (patch)
tree472ff63936af636a2930ec410eb7d2a47d9aa7f2
parent989d590e79e47e38d7f2d5d53fed0cb132d6bc99 (diff)
downloadbuff-di-wuff-eb23c487c95771151402deb41c8883fd5f357d78.tar.xz
buff-di-wuff: allow (limited) *-pattern as dl-url
-rwxr-xr-xbuff-di-wuff23
1 files changed, 23 insertions, 0 deletions
diff --git a/buff-di-wuff b/buff-di-wuff
index eea49d7..69b0d09 100755
--- a/buff-di-wuff
+++ b/buff-di-wuff
@@ -8,6 +8,29 @@ mkdir -p "${cache_dir}"
grep '^[^#]' '/etc/buff-di-wuff.list' | \
while read -r url; do
+ if echo "${url}" | \
+ grep -q '\*[^/]*$'; then
+ urlDir=$(
+ printf '%s\n' "${url}" | \
+ sed 's|/[^/]*$|/|'
+ )
+ urlFile=$(
+ printf '%s\n' "${url}" | \
+ sed '
+ s|^.*/||
+ s|\.|\.|g
+ s|*|.*|g
+ '
+ )
+ wget -O - "${urlDir}" 2> /dev/null | \
+ tr '"<>' '\n' | \
+ grep "^${urlFile}\$" | \
+ sort -u
+ else
+ printf '%s\n' "${url}"
+ fi
+ done | \
+ while read -r url; do
if ! wget -O "${cache_dir}/tmp" "${url}" 2> /dev/null; then
continue
fi