From eb23c487c95771151402deb41c8883fd5f357d78 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Mon, 16 Oct 2017 09:03:38 +0200 Subject: buff-di-wuff: allow (limited) *-pattern as dl-url --- buff-di-wuff | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/buff-di-wuff b/buff-di-wuff index eea49d7..69b0d09 100755 --- a/buff-di-wuff +++ b/buff-di-wuff @@ -7,6 +7,29 @@ cache_dir='/var/cache/buff-di-wuff' 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 -- cgit v1.2.3-70-g09d2