Commit 95db5a19 authored by Vitaly Lipatov's avatar Vitaly Lipatov

eget: add --no-check-certificate support

parent 4b2ce66f
...@@ -103,6 +103,8 @@ docmd() ...@@ -103,6 +103,8 @@ docmd()
check_tty check_tty
WGETNOSSLCHECK=''
CURLNOSSLCHECK=''
WGETQ='' #-q WGETQ='' #-q
CURLQ='' #-s CURLQ='' #-s
WGETOPTIONS='--content-disposition' WGETOPTIONS='--content-disposition'
...@@ -120,6 +122,12 @@ if [ "$1" = "-q" ] ; then ...@@ -120,6 +122,12 @@ if [ "$1" = "-q" ] ; then
shift shift
fi fi
if [ "$1" = "-k" ] || [ "$1" = "--no-check-certificate" ] ; then
WGETNOSSLCHECK='--no-check-certificate'
CURLNOSSLCHECK='-k'
shift
fi
WGET="$(which wget 2>/dev/null)" WGET="$(which wget 2>/dev/null)"
...@@ -127,19 +135,19 @@ if [ -n "$WGET" ] ; then ...@@ -127,19 +135,19 @@ if [ -n "$WGET" ] ; then
# put remote content to stdout # put remote content to stdout
scat() scat()
{ {
docmd $WGET $WGETQ -O- "$1" docmd $WGET $WGETQ $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 $WGETOPTIONS -O "$2" "$1" docmd $WGET $WGETQ $WGETNOSSLCHECK $WGETOPTIONS -O "$2" "$1"
else else
# TODO: поддержка rsync для известных хостов? # TODO: поддержка rsync для известных хостов?
# Не качать, если одинаковый размер и дата # Не качать, если одинаковый размер и дата
# -nc # -nc
# TODO: overwrite always # TODO: overwrite always
docmd $WGET $WGETQ $WGETOPTIONS "$1" docmd $WGET $WGETQ $WGETNOSSLCHECK $WGETOPTIONS "$1"
fi fi
} }
...@@ -149,15 +157,15 @@ CURL="$(which curl 2>/dev/null)" ...@@ -149,15 +157,15 @@ CURL="$(which curl 2>/dev/null)"
# put remote content to stdout # put remote content to stdout
scat() scat()
{ {
$CURL -L $CURLQ "$1" $CURL -L $CURLQ $CURLNOSSLCHECK "$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 $CURLOPTIONS --output "$2" "$1" docmd $CURL -L $CURLQ $CURLNOSSLCHECK $CURLOPTIONS --output "$2" "$1"
else else
docmd $CURL -L $CURLQ $CURLOPTIONS -O "$1" docmd $CURL -L $CURLQ $CURLNOSSLCHECK $CURLOPTIONS -O "$1"
fi fi
} }
fi fi
...@@ -216,6 +224,7 @@ if [ "$1" = "-h" ] || [ "$1" = "--help" ] ; then ...@@ -216,6 +224,7 @@ if [ "$1" = "-h" ] || [ "$1" = "--help" ] ; then
echo echo
echo "Options:" echo "Options:"
echo " -q - quiet mode" echo " -q - quiet mode"
echo " -k|--no-check-certificate - skip SSL certificate chain support"
echo " -O file - download to this file (use filename from server if missed)" echo " -O file - download to this file (use filename from server if missed)"
echo " --list - print files from url with mask" echo " --list - print files from url with mask"
echo " --latest - print only latest version of file" echo " --latest - print only latest version of file"
......
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