testing self update

This commit is contained in:
Heavybullets8 2022-06-13 13:30:23 -06:00
parent 9f741e4742
commit 382b8296be

View File

@ -4,12 +4,38 @@
[[ -z "$*" || "-" == "$*" || "--" == "$*" ]] && echo "This script requires an argument, use --help for help" && exit [[ -z "$*" || "-" == "$*" || "--" == "$*" ]] && echo "This script requires an argument, use --help for help" && exit
self_update() {
SCRIPT=$(readlink -f "$0")
SCRIPTPATH=$(dirname "$SCRIPT")
SCRIPTNAME="$0"
ARGS="$@"
BRANCH="beta"
cd $SCRIPTPATH
git fetch
[[ -n $(git diff --name-only origin/$BRANCH | grep $SCRIPTNAME) ]] && {
echo "Found a new version of me, updating myself..."
git pull --force
git checkout $BRANCH
git pull --force
echo "Running the new version..."
exec "$SCRIPTNAME" "$@"
# Now exit this old instance
exit 1
}
echo "Already the latest version."
}
self_update
help(){ help(){
[[ $help == "true" ]] && clear -x [[ $help == "true" ]] && clear -x
echo "Basic Utilities" echo "Basic Utilities"
echo "--mount | Initiates mounting feature, choose between unmounting and mounting PVC data" echo "--mount | Initiates mounting feature, choose between unmounting and mounting PVC data"
echo "--restore | Opens a menu to restore a \"heavy_script\" backup that was taken on your \"ix-applications\" dataset" echo "--restore | Opens a menu to restore a \"heavy_script\" backup that was taken on your \"ix-applications\" dataset"
echo "--delete backup | Opens a menu to delete backups on your system" echo "--delete-backup | Opens a menu to delete backups on your system"
echo "--dns | list all of your applications DNS names and their web ports" echo "--dns | list all of your applications DNS names and their web ports"
echo echo
echo "Update Options" echo "Update Options"
@ -102,8 +128,8 @@ export -f restore
dns(){ dns(){
clear -x clear -x
echo "Generating DNS Names.." echo "Generating DNS Names.."
#ignored dependency pods, No change required #ignored dependency pods, may need to add more in the future.
dep_ignore="cron|kube-system|nvidia|svclb|NAME|memcached" dep_ignore="\-cronjob\-|^kube-system|\ssvclb|NAME|\-memcached\-.[^custom\-app]|\-postgresql\-.[^custom\-app]|\-redis\-.[^custom\-app]|\-mariadb\-.[^custom\-app]|\-promtail\-.[^custom\-app]"
# Pulling pod names # Pulling pod names
mapfile -t main < <(k3s kubectl get pods -A | grep -Ev "$dep_ignore" | sort) mapfile -t main < <(k3s kubectl get pods -A | grep -Ev "$dep_ignore" | sort)