Files
dekun d726810320 支持 Ubuntu 一键部署与 PM2,并增加系统设置改密。
默认账号改为 admin/admin123,去掉 Windows 部署说明,与客户端同套部署流程。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-01 11:03:29 +08:00

61 lines
1.5 KiB
Bash

#!/usr/bin/env bash
# deploy/lib/update.sh — crypto_okx_hub 更新
set -e
set -u
if [ -n "${BASH_VERSION:-}" ]; then
set -o pipefail
fi
LIB_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# shellcheck source=common.sh
source "${LIB_DIR}/common.sh"
update_quick() {
step "快速更新"
bash "${REPO_ROOT}/deploy/pull_and_restart.sh"
# shellcheck source=common.sh
source "${LIB_DIR}/common.sh"
verify_deployment "$(detect_server_ip)" || true
}
update_deps() {
step "依赖更新"
if [[ -x "${REPO_ROOT}/.venv/bin/pip" ]]; then
pip_install_requirements "${REPO_ROOT}/.venv/bin/pip" "${REPO_ROOT}/requirements.txt" "crypto_okx_hub 依赖"
else
bash "${REPO_ROOT}/deploy/setup_env.sh" --install-system-deps
fi
update_quick
}
show_update_menu() {
while true; do
echo ""
echo " 更新选项:"
echo " 3-1) 快速更新(git pull + pm2 restart)"
echo " 3-2) 依赖更新(含 pip install)"
echo " 0) 返回主菜单"
local choice=""
cm_read choice "请选择 [0/3-1/3-2]: "
case "${choice}" in
3-1|31|1) update_quick; break ;;
3-2|32|2) update_deps; break ;;
0) break ;;
*) echo "无效选项" ;;
esac
done
}
main_update() {
require_root
if ! REPO_ROOT="$(resolve_repo_root)"; then
die "未找到安装目录 ${INSTALL_ROOT},请先执行「1) 一键部署」"
fi
if ! repo_ready "${REPO_ROOT}"; then
die "未找到安装,请先执行「1) 一键部署」"
fi
show_update_menu
}
main_update "$@"