fix(deploy): register nx/nexus-fresh in PATH for root
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -71,7 +71,7 @@ Nexus 6.0 全新安装(1Panel + Docker)
|
||||
-h, --help 显示帮助
|
||||
|
||||
安装后请用浏览器打开: https://域名/app/install.html
|
||||
日常运维: nx 或 bash ${NEXUS_ROOT}/deploy/nx god
|
||||
root 下全局命令: nexus-fresh | nx | nx god
|
||||
EOF
|
||||
}
|
||||
|
||||
@@ -121,13 +121,27 @@ load_credentials() {
|
||||
fi
|
||||
}
|
||||
|
||||
install_root_commands() {
|
||||
[[ -d "${NEXUS_ROOT}/deploy" ]] || return 0
|
||||
chmod +x "${NEXUS_ROOT}/deploy/nx" \
|
||||
"${NEXUS_ROOT}/deploy/install-nexus-fresh.sh" \
|
||||
"${NEXUS_ROOT}/deploy/nexus-1panel.sh" 2>/dev/null || true
|
||||
ln -sf "${NEXUS_ROOT}/deploy/nx" /usr/local/bin/nx
|
||||
ln -sf "${NEXUS_ROOT}/deploy/install-nexus-fresh.sh" /usr/local/bin/nexus-fresh
|
||||
info "已注册全局命令(root 直接输入即可):"
|
||||
info " nx — 主菜单 / 上帝菜单"
|
||||
info " nexus-fresh — 全新安装脚本"
|
||||
}
|
||||
|
||||
phase_preflight() {
|
||||
step "阶段 1/6 — 环境检查"
|
||||
if [[ "$(id -u)" -ne 0 ]]; then
|
||||
error "请使用 root 运行: sudo bash $0"
|
||||
error "请切换到 root 再执行(不要用 sudo 包一层):"
|
||||
error " su -"
|
||||
error " bash $0 ..."
|
||||
exit 1
|
||||
fi
|
||||
info "运行用户: root"
|
||||
info "运行用户: root(无需 sudo)"
|
||||
|
||||
if [[ ! -f /etc/os-release ]]; then
|
||||
error "无法识别操作系统"
|
||||
@@ -255,8 +269,7 @@ phase_install_stack() {
|
||||
|
||||
phase_post() {
|
||||
step "阶段 6/6 — 收尾"
|
||||
ln -sf "${NEXUS_ROOT}/deploy/nx" /usr/local/bin/nx 2>/dev/null || true
|
||||
chmod +x "${NEXUS_ROOT}/deploy/nx" 2>/dev/null || true
|
||||
install_root_commands
|
||||
|
||||
local port health
|
||||
port="8600"
|
||||
@@ -284,6 +297,9 @@ phase_post() {
|
||||
|
||||
main() {
|
||||
banner
|
||||
if [[ "$SKIP_CLONE" == true && -d "${NEXUS_ROOT}/deploy" ]]; then
|
||||
install_root_commands
|
||||
fi
|
||||
phase_preflight
|
||||
phase_1panel
|
||||
phase_packages
|
||||
|
||||
Reference in New Issue
Block a user