Skip to content

Instantly share code, notes, and snippets.

@zdi-team
Created May 24, 2021 17:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zdi-team/7bcf4c0d52b733a48e80a49c5b6607db to your computer and use it in GitHub Desktop.
Save zdi-team/7bcf4c0d52b733a48e80a49c5b6607db to your computer and use it in GitHub Desktop.
get_tar_by_url ()
{
mkdir $TMP_DIR
if [ "$NOPROMPT" -eq 0 ]; then
echo "Trying to get upgrade file from $TAR"
fi
if [ -n "$USERNAME" ]; then
auth="-u $USERNAME:$PASSWORD"
else
auth=""
fi
filename="${TMP_DIR}/${TAR##*/}"
if [ "$NOPROMPT" -eq 0 ]; then
curl -k $auth -f -L -o $filename $TAR # <-----
else
curl -k $auth -f -s -L -o $filename $TAR # <-----
fi
if [ $? -ne 0 ]; then
echo "Unable to get upgrade file from $TAR"
rm -f $filename
rm -f $DOWNLOADING
exit 1
fi
if [ ! -e $filename ]; then
echo "Download of $TAR failed"
rm -f $DOWNLOADING
exit 1
fi
if [ "$NOPROMPT" -eq 0 ]; then
echo "Download succeeded"
fi
TAR=$filename
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment