diff --git a/install.sh b/install.sh index 8e9044a..0fb942c 100644 --- a/install.sh +++ b/install.sh @@ -32,6 +32,10 @@ run_logged() { fi return 1 } +run_visible_logged() { + "$@" 2>&1 | tee -a "$INSTALL_LOG" + return "${PIPESTATUS[0]}" +} usage() { sed -n '1,20p' "$0"; } while (($#)); do case "$1" in @@ -227,11 +231,11 @@ fi progress '初始化数据库结构' if (( EXISTING_DB )); then export XYMEDIA_EXTERNAL_MIGRATION_CONFIRM=YES - if ! run_logged "${COMPOSE[@]}" --profile migration --project-directory "$INSTALL_DIR" --env-file "$INSTALL_DIR/.env" -f "$INSTALL_DIR/compose.yaml" run --rm --no-deps app-migrate migrate --config /app/config.yaml; then + if ! run_visible_logged "${COMPOSE[@]}" --profile migration --project-directory "$INSTALL_DIR" --env-file "$INSTALL_DIR/.env" -f "$INSTALL_DIR/compose.yaml" run --rm --no-deps app-migrate migrate --config /app/config.yaml; then die '已有数据库迁移失败' fi else - if ! run_logged "${COMPOSE[@]}" --profile migration --project-directory "$INSTALL_DIR" --env-file "$INSTALL_DIR/.env" -f "$INSTALL_DIR/compose.yaml" run --rm --no-deps app-migrate migrate --new --config /app/config.yaml; then + if ! run_visible_logged "${COMPOSE[@]}" --profile migration --project-directory "$INSTALL_DIR" --env-file "$INSTALL_DIR/.env" -f "$INSTALL_DIR/compose.yaml" run --rm --no-deps app-migrate migrate --new --config /app/config.yaml; then die '数据库初始化失败' fi fi