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

use install to copy file

parent 78c69b56
No related branches found
No related tags found
No related merge requests found
Pipeline #74680 passed
...@@ -184,22 +184,25 @@ check_version ...@@ -184,22 +184,25 @@ check_version
VERSION_STATUS=$? VERSION_STATUS=$?
if [[ -n $FORCE_UPDATE ]]; then if [[ -n $FORCE_UPDATE ]]; then
curl $SCRIPT_URL -o ${0}.new TMP_UPDATE=$(mktemp)
curl $SCRIPT_URL -o $TMP_UPDATE
UPDATE_STATUS=$? UPDATE_STATUS=$?
if [ $UPDATE_STATUS == 0 ]; then if [ $UPDATE_STATUS == 0 ]; then
rm -f $0; mv ${0}.new $0; chmod 0755 $0 install --owner=root --group=root --mode=0755 -T $TMP_UPDATE $0
echo -e "\n$0 updated successfully\n" echo -e "\n$0 updated successfully\n"
else else
echo -e "\nfailed to update $0" echo -e "\nfailed to update $0"
echo -e "Please download the script manually from this URL: ${SCRIPT_URL}\n" echo -e "Please download the script manually from this URL: ${SCRIPT_URL}\n"
fi fi
rm -f $TMP_UPDATE
clean_up $UPDATE_STATUS clean_up $UPDATE_STATUS
fi fi
if [[ -n $UPDATE ]]; then if [[ -n $UPDATE ]]; then
TMP_UPDATE=$(mktemp)
UPDATE_STATUS="skip" UPDATE_STATUS="skip"
if [ $VERSION_STATUS -eq 1 ]; then if [ $VERSION_STATUS -eq 1 ]; then
curl $SCRIPT_URL -o ${0}.new curl $SCRIPT_URL -o $TMP_UPDATE
UPDATE_STATUS=$? UPDATE_STATUS=$?
fi fi
if [ $UPDATE_STATUS == "skip" ]; then if [ $UPDATE_STATUS == "skip" ]; then
...@@ -207,13 +210,15 @@ if [[ -n $UPDATE ]]; then ...@@ -207,13 +210,15 @@ if [[ -n $UPDATE ]]; then
echo -e "\n$0 is already up to date\n" echo -e "\n$0 is already up to date\n"
elif [ $UPDATE_STATUS -eq 0 ]; then elif [ $UPDATE_STATUS -eq 0 ]; then
EXIT_STATUS=0 EXIT_STATUS=0
rm -f $0; mv ${0}.new $0; chmod 0755 $0 install --owner=root --group=root --mode=0755 -T $TMP_UPDATE $0
rm -f $TMP_UPDATE
echo -e "\n$0 updated successfully\n" echo -e "\n$0 updated successfully\n"
else else
EXIT_STATUS=$UPDATE_STATUS EXIT_STATUS=$UPDATE_STATUS
echo -e "\nfailed to update $0" echo -e "\nfailed to update $0"
echo -e "Please download the script manually from this URL: ${SCRIPT_URL}\n" echo -e "Please download the script manually from this URL: ${SCRIPT_URL}\n"
fi fi
rm -f $TMP_UPDATE
clean_up $EXIT_STATUS clean_up $EXIT_STATUS
fi fi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment