From e48b2bd0dfdd64ea0b4a4d44cb9689a5e6a6e55f Mon Sep 17 00:00:00 2001
From: tteckster <tteckster@gmail.com>
Date: Fri, 8 Sep 2023 14:40:53 -0400
Subject: [PATCH] Update homarr.sh

modify git update
---
 ct/homarr.sh | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/ct/homarr.sh b/ct/homarr.sh
index dd06a8ff0..514d49c02 100644
--- a/ct/homarr.sh
+++ b/ct/homarr.sh
@@ -56,13 +56,19 @@ if [[ ! -d /opt/homarr ]]; then msg_error "No ${APP} Installation Found!"; exit;
 msg_info "Updating $APP"
 systemctl stop homarr
 cd /opt/homarr
-output=$(git pull)
-git pull &>/dev/null
+output=$(git pull 2>&1)
 if echo "$output" | grep -q "Already up to date."
 then
-  msg_ok " $APP is already up to date."
+  msg_ok "$APP is already up to date."
   systemctl start homarr
-  exit
+else
+  if ! git pull; then
+    echo "Update failed, temporarily storing changes and trying again."
+    git stash && git pull || (
+      echo "Update failed even after storing changes. Aborting."
+      exit 1
+    )
+  fi
 fi
 yarn install &>/dev/null
 yarn build &>/dev/null