release: sync public installer asset install.sh

This commit is contained in:
2026-09-07 08:48:05 +00:00
parent 04d5ff8370
commit 4bd3a5fab5
+23 -7
View File
@@ -1331,13 +1331,29 @@ progress '下载 bootstrap runtime'
die 'bootstrap runtime 下载失败;请确认能访问 git.keeper.work Container Registry' die 'bootstrap runtime 下载失败;请确认能访问 git.keeper.work Container Registry'
fi fi
validate_bootstrap_runtime_platform() { validate_bootstrap_runtime_platform() {
local bootstrap_image_id runtime_metadata runtime_os runtime_arch runtime_platform local bootstrap_image_expected bootstrap_image_ref bootstrap_image_id runtime_metadata runtime_platform
bootstrap_image_id=$("${COMPOSE[@]}" --project-directory "$INSTALL_DIR" --env-file "$INSTALL_DIR/.env" -f "$INSTALL_DIR/compose.yaml" images -q app 2>>"$INSTALL_LOG" | tr -d '[:space:]') || die '无法确定 bootstrap runtime 的本地镜像 ID' bootstrap_image_expected=${XYMEDIA_BOOTSTRAP_IMAGE:-}
[[ -n $bootstrap_image_id ]] || die '无法确定 bootstrap runtime 的本地镜像 ID' if [[ -z $bootstrap_image_expected && -f $INSTALL_DIR/.env ]]; then
runtime_metadata=$(docker image inspect --format '{{.Os}}\t{{.Architecture}}' "$bootstrap_image_id" 2>>"$INSTALL_LOG") || die '无法读取 bootstrap runtime 的本地镜像平台元数据' bootstrap_image_expected=$(awk -F= '$1 == "XYMEDIA_BOOTSTRAP_IMAGE" {sub(/^[^=]*=/, ""); print; exit}' "$INSTALL_DIR/.env")
IFS=$'\t' read -r runtime_os runtime_arch <<<"$runtime_metadata" fi
[[ -n $runtime_os && -n $runtime_arch ]] || die 'bootstrap runtime 的本地镜像平台元数据不完整' bootstrap_image_expected=${bootstrap_image_expected:-git.keeper.work/admin/xymediavault-bootstrap:1}
runtime_platform="$runtime_os/$runtime_arch" bootstrap_image_ref=$("${COMPOSE[@]}" --project-directory "$INSTALL_DIR" --env-file "$INSTALL_DIR/.env" -f "$INSTALL_DIR/compose.yaml" config --images 2>>"$INSTALL_LOG" | awk -v expected="$bootstrap_image_expected" 'NF && $0 == expected {print; exit}') || true
if [[ -z $bootstrap_image_ref ]]; then
bootstrap_image_id=$("${COMPOSE[@]}" --project-directory "$INSTALL_DIR" --env-file "$INSTALL_DIR/.env" -f "$INSTALL_DIR/compose.yaml" images -q app 2>>"$INSTALL_LOG" | awk 'NF {print; exit}') || true
bootstrap_image_ref=$bootstrap_image_id
fi
[[ -n $bootstrap_image_ref ]] || die '无法确定 bootstrap runtime 的本地镜像引用或 ID'
runtime_metadata=$(docker image inspect --format '{{.Os}}/{{.Architecture}}' "$bootstrap_image_ref" 2>>"$INSTALL_LOG" || true)
runtime_metadata=${runtime_metadata//$'\r'/}
printf 'bootstrap platform detection: ref=%s image-inspect=%s\n' "$bootstrap_image_ref" "${runtime_metadata:-<empty>}" >>"$INSTALL_LOG"
if [[ ! $runtime_metadata =~ ^[^/]+/[^/]+$ ]]; then
runtime_metadata=$(docker inspect --type image --format '{{.Os}}/{{.Architecture}}' "$bootstrap_image_ref" 2>>"$INSTALL_LOG" || true)
runtime_metadata=${runtime_metadata//$'\r'/}
printf 'bootstrap platform detection: ref=%s docker-inspect=%s\n' "$bootstrap_image_ref" "${runtime_metadata:-<empty>}" >>"$INSTALL_LOG"
fi
[[ $runtime_metadata =~ ^[^/]+/[^/]+$ ]] || die 'bootstrap runtime 的本地镜像平台元数据不完整;请查看 install.log 中的 docker image inspect 输出'
runtime_platform=$runtime_metadata
case "$runtime_platform" in case "$runtime_platform" in
linux/amd64) runtime_platform=linux-amd64;; linux/amd64) runtime_platform=linux-amd64;;
linux/arm64) runtime_platform=linux-arm64;; linux/arm64) runtime_platform=linux-arm64;;