Commit 09d58725 authored by Vitaly Lipatov's avatar Vitaly Lipatov

eget: replace dirname/basename with parameter expansion in init_eget

parent 3678f4f3
...@@ -24,14 +24,21 @@ ...@@ -24,14 +24,21 @@
init_eget() init_eget()
{ {
PROGDIR=$(dirname "$0")
PROGNAME=$(basename "$0")
CMDSHELL="/bin/sh" CMDSHELL="/bin/sh"
[ "$PROGDIR" = "." ] && PROGDIR="$(pwd)" case "$0" in
if [ "$0" = "/dev/stdin" ] || [ "$0" = "sh" ] ; then /dev/stdin|sh)
PROGDIR="" PROGDIR=""
PROGNAME="" PROGNAME=""
fi ;;
*/*)
PROGDIR="${0%/*}"
PROGNAME="${0##*/}"
;;
*)
PROGDIR="$(pwd)"
PROGNAME="$0"
;;
esac
} }
init_eget init_eget
...@@ -2465,6 +2472,18 @@ if [ -n "$INPUTFILE" ] ; then ...@@ -2465,6 +2472,18 @@ if [ -n "$INPUTFILE" ] ; then
exit exit
fi fi
is_wildcard()
{
case "$1" in *[*?]*|*\[*|*\]*) return 0 ;; esac
return 1
}
is_query_string()
{
case "$1" in *\?*=*) return 0 ;; esac
return 1
}
# 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" ] && is_wildcard "$URL" && ! is_query_string "$URL" ; 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"
...@@ -2494,18 +2513,6 @@ if [ -n "$LISTONLY" ] ; then ...@@ -2494,18 +2513,6 @@ if [ -n "$LISTONLY" ] ; then
exit exit
fi fi
is_wildcard()
{
case "$1" in *[*?]*|*\[*|*\]*) return 0 ;; esac
return 1
}
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" || is_query_string "$MASK" ; then if [ -z "$SEPMASK" ] && ! is_wildcard "$MASK" || is_query_string "$MASK" ; then
sget "$1" "$TARGETFILE" sget "$1" "$TARGETFILE"
......
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