Simplify install command

This commit is contained in:
武阳
2026-05-07 12:10:30 +08:00
parent 6c75f0f979
commit b72eae5da7
3 changed files with 18 additions and 37 deletions
+2 -2
View File
@@ -25,7 +25,7 @@ Options:
--force 使用 git reset --hard origin/<branch> 覆盖本地改动
--skip-git 跳过 git 拉取,只部署当前工作区
--bootstrap-system
首次安装时使用 sudo 安装 Ubuntu 系统依赖,应用仍部署在用户目录
强制使用 sudo 安装 Ubuntu 系统依赖;首次安装会默认执行
EOF
}
@@ -81,7 +81,7 @@ require_command() {
}
bootstrap_system_packages() {
if [[ "${BOOTSTRAP_SYSTEM}" != "1" ]]; then
if [[ "${BOOTSTRAP_SYSTEM}" != "1" && -f "${ENV_FILE}" ]]; then
return
fi
require_command sudo "首次安装系统依赖需要 sudo。"
+9
View File
@@ -54,6 +54,15 @@ command -v git >/dev/null 2>&1 || {
exit 1
}
if [[ -e "${APP_DIR}" && ! -d "${APP_DIR}/.git" ]]; then
echo "${APP_DIR} already exists but is not a git repository." >&2
echo "Please move it away, or rerun with --force to replace it." >&2
if [[ "${FORCE}" != "1" ]]; then
exit 1
fi
rm -rf "${APP_DIR}"
fi
if [[ -d "${APP_DIR}/.git" ]]; then
cd "${APP_DIR}"
git fetch origin