瀏覽代碼

Update homarr.sh

modify git update
tteckster 1 年之前
父節點
當前提交
e48b2bd0df
共有 1 個文件被更改,包括 10 次插入4 次删除
  1. 10 4
      ct/homarr.sh

+ 10 - 4
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