From 96b50962843840b4596ccfc9777ae2750855e9ea Mon Sep 17 00:00:00 2001 From: dekun Date: Sun, 12 Jul 2026 12:37:15 +0800 Subject: [PATCH] Pull latest deploy scripts when repo exists before showing curl-pipe menu. Avoids sourcing stale lib/common.sh from an older clone after curl | bash. Co-authored-by: Cursor --- deploy/manage.sh | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/deploy/manage.sh b/deploy/manage.sh index 191ecb1..27e1827 100644 --- a/deploy/manage.sh +++ b/deploy/manage.sh @@ -31,31 +31,23 @@ unset _script_src set -u -# curl | bash: stdin 为管道,clone 后或已有仓库时改从终端读入 -reexec_with_tty_if_needed() { - if [[ -t 0 ]]; then - return 0 - fi - local script="" - if [[ -f "${INSTALL_ROOT}/deploy/manage.sh" ]]; then - script="${INSTALL_ROOT}/deploy/manage.sh" - elif [[ -n "${DEPLOY_DIR}" && -f "${DEPLOY_DIR}/manage.sh" ]]; then - script="${DEPLOY_DIR}/manage.sh" - fi - if [[ -n "${script}" ]]; then - exec bash "${script}" "$@" /dev/null 2>&1; then + git -C "${root}" pull -q --ff-only 2>/dev/null || true + fi +} + bootstrap_repo() { if repo_ready "${INSTALL_ROOT}"; then REPO_ROOT="${INSTALL_ROOT}" DEPLOY_DIR="${REPO_ROOT}/deploy" LIB_DIR="${DEPLOY_DIR}/lib" + sync_repo_if_present "${REPO_ROOT}" return 0 fi if [[ -n "${REPO_ROOT}" ]] && repo_ready "${REPO_ROOT}"; then @@ -87,6 +79,7 @@ bootstrap_repo() { fi mkdir -p "$(dirname "${INSTALL_ROOT}")" git clone -b "${GIT_BRANCH}" "${GIT_URL}" "${INSTALL_ROOT}" + # clone 后用仓库内脚本 + 终端 stdin(管道已 EOF) exec bash "${INSTALL_ROOT}/deploy/manage.sh" "$@"