修复一键部署bug
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
# Shell 脚本在仓库内统一 LF,避免 Linux 上 bash: pipefail: invalid option name(CRLF)
|
||||
*.sh text eol=lf
|
||||
deploy/** text eol=lf
|
||||
@@ -38,6 +38,14 @@ bash deploy/setup_env.sh --only binance,gate
|
||||
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
@@ -7,7 +7,12 @@
|
||||
# bash deploy/setup_env.sh --skip-pm2
|
||||
# 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)"
|
||||
REPO_ROOT="$(cd "${DEPLOY_DIR}/.." && pwd)"
|
||||
|
||||
Reference in New Issue
Block a user