fix(部署脚本): sh docker/deploy.sh 会挂在 pipefail,自己换 bash 重跑

Debian 的 /bin/sh 是 dash,没有 pipefail,一上来就 `Illegal option -o pipefail`。
在 set 之前加一行守卫,非 bash 就 exec 换 bash 重新执行(只用 dash 也认的语法)。

实测:本机 /bin/sh 指向 bash,所以这条得在容器里的真 dash 上验 ——
带守卫的版本正常往下跑(停在 docker/.env 不存在,因为只挂了脚本没挂仓库);
去掉守卫的对照版本在 dash 下直接 Bad substitution + 语法错误。

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-16 09:37:06 -06:00
parent eadfa0b04a
commit e060327de4

View File

@@ -15,6 +15,11 @@
#
# 前提docker/.env 已经填好(内容见 docs/specs/phase5-cutover-runbook.md 第三节)。
# `sh docker/deploy.sh` 会用 dash 跑Debian 的 /bin/sh 就是 dash而下面那行
# 的 pipefail 是 bash 专有的,一上来就报 `Illegal option -o pipefail`。
# 这行必须在 set 之前,且只能用 dash 也认的语法。
[ -n "${BASH_VERSION:-}" ] || exec bash "$0" "$@"
set -euo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")/.."