Commit ac659635 authored by Vitaly Lipatov's avatar Vitaly Lipatov

eget: workaround quotes

parent cfe43f0d
...@@ -133,9 +133,9 @@ if [ "$1" = "-k" ] || [ "$1" = "--no-check-certificate" ] ; then ...@@ -133,9 +133,9 @@ if [ "$1" = "-k" ] || [ "$1" = "--no-check-certificate" ] ; then
fi fi
if [ "$1" = "-U" ] || [ "$1" = "-A" ] || [ "$1" = "--user-agent" ] ; then if [ "$1" = "-U" ] || [ "$1" = "-A" ] || [ "$1" = "--user-agent" ] ; then
user_agent="'Mozilla/5.0 (X11; Linux $arch)'" user_agent="Mozilla/5.0 (X11; Linux $arch)"
WGETUSERAGENT="-U $user_agent" WGETUSERAGENT="-U '$user_agent'"
CURLUSERAGENT="-A $user_agent" CURLUSERAGENT="-A '$user_agent'"
shift shift
fi fi
...@@ -143,40 +143,56 @@ fi ...@@ -143,40 +143,56 @@ fi
WGET="$(which wget 2>/dev/null)" WGET="$(which wget 2>/dev/null)"
if [ -n "$WGET" ] ; then if [ -n "$WGET" ] ; then
__wget()
{
if [ -n "$WGETUSERAGENT" ] ; then
docmd $WGET $WGETQ $WGETNOSSLCHECK "$WGETUSERAGENT" "$@"
else
docmd $WGET $WGETQ $WGETNOSSLCHECK "$@"
fi
}
# put remote content to stdout # put remote content to stdout
scat() scat()
{ {
docmd $WGET $WGETQ "$WGETUSERAGENT" $WGETNOSSLCHECK -O- "$1" __wget $WGETNOSSLCHECK -O- "$1"
} }
# download to default name of to $2 # download to default name of to $2
sget() sget()
{ {
if [ -n "$2" ] ; then if [ -n "$2" ] ; then
docmd $WGET $WGETQ "$WGETUSERAGENT" $WGETNOSSLCHECK $WGETOPTIONS -O "$2" "$1" docmd __wget $WGETOPTIONS -O "$2" "$1"
else else
# TODO: поддержка rsync для известных хостов? # TODO: поддержка rsync для известных хостов?
# Не качать, если одинаковый размер и дата # Не качать, если одинаковый размер и дата
# -nc # -nc
# TODO: overwrite always # TODO: overwrite always
docmd $WGET $WGETQ "$WGETUSERAGENT" $WGETNOSSLCHECK $WGETOPTIONS "$1" docmd __wget $WGETOPTIONS "$1"
fi fi
} }
else else
CURL="$(which curl 2>/dev/null)" CURL="$(which curl 2>/dev/null)"
[ -n "$CURL" ] || fatal "There are no wget nor curl in the system. Install it with $ epm install curl" [ -n "$CURL" ] || fatal "There are no wget nor curl in the system. Install it with $ epm install curl"
__curl()
{
if [ -n "$CURLUSERAGENT" ] ; then
docmd $CURL -L $CURLQ "$CURLUSERAGENT" $CURLNOSSLCHECK "$@"
else
docmd $CURL -L $CURLQ $CURLNOSSLCHECK "$@"
fi
}
# put remote content to stdout # put remote content to stdout
scat() scat()
{ {
$CURL -L $CURLQ "$CURLUSERAGENT" $CURLNOSSLCHECK "$1" __curl "$1"
} }
# download to default name of to $2 # download to default name of to $2
sget() sget()
{ {
if [ -n "$2" ] ; then if [ -n "$2" ] ; then
docmd $CURL -L $CURLQ "$CURLUSERAGENT" $CURLNOSSLCHECK $CURLOPTIONS --output "$2" "$1" __curl $CURLOPTIONS --output "$2" "$1"
else else
docmd $CURL -L $CURLQ "$CURLUSERAGENT" $CURLNOSSLCHECK $CURLOPTIONS -O "$1" __curl $CURLOPTIONS -O "$1"
fi fi
} }
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