Cleanup update.sh after update
This commit is contained in:
parent
a4a583785c
commit
9b2062226a
13
update.sh
13
update.sh
|
@ -14,7 +14,7 @@
|
||||||
### cd to the directory you have it in e.g cd /var/opt
|
### cd to the directory you have it in e.g cd /var/opt
|
||||||
### execute using ./linux-update.sh to downlaod the latest github release
|
### execute using ./linux-update.sh to downlaod the latest github release
|
||||||
|
|
||||||
### OPTIONS ### ./update.sh option1 option2
|
### OPTIONS ### ./linux-update.sh option1 option2
|
||||||
### This script can be executed with some optional parameters
|
### This script can be executed with some optional parameters
|
||||||
### auto - automaticlaly upgrade without any confirmation to the latest version
|
### auto - automaticlaly upgrade without any confirmation to the latest version
|
||||||
### noupdate - do not update the script from github
|
### noupdate - do not update the script from github
|
||||||
|
@ -57,14 +57,15 @@ fi
|
||||||
### Set all child processes to this locale language to prevent rev from breaking
|
### Set all child processes to this locale language to prevent rev from breaking
|
||||||
export LC_ALL='en_US.UTF-8'
|
export LC_ALL='en_US.UTF-8'
|
||||||
|
|
||||||
###Get the Directory and filename of the script###
|
###Get the directory and filename of the script###
|
||||||
DIR=$(dirname "$(readlink -f "$0")")
|
DIR=$(dirname "$(readlink -f "$0")")
|
||||||
script=$(basename "$0")
|
script=$(basename "$0")
|
||||||
|
|
||||||
|
### Update linux-update script unless noupdate option is used###
|
||||||
if [[ ! "$@" == *"noupdate"* ]]; then
|
if [[ ! "$@" == *"noupdate"* ]]; then
|
||||||
### Update linux-update script ###
|
### download update.sh from github. -s silent -O output to a file ###
|
||||||
### -s silent -O output to a file ###
|
|
||||||
curl -s https://raw.githubusercontent.com/taniman/profit-trailer/master/update.sh -O > /dev/null
|
curl -s https://raw.githubusercontent.com/taniman/profit-trailer/master/update.sh -O > /dev/null
|
||||||
|
### Check if the file is newer ###
|
||||||
### Get line containing LAST UPDATED (line 4 typically) ###
|
### Get line containing LAST UPDATED (line 4 typically) ###
|
||||||
### -i ignore case, -m 1 match only first instance ###
|
### -i ignore case, -m 1 match only first instance ###
|
||||||
olddate=$(grep -i -m 1 'updated' "$DIR"/"$script")
|
olddate=$(grep -i -m 1 'updated' "$DIR"/"$script")
|
||||||
|
@ -77,7 +78,11 @@ if [[ ! "$@" == *"noupdate"* ]]; then
|
||||||
else
|
else
|
||||||
exec "$DIR"/"$script" "$@"
|
exec "$DIR"/"$script" "$@"
|
||||||
fi
|
fi
|
||||||
|
### Remove the downloaded update.sh if it is not the only copy ###
|
||||||
|
elif [[ ! "$script" == "update.sh" ]]; then
|
||||||
|
rm -rf update.sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
else
|
else
|
||||||
echo
|
echo
|
||||||
echo "Skipped script update"
|
echo "Skipped script update"
|
||||||
|
|
Loading…
Reference in New Issue