release: sync public installer asset install.sh
This commit is contained in:
+26
-1
@@ -61,7 +61,6 @@ require_public_app_installation() {
|
|||||||
[[ -f "$INSTALL_DIR/compose.yaml" ]] || missing+=(compose.yaml)
|
[[ -f "$INSTALL_DIR/compose.yaml" ]] || missing+=(compose.yaml)
|
||||||
[[ -f "$INSTALL_DIR/config.yaml" ]] || missing+=(config.yaml)
|
[[ -f "$INSTALL_DIR/config.yaml" ]] || missing+=(config.yaml)
|
||||||
[[ -f "$INSTALL_DIR/compose.fuse.yaml" ]] || missing+=(compose.fuse.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)
|
grep -Eq '^ app:' "$INSTALL_DIR/compose.yaml" 2>/dev/null || missing+=(app-service)
|
||||||
if ((${#missing[@]})); then
|
if ((${#missing[@]})); then
|
||||||
printf '不支持 FUSE 维护:缺少完整 app 安装(%s)。\n' "${missing[*]}" >>$TTY_OUT
|
printf '不支持 FUSE 维护:缺少完整 app 安装(%s)。\n' "${missing[*]}" >>$TTY_OUT
|
||||||
@@ -69,6 +68,17 @@ require_public_app_installation() {
|
|||||||
fi
|
fi
|
||||||
return 0
|
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() {
|
read_install_env() {
|
||||||
awk -F= -v wanted="$1" '$1 == wanted {sub(/^[^=]*=/, ""); print; exit}' "$INSTALL_DIR/.env" 2>/dev/null || true
|
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
|
fi
|
||||||
if [[ -n $MAINTENANCE_ACTION ]]; then
|
if [[ -n $MAINTENANCE_ACTION ]]; then
|
||||||
require_public_app_installation || die '维护操作仅支持已有完整 app 安装'
|
require_public_app_installation || die '维护操作仅支持已有完整 app 安装'
|
||||||
|
refresh_remount_script
|
||||||
case "$MAINTENANCE_ACTION" in
|
case "$MAINTENANCE_ACTION" in
|
||||||
configure) exec env XYMEDIA_INSTALL_DIR="$INSTALL_DIR" sh "$INSTALL_DIR/remount-fuse.sh" --configure "$FUSE_PATH_INPUT";;
|
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;;
|
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"
|
download_extract app "$APP_VERSION" "$APP_URL" "$APP_SHA" "$APP_STAGE"
|
||||||
APP_ROOT="$APP_STAGE/xymediavault-$APP_VERSION-$PLATFORM"
|
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"
|
[[ -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
|
if [[ -x $APP_ROOT/bin/xymedia-edge ]]; then
|
||||||
install_controller_binary "$APP_ROOT/bin/xymedia-edge"
|
install_controller_binary "$APP_ROOT/bin/xymedia-edge"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user