File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,7 +7,29 @@ set -euo pipefail
77# 支持 Linux / macOS / WSL
88# ==================================================
99
10- SCRIPT_DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd) "
10+ # 获取脚本真实路径(兼容管道执行和本地执行)
11+ if [[ " ${BASH_SOURCE[0]} " != " ${0} " ]]; then
12+ SCRIPT_PATH=" ${BASH_SOURCE[0]} "
13+ else
14+ SCRIPT_PATH=" $0 "
15+ fi
16+
17+ if [[ -f " $SCRIPT_PATH " ]]; then
18+ SCRIPT_DIR=" $( cd " $( dirname " $SCRIPT_PATH " ) " && pwd) "
19+ else
20+ # 管道执行,尝试使用当前目录作为项目根目录
21+ SCRIPT_DIR=" $( pwd) "
22+ # 检查当前目录是否包含必要的子目录
23+ if [[ ! -d " $SCRIPT_DIR /lib" || ! -d " $SCRIPT_DIR /modules" ]]; then
24+ echo " 错误:无法自动确定项目根目录。"
25+ echo " 请先使用 git clone 克隆项目,然后在项目目录内执行:"
26+ echo " git clone https://github.com/ISHAOHAO/devboost.git"
27+ echo " cd devboost"
28+ echo " ./install.sh"
29+ exit 1
30+ fi
31+ fi
32+
1133export DEVBOOST_ROOT=" $SCRIPT_DIR "
1234export DEVBOOST_BACKUP_DIR=" $DEVBOOST_ROOT /backups"
1335export DEVBOOST_LOG_DIR=" $DEVBOOST_ROOT /logs"
You can’t perform that action at this time.
0 commit comments