testing self update

This commit is contained in:
Heavybullets8 2022-06-13 13:55:49 -06:00
parent 382b8296be
commit bbb6428466

View File

@ -3,14 +3,14 @@
#If no argument is passed, kill the script. #If no argument is passed, kill the script.
[[ -z "$*" || "-" == "$*" || "--" == "$*" ]] && echo "This script requires an argument, use --help for help" && exit [[ -z "$*" || "-" == "$*" || "--" == "$*" ]] && echo "This script requires an argument, use --help for help" && exit
ARGS="echo $* | sed s/--self-update//"
self_update() {
SCRIPT=$(readlink -f "$0") SCRIPT=$(readlink -f "$0")
SCRIPTPATH=$(dirname "$SCRIPT") SCRIPTPATH=$(dirname "$SCRIPT")
SCRIPTNAME="$0" SCRIPTNAME="$0"
ARGS="$@"
BRANCH="beta" BRANCH="beta"
self_update() {
cd $SCRIPTPATH cd $SCRIPTPATH
git fetch git fetch
@ -20,7 +20,7 @@ git fetch
git checkout $BRANCH git checkout $BRANCH
git pull --force git pull --force
echo "Running the new version..." echo "Running the new version..."
exec "$SCRIPTNAME" "$@" exec "$SCRIPTNAME" "$ARGS"
# Now exit this old instance # Now exit this old instance
exit 1 exit 1
@ -28,7 +28,7 @@ git fetch
echo "Already the latest version." echo "Already the latest version."
} }
self_update
help(){ help(){
[[ $help == "true" ]] && clear -x [[ $help == "true" ]] && clear -x
@ -371,6 +371,9 @@ do
help) help)
help="true" help="true"
;; ;;
self-update)
self_update="true"
;;
dns) dns)
dns="true" dns="true"
;; ;;
@ -448,6 +451,7 @@ done
[[ "$update_all_apps" == "true" && "$update_apps" == "true" ]] && echo -e "-U and -u cannot BOTH be called" && exit [[ "$update_all_apps" == "true" && "$update_apps" == "true" ]] && echo -e "-U and -u cannot BOTH be called" && exit
#Continue to call functions in specific order #Continue to call functions in specific order
[[ "$self_update" == "true" ]] && self_update
[[ "$help" == "true" ]] && help [[ "$help" == "true" ]] && help
[[ "$deleteBackup" == "true" ]] && deleteBackup && exit [[ "$deleteBackup" == "true" ]] && deleteBackup && exit
[[ "$dns" == "true" ]] && dns && exit [[ "$dns" == "true" ]] && dns && exit