Commit 90e424c9 authored by Vitaly Lipatov's avatar Vitaly Lipatov

tools_eget: improve getting of url list

parent ad7ba835
......@@ -195,7 +195,7 @@ if echo "$1" | grep -q "^ftp://" ; then
fi
# drop mask part
URL="$(dirname "$1")/"
URL="$(dirname "$1")"
if echo "$URL" | grep -q "[*?]" ; then
fatal "Error: there are globbing symbols (*?) in $URL"
......@@ -209,15 +209,15 @@ fi
get_urls()
{
scat $URL | \
grep -i -o -E 'href="([^\*/"#]+)"' | cut -d'"' -f2
scat $URL/ | \
grep -i -o -P 'href="(.*?)"' | cut -d'"' -f2 | sed -e "s|^./||"
}
if [ -n "$LISTONLY" ] ; then
fn=''
for fn in $(get_urls | filter_glob "$MASK" | filter_order) ; do
# TODO: return full url? someone use old behaviour?
echo "$(basename "$fn")"
echo "$fn" | sed -e "s|$URL/||"
done
test -n "$fn"
exit
......@@ -226,7 +226,8 @@ fi
ERROR=0
fn=''
for fn in $(get_urls | filter_glob "$MASK" | filter_order) ; do
sget "$URL/$(basename "$fn")" || ERROR=1
echo "$fn" | grep -q "://" && furl=$fn || furl="$URL/$fn"
sget "$furl" || ERROR=1
done
test -n "$fn" || ERROR=1
exit $ERROR
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment