From b738881ff170a3cc533e9db4d39b6784374eb2b6 Mon Sep 17 00:00:00 2001 From: SpudGunMan Date: Sun, 28 Sep 2025 17:16:04 -0700 Subject: [PATCH] Update update.sh --- update.sh | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/update.sh b/update.sh index f464758..eddc6aa 100644 --- a/update.sh +++ b/update.sh @@ -29,17 +29,20 @@ echo "Updating local repository..." #git fetch --all # if git pull has conflicts, ask to reset hard -if ! git pull origin main --rebase; then - read -p "Git pull resulted in conflicts. Do you want to reset hard to origin/main? This will discard local changes. (y/n): " choice - if [[ "$choice" == "y" || "$choice" == "Y" ]]; then - git fetch --all - git reset --hard origin/main - else - echo "Update aborted due to git conflicts." +# check if git is here (if not likely in venv ask to run outside as well) +if ! command -v git &> /dev/null; then + echo "Git command not found. Please run this script with permissions to access git. (if updating in venv, run outside of it)" +else + if ! git pull origin main --rebase; then + read -p "Git pull resulted in conflicts. Do you want to reset hard to origin/main? This will discard local changes. (y/n): " choice + if [[ "$choice" == "y" || "$choice" == "Y" ]]; then + git fetch --all + git reset --hard origin/main + echo "Local repository updated." + else + echo "Update aborted due to git conflicts." + fi fi -fi - -echo "Local repository updated." # Install or update dependencies echo "Installing or updating dependencies..." @@ -59,8 +62,6 @@ else echo "Dependencies installed or updated." fi -echo "Dependencies installed or updated." - # if service was stopped earlier, restart it if [ "$service_stopped" = true ]; then echo "Restarting services..."