release: sync public installer asset install.sh

This commit is contained in:
2026-09-02 04:00:50 +00:00
parent e5371da2f6
commit cc06487f1e
+26 -8
View File
@@ -725,15 +725,33 @@ if [[ $PG_HOST == postgres ]]; then
fi fi
progress '初始化数据库结构' progress '初始化数据库结构'
printf '正在初始化数据库,请稍候...\n' printf '正在初始化数据库,请稍候...\n'
run_migration() {
local migration_log migration_rc
migration_log=$(mktemp "$INSTALL_TMP_DIR/migration.XXXXXX.log") || die '无法创建数据库迁移日志'
chmod 600 "$migration_log"
if (( EXISTING_DB )); then
export XYMEDIA_EXTERNAL_MIGRATION_CONFIRM=YES
if "${COMPOSE[@]}" --profile migration --project-directory "$INSTALL_DIR" --env-file "$INSTALL_DIR/.env" -f "$INSTALL_DIR/compose.yaml" "${COMPOSE_FUSE[@]}" run --rm -T --no-deps app-migrate migrate --config /app/config.yaml >"$migration_log" 2>&1; then
migration_rc=0
else
migration_rc=$?
fi
else
if "${COMPOSE[@]}" --profile migration --project-directory "$INSTALL_DIR" --env-file "$INSTALL_DIR/.env" -f "$INSTALL_DIR/compose.yaml" "${COMPOSE_FUSE[@]}" run --rm -T --no-deps app-migrate migrate --new --config /app/config.yaml >"$migration_log" 2>&1; then
migration_rc=0
else
migration_rc=$?
fi
fi
cat "$migration_log"
cat "$migration_log" >>"$INSTALL_LOG"
printf '数据库迁移退出码:%s\n' "$migration_rc"
printf '数据库迁移退出码:%s\n' "$migration_rc" >>"$INSTALL_LOG"
return "$migration_rc"
}
set +e set +e
if (( EXISTING_DB )); then run_migration
export XYMEDIA_EXTERNAL_MIGRATION_CONFIRM=YES migration_rc=$?
run_visible_logged "${COMPOSE[@]}" --profile migration --project-directory "$INSTALL_DIR" --env-file "$INSTALL_DIR/.env" -f "$INSTALL_DIR/compose.yaml" "${COMPOSE_FUSE[@]}" run --rm -T --no-deps app-migrate migrate --config /app/config.yaml
migration_rc=$?
else
run_visible_logged "${COMPOSE[@]}" --profile migration --project-directory "$INSTALL_DIR" --env-file "$INSTALL_DIR/.env" -f "$INSTALL_DIR/compose.yaml" "${COMPOSE_FUSE[@]}" run --rm -T --no-deps app-migrate migrate --new --config /app/config.yaml
migration_rc=$?
fi
set -e set -e
if (( migration_rc != 0 )); then if (( migration_rc != 0 )); then
persist_installer_log persist_installer_log