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
VERSION_STATUS=$?
if [[ -n $FORCE_UPDATE ]]; then
curl $SCRIPT_URL -o ${0}.new
TMP_UPDATE=$(mktemp)
curl $SCRIPT_URL -o $TMP_UPDATE
UPDATE_STATUS=$?
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"
else
echo -e "\nfailed to update $0"
echo -e "Please download the script manually from this URL: ${SCRIPT_URL}\n"
fi
rm -f $TMP_UPDATE
clean_up $UPDATE_STATUS
fi
if [[ -n $UPDATE ]]; then
TMP_UPDATE=$(mktemp)
UPDATE_STATUS="skip"
if [ $VERSION_STATUS -eq 1 ]; then
curl $SCRIPT_URL -o ${0}.new
curl $SCRIPT_URL -o $TMP_UPDATE
UPDATE_STATUS=$?
fi
if [ $UPDATE_STATUS == "skip" ]; then
......@@ -207,13 +210,15 @@ 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
install --owner=root --group=root --mode=0755 -T $TMP_UPDATE $0
rm -f $TMP_UPDATE
echo -e "\n$0 updated successfully\n"
else
EXIT_STATUS=$UPDATE_STATUS
echo -e "\nfailed to update $0"
echo -e "Please download the script manually from this URL: ${SCRIPT_URL}\n"
fi
rm -f $TMP_UPDATE
clean_up $EXIT_STATUS
fi
......
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