From 24e652207b7c43b0dccf62eab054188fe4676d3d Mon Sep 17 00:00:00 2001 From: admin Date: Mon, 7 Sep 2026 03:39:10 +0000 Subject: [PATCH] release: sync public installer asset install.sh --- install.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/install.sh b/install.sh index d9c3caf..1e8b540 100644 --- a/install.sh +++ b/install.sh @@ -1330,6 +1330,22 @@ progress '下载 bootstrap runtime' if ! run_logged "${COMPOSE[@]}" --project-directory "$INSTALL_DIR" --env-file "$INSTALL_DIR/.env" -f "$INSTALL_DIR/compose.yaml" "${COMPOSE_FUSE[@]}" pull app; then die 'bootstrap runtime 下载失败;请确认能访问 git.keeper.work Container Registry' fi +validate_bootstrap_runtime_platform() { + local bootstrap_image_id runtime_metadata runtime_os runtime_arch 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' + [[ -n $bootstrap_image_id ]] || die '无法确定 bootstrap runtime 的本地镜像 ID' + runtime_metadata=$(docker image inspect --format '{{.Os}}\t{{.Architecture}}' "$bootstrap_image_id" 2>>"$INSTALL_LOG") || die '无法读取 bootstrap runtime 的本地镜像平台元数据' + IFS=$'\t' read -r runtime_os runtime_arch <<<"$runtime_metadata" + [[ -n $runtime_os && -n $runtime_arch ]] || die 'bootstrap runtime 的本地镜像平台元数据不完整' + runtime_platform="$runtime_os/$runtime_arch" + case "$runtime_platform" in + linux/amd64) runtime_platform=linux-amd64;; + linux/arm64) runtime_platform=linux-arm64;; + *) die "bootstrap runtime 平台为 $runtime_platform,无法验证;需要 linux-amd64 或 linux-arm64 的 multiarch 镜像";; + esac + [[ $runtime_platform == "$PLATFORM" ]] || die "bootstrap runtime 平台为 $runtime_platform,但当前主机需要 $PLATFORM;请使用 multiarch 镜像" +} +validate_bootstrap_runtime_platform progress '准备 PostgreSQL 连接' if (( LOCAL_DB )); then if ! run_logged "${COMPOSE[@]}" --profile local-db --project-directory "$INSTALL_DIR" --env-file "$INSTALL_DIR/.env" -f "$INSTALL_DIR/compose.yaml" up -d postgres; then