Skip to content

Commit

Permalink
dominodownload: Run Curl with silent option if -silent is specified. …
Browse files Browse the repository at this point in the history
…use only basename if download file has a slash
  • Loading branch information
Daniel-Nashed committed Dec 8, 2024
1 parent 834ba4c commit f6e190b
Showing 1 changed file with 26 additions and 7 deletions.
33 changes: 26 additions & 7 deletions domdownload.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,12 @@
# 1.0.4 Add error checks for fileURL results specially for license accept returned errors
# 1.0.5 Support for Alpine Linux
# 1.0.6 Allow custom download without authentication. Support for custom authentication
# 1.0.7 Run Curl with silent option if -silent is specified. use only basename if download file has a slash

SCRIPT_NAME=$0
SCRIPT_DIR=$(dirname $SCRIPT_NAME)

DOMDOWNLOAD_SCRIPT_VERSION=1.0.6
DOMDOWNLOAD_SCRIPT_VERSION=1.0.7

# Just print version and exit
case "$1" in
Expand Down Expand Up @@ -2338,12 +2339,6 @@ fi

CheckEnvironment

CURL_CMD="$CURL_BIN --max-redirs 10 --connect-timeout 15 --max-time 300 $SPECIAL_CURL_ARGS"
CURL_DOWNLOAD_CMD="$CURL_BIN --max-redirs 10 --fail --connect-timeout 15 --max-time $CURL_DOWNLOAD_TIMEOUT $SPECIAL_CURL_ARGS"

if [ -z "$MAX_JSON_FILE_AGE_MIN" ]; then
MAX_JSON_FILE_AGE_MIN=10
fi

PRODUCT_JSON_FILE=$DOMDOWNLOAD_CFG_DIR/product.json
SOFTWARE_JSON_FILE=$DOMDOWNLOAD_CFG_DIR/software.json
Expand Down Expand Up @@ -2482,7 +2477,15 @@ for a in "$@"; do
;;

-silent)

SILENT_MODE=yes

if [ -z "$SPECIAL_CURL_ARGS" ]; then
SPECIAL_CURL_ARGS=-s
else
SPECIAL_CURL_ARGS="$SPECIAL_CURL_ARGS -s"
fi

;;

-debug)
Expand Down Expand Up @@ -2539,6 +2542,15 @@ for a in "$@"; do

done


CURL_CMD="$CURL_BIN --max-redirs 10 --connect-timeout 15 --max-time 300 $SPECIAL_CURL_ARGS"
CURL_DOWNLOAD_CMD="$CURL_BIN --max-redirs 10 --fail --connect-timeout 15 --max-time $CURL_DOWNLOAD_TIMEOUT $SPECIAL_CURL_ARGS"

if [ -z "$MAX_JSON_FILE_AGE_MIN" ]; then
MAX_JSON_FILE_AGE_MIN=10
fi


PerfTimerLogSession
GetSoftwareConfig

Expand Down Expand Up @@ -2620,6 +2632,13 @@ fi

if [ -n "$DOWNLOAD_WEB_KIT_NAME" ]; then

# Also work when invoked with a full path or URL
case "$DOWNLOAD_WEB_KIT_NAME" in
*/*)
DOWNLOAD_WEB_KIT_NAME=$(basename $DOWNLOAD_WEB_KIT_NAME)
;;
esac

OUTFILE_WEBKIT_FULLPATH="$SOFTWARE_DIR/$DOWNLOAD_WEB_KIT_NAME"
if [ -e "$OUTFILE_WEBKIT_FULLPATH" ]; then

Expand Down

0 comments on commit f6e190b

Please sign in to comment.