修复一键部署bug

This commit is contained in:
dekun
2026-05-21 15:11:11 +08:00
parent 39815c1df6
commit 576e8b0b12
3 changed files with 268 additions and 252 deletions
+3
View File
@@ -0,0 +1,3 @@
# Shell 脚本在仓库内统一 LF,避免 Linux 上 bash: pipefail: invalid option nameCRLF
*.sh text eol=lf
deploy/** text eol=lf
+8
View File
@@ -38,6 +38,14 @@ bash deploy/setup_env.sh --only binance,gate
bash deploy/setup_env.sh --recreate-venv bash deploy/setup_env.sh --recreate-venv
``` ```
若在 Windows 编辑过脚本后在 Linux 报错 `set: pipefail: invalid option name`,先去掉 CRLF 再执行:
```bash
sed -i 's/\r$//' deploy/setup_env.sh
# 或: apt install -y dos2unix && dos2unix deploy/setup_env.sh
bash deploy/setup_env.sh
```
## 脚本会做什么 ## 脚本会做什么
| 步骤 | 说明 | | 步骤 | 说明 |
+6 -1
View File
@@ -7,7 +7,12 @@
# bash deploy/setup_env.sh --skip-pm2 # bash deploy/setup_env.sh --skip-pm2
# bash deploy/setup_env.sh --recreate-venv # bash deploy/setup_env.sh --recreate-venv
# #
set -euo pipefail set -e
set -u
# 避免 Windows CRLF 导致 set -euo pipefail 一行报错;pipefail 仅 bash 支持
if [ -n "${BASH_VERSION:-}" ]; then
set -o pipefail
fi
DEPLOY_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" DEPLOY_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "${DEPLOY_DIR}/.." && pwd)" REPO_ROOT="$(cd "${DEPLOY_DIR}/.." && pwd)"