#!/usr/bin/env bash # LocalNav 交互式部署管理(无需预先克隆) # 用法: # curl -fsSL https://git.bz121.com/dekun/LocalNav/raw/main/scripts/install.sh | bash # bash install.sh # curl -fsSL .../install.sh | bash -s -- install -y set -euo pipefail DEFAULT_REPO="https://git.bz121.com/dekun/LocalNav.git" RAW_BASE="${DEFAULT_REPO%.git}/raw/main/scripts" need_cmd() { command -v "$1" >/dev/null 2>&1 || { echo "[FAIL] 未找到 $1,请先安装" >&2 exit 1 } } run_navctl() { local navctl_py="$1" shift # curl | bash 时 stdin 是管道,无法交互;改从终端设备读取 if [ ! -t 0 ]; then if [ ! -r /dev/tty ]; then echo "[FAIL] 当前为非交互环境且无法打开 /dev/tty" >&2 echo "请改用: curl -fsSL .../install.sh -o install.sh && bash install.sh" >&2 echo "或非交互安装: curl -fsSL .../install.sh | bash -s -- install -y" >&2 exit 1 fi exec python3 "$navctl_py" "$@"