Skip to content
Snippets Groups Projects
Unverified Commit 78c69b56 authored by Max Adamo's avatar Max Adamo
Browse files

overwrite file only if download succeeded

parent e64ff3c1
No related branches found
No related tags found
No related merge requests found
Pipeline #74678 passed
......@@ -184,9 +184,10 @@ check_version
VERSION_STATUS=$?
if [[ -n $FORCE_UPDATE ]]; then
curl $SCRIPT_URL -o $0
curl $SCRIPT_URL -o ${0}.new
UPDATE_STATUS=$?
if [ $UPDATE_STATUS == 0 ]; then
rm -f $0; mv ${0}.new $0; chmod 0755 $0
echo -e "\n$0 updated successfully\n"
else
echo -e "\nfailed to update $0"
......@@ -198,7 +199,7 @@ fi
if [[ -n $UPDATE ]]; then
UPDATE_STATUS="skip"
if [ $VERSION_STATUS -eq 1 ]; then
curl $SCRIPT_URL -o $0
curl $SCRIPT_URL -o ${0}.new
UPDATE_STATUS=$?
fi
if [ $UPDATE_STATUS == "skip" ]; then
......@@ -206,6 +207,7 @@ if [[ -n $UPDATE ]]; then
echo -e "\n$0 is already up to date\n"
elif [ $UPDATE_STATUS -eq 0 ]; then
EXIT_STATUS=0
rm -f $0; mv ${0}.new $0; chmod 0755 $0
echo -e "\n$0 updated successfully\n"
else
EXIT_STATUS=$UPDATE_STATUS
......@@ -215,7 +217,6 @@ if [[ -n $UPDATE ]]; then
clean_up $EXIT_STATUS
fi
if [[ -z $REDIS_TOKEN ]] || [[ -z $VAULT_TOKEN ]] || [[ -z $CERT_NAME ]] || [[ -z $TEAM_NAME ]] || [[ -z $TYPE ]]; then
echo -e "\n--redis-token, --vault-token, --cert-name, --team-name and --type are mandatory\n"
usage
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment