From a1c6ae02e97886da407637ab17be009390cd69aa Mon Sep 17 00:00:00 2001 From: dekun Date: Sun, 11 Oct 2026 00:37:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=97=B6=E5=85=81=E8=AE=B8?= =?UTF-8?q?=20root=20=E6=8B=89=E5=8F=96=20hypernode=20=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=EF=BC=8C=E5=B9=B6=E8=A6=86=E7=9B=96=E4=B8=8D=E4=B8=80=E8=87=B4?= =?UTF-8?q?=E7=9A=84=E6=8E=A7=E5=88=B6=E5=8F=B0=E6=96=87=E4=BB=B6=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cursor --- deploy/manage.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/deploy/manage.sh b/deploy/manage.sh index 40bd759..ec31f2b 100644 --- a/deploy/manage.sh +++ b/deploy/manage.sh @@ -53,6 +53,10 @@ repo_ready() { [[ -f "${1}/app/main.py" && -f "${1}/requirements.txt" && -f "${1}/deploy/manage.sh" ]] } +git_in_install() { + git -c safe.directory="${INSTALL_ROOT}" -C "${INSTALL_ROOT}" "$@" +} + require_root() { if [[ "$(id -u)" -ne 0 ]]; then echo "请使用 root 执行。可以先 sudo -i,再运行安装命令。" >&2 @@ -262,7 +266,11 @@ cmd_update() { log "更新程序" install_packages if [[ -d "${INSTALL_ROOT}/.git" ]]; then - git -C "${INSTALL_ROOT}" pull --ff-only origin "${GIT_BRANCH}" + if ! git_in_install diff --quiet -- web; then + log "控制台文件与仓库不一致,按仓库版本覆盖 web/" + git_in_install checkout -- web + fi + git_in_install pull --ff-only origin "${GIT_BRANCH}" else ensure_install_tree fi