Commit ad7bcf8a authored by Vitaly Lipatov's avatar Vitaly Lipatov

eget: add is_wildcard/is_query_string, replace grep in glob checks

parent 879b9d4f
...@@ -2444,7 +2444,7 @@ if [ -n "$INPUTFILE" ] ; then ...@@ -2444,7 +2444,7 @@ if [ -n "$INPUTFILE" ] ; then
fi fi
# https://www.freeoffice.com/download.php?filename=freeoffice-2021-1062.x86_64.rpm # https://www.freeoffice.com/download.php?filename=freeoffice-2021-1062.x86_64.rpm
if [ -z "$NOGLOB" ] && echo "$URL" | grep -q -P "[*\[\]]" ; then if [ -z "$NOGLOB" ] && is_wildcard "$URL" && ! is_query_string "$URL" ; then
fatal "Error: there are globbing symbol (*[]) in $URL. It is allowed only for mask part" fatal "Error: there are globbing symbol (*[]) in $URL. It is allowed only for mask part"
fi fi
...@@ -2474,13 +2474,18 @@ fi ...@@ -2474,13 +2474,18 @@ fi
is_wildcard() is_wildcard()
{ {
echo "$1" | grep -q "[*?]" && return case "$1" in *[*?]*|*\[*|*\]*) return 0 ;; esac
echo "$1" | grep -q "\]" && return return 1
echo "$1" | grep -q "\[" && return }
is_query_string()
{
case "$1" in *\?*=*) return 0 ;; esac
return 1
} }
# If there is no wildcard symbol like asterisk, just download # If there is no wildcard symbol like asterisk, just download
if [ -z "$SEPMASK" ] && ! is_wildcard "$MASK" || echo "$MASK" | grep -q "[?].*="; then if [ -z "$SEPMASK" ] && ! is_wildcard "$MASK" || is_query_string "$MASK" ; then
sget "$1" "$TARGETFILE" sget "$1" "$TARGETFILE"
exit exit
fi fi
......
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