release: sync public installer asset install.sh

This commit is contained in:
2026-09-07 02:52:17 +00:00
parent 7d48693230
commit 110d258886
+26 -1
View File
@@ -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