release: sync public installer asset install.sh
This commit is contained in:
+24
-6
@@ -725,15 +725,33 @@ if [[ $PG_HOST == postgres ]]; then
|
||||
fi
|
||||
progress '初始化数据库结构'
|
||||
printf '正在初始化数据库,请稍候...\n'
|
||||
set +e
|
||||
if (( EXISTING_DB )); then
|
||||
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
|
||||
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
|
||||
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=$?
|
||||
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
|
||||
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
|
||||
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
|
||||
run_migration
|
||||
migration_rc=$?
|
||||
set -e
|
||||
if (( migration_rc != 0 )); then
|
||||
persist_installer_log
|
||||
|
||||
Reference in New Issue
Block a user