release: sync public installer asset install.sh
This commit is contained in:
+19
-2
@@ -89,6 +89,18 @@ print_fuse_status() {
|
|||||||
[[ $health =~ ^[0-9]{3}$ ]] || health='无法连接'
|
[[ $health =~ ^[0-9]{3}$ ]] || health='无法连接'
|
||||||
printf '应用健康状态:%s\n' "$health" >>$TTY_OUT
|
printf '应用健康状态:%s\n' "$health" >>$TTY_OUT
|
||||||
}
|
}
|
||||||
|
print_controller_info() {
|
||||||
|
local env_file="$INSTALL_DIR/.env" token_file address port token
|
||||||
|
[[ -f $env_file ]] || { printf '未找到安装配置,请先完成安装。\n' >>$TTY_OUT; return 1; }
|
||||||
|
address=$(awk -F= '$1 == "XYMEDIA_CONTROLLER_BIND_ADDRESS" {print $2; exit}' "$env_file")
|
||||||
|
port=$(awk -F= '$1 == "XYMEDIA_CONTROLLER_PORT" {print $2; exit}' "$env_file")
|
||||||
|
token_file="$INSTALL_DIR/secrets/xiaoya-controller-token"
|
||||||
|
token=$(cat "$token_file" 2>/dev/null || true)
|
||||||
|
[[ -n $address ]] || address='0.0.0.0'
|
||||||
|
[[ -n $port ]] || port=19090
|
||||||
|
[[ -n $token ]] || { printf '未找到控制器密钥,请先完成控制器安装。\n' >>$TTY_OUT; return 1; }
|
||||||
|
printf '小雅控制器地址:http://%s:%s\n小雅控制器密钥:%s\n' "$address" "$port" "$token" >>$TTY_OUT
|
||||||
|
}
|
||||||
while (($#)); do
|
while (($#)); do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
--install-dir) INSTALL_DIR=${2:?missing value}; shift 2;;
|
--install-dir) INSTALL_DIR=${2:?missing value}; shift 2;;
|
||||||
@@ -188,7 +200,7 @@ menu() {
|
|||||||
[[ $# -eq 0 ]] || return 0
|
[[ $# -eq 0 ]] || return 0
|
||||||
[[ -r $TTY_IN && -w $TTY_OUT ]] || die '没有可用终端:安装菜单不能通过非交互管道运行'
|
[[ -r $TTY_IN && -w $TTY_OUT ]] || die '没有可用终端:安装菜单不能通过非交互管道运行'
|
||||||
while :; do
|
while :; do
|
||||||
printf '\nXyMediaVault 安装器\n1) 仅安装管理平台\n2) 安装管理平台和本机小雅\n3) 安装管理平台并连接远程小雅控制器\n4) 仅安装小雅控制器\n5) 状态/诊断/维护\n0) 退出\n选择:' >>$TTY_OUT
|
printf '\nXyMediaVault 安装器\n1) 仅安装管理平台\n2) 安装管理平台和本机小雅\n3) 安装管理平台并连接远程小雅控制器\n4) 仅安装小雅控制器\n5) 状态/诊断/维护\n6) 查看小雅控制器地址和密钥\n0) 退出\n选择:' >>$TTY_OUT
|
||||||
read_tty choice || die '无法读取终端输入'
|
read_tty choice || die '无法读取终端输入'
|
||||||
case "$choice" in
|
case "$choice" in
|
||||||
1) return 0;;
|
1) return 0;;
|
||||||
@@ -206,6 +218,7 @@ menu() {
|
|||||||
0) continue 2;; *) printf '无效选择\n' >>$TTY_OUT;;
|
0) continue 2;; *) printf '无效选择\n' >>$TTY_OUT;;
|
||||||
esac
|
esac
|
||||||
done;;
|
done;;
|
||||||
|
6) print_controller_info || true;;
|
||||||
0) exit 0;; *) printf '无效选项\n' >>$TTY_OUT;;
|
0) exit 0;; *) printf '无效选项\n' >>$TTY_OUT;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
@@ -795,5 +808,9 @@ wait_for_app_health() {
|
|||||||
wait_for_app_health || die 'XyMediaVault 健康检查被中断,安装未完成'
|
wait_for_app_health || die 'XyMediaVault 健康检查被中断,安装未完成'
|
||||||
cp "$INSTALL_LOG" "$INSTALL_DIR/install.log" 2>/dev/null || true
|
cp "$INSTALL_LOG" "$INSTALL_DIR/install.log" 2>/dev/null || true
|
||||||
printf '\033[2K\r[%d/%d] 安装完成:XyMediaVault 已就绪\n' "$TOTAL_STEPS" "$TOTAL_STEPS"
|
printf '\033[2K\r[%d/%d] 安装完成:XyMediaVault 已就绪\n' "$TOTAL_STEPS" "$TOTAL_STEPS"
|
||||||
printf '管理地址:http://127.0.0.1:%s\n安装日志:%s\n' "$API_PORT" "$INSTALL_LOG"
|
printf '管理地址:http://127.0.0.1:%s\n' "$API_PORT"
|
||||||
|
if [[ $MENU_PROFILES == 'xiaoya xiaoya-control' ]]; then
|
||||||
|
print_controller_info
|
||||||
|
fi
|
||||||
|
printf '安装日志:%s/install.log\n' "$INSTALL_DIR"
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
Reference in New Issue
Block a user