From 110d258886a1bbf70413596874534ac152abffe2 Mon Sep 17 00:00:00 2001 From: admin Date: Mon, 7 Sep 2026 02:52:17 +0000 Subject: [PATCH] release: sync public installer asset install.sh --- install.sh | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 851240b..d9c3caf 100644 --- a/install.sh +++ b/install.sh @@ -61,7 +61,6 @@ require_public_app_installation() { [[ -f "$INSTALL_DIR/compose.yaml" ]] || missing+=(compose.yaml) [[ -f "$INSTALL_DIR/config.yaml" ]] || missing+=(config.yaml) [[ -f "$INSTALL_DIR/compose.fuse.yaml" ]] || missing+=(compose.fuse.yaml) - [[ -x "$INSTALL_DIR/remount-fuse.sh" ]] || missing+=(remount-fuse.sh) grep -Eq '^ app:' "$INSTALL_DIR/compose.yaml" 2>/dev/null || missing+=(app-service) if ((${#missing[@]})); then printf '不支持 FUSE 维护:缺少完整 app 安装(%s)。\n' "${missing[*]}" >>$TTY_OUT @@ -69,6 +68,17 @@ require_public_app_installation() { fi return 0 } +refresh_remount_script() { + local tmp + tmp=$(mktemp "$INSTALL_DIR/.remount-fuse.sh.XXXXXX") || die '无法创建挂载脚本临时文件' + if ! curl --fail --silent --show-error --location --proto '=https' --tlsv1.2 \ + "$RELEASE_BASE/remount-fuse.sh?installer=$INSTALL_NONCE" -o "$tmp"; then + rm -f "$tmp" + die '无法下载最新 remount-fuse.sh' + fi + chmod 700 "$tmp" + mv -f "$tmp" "$INSTALL_DIR/remount-fuse.sh" +} read_install_env() { awk -F= -v wanted="$1" '$1 == wanted {sub(/^[^=]*=/, ""); print; exit}' "$INSTALL_DIR/.env" 2>/dev/null || true } @@ -612,6 +622,7 @@ if (( ! CONTROLLER_ONLY )) && (( INSTALL_EXISTING )); then fi if [[ -n $MAINTENANCE_ACTION ]]; then require_public_app_installation || die '维护操作仅支持已有完整 app 安装' + refresh_remount_script case "$MAINTENANCE_ACTION" in configure) exec env XYMEDIA_INSTALL_DIR="$INSTALL_DIR" sh "$INSTALL_DIR/remount-fuse.sh" --configure "$FUSE_PATH_INPUT";; restart) exec env XYMEDIA_INSTALL_DIR="$INSTALL_DIR" sh "$INSTALL_DIR/remount-fuse.sh" --restart;; @@ -1165,6 +1176,20 @@ progress "下载应用包 $APP_VERSION ($PLATFORM)" download_extract app "$APP_VERSION" "$APP_URL" "$APP_SHA" "$APP_STAGE" APP_ROOT="$APP_STAGE/xymediavault-$APP_VERSION-$PLATFORM" [[ -x $APP_ROOT/bin/xymediavault && -x $APP_ROOT/bin/xymedia-supervisor && -d $APP_ROOT/web/dist && -f $APP_ROOT/release.json ]] || die "app package $APP_VERSION lacks the required xymedia-supervisor; use a newer public app package" +app_platform=$(python3 - "$APP_ROOT/release.json" <<'PY' +import json, sys +try: + with open(sys.argv[1], encoding='utf-8') as release_file: + release = json.load(release_file) +except (OSError, ValueError): + raise SystemExit(1) +platform = release.get('platform') +if not isinstance(platform, str): + raise SystemExit(1) +print(platform) +PY +) || die "app package $APP_VERSION has invalid release.json platform metadata; use a linux-$([[ $PLATFORM == linux-arm64 ]] && printf arm64 || printf amd64) app package/release" +[[ $app_platform == "$PLATFORM" ]] || die "app package $APP_VERSION is for $app_platform, but this host requires $PLATFORM; use a linux-$([[ $PLATFORM == linux-arm64 ]] && printf arm64 || printf amd64) app package/release" if [[ -x $APP_ROOT/bin/xymedia-edge ]]; then install_controller_binary "$APP_ROOT/bin/xymedia-edge" fi