| #!/bin/bash |
| |
|
|
| |
| if ! command -v brew &> /dev/null; then |
| echo "未检测到 Homebrew,开始安装..." |
| /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" |
| |
| |
| if [[ -f "/opt/homebrew/bin/brew" ]]; then |
| |
| eval "$(/opt/homebrew/bin/brew shellenv)" |
| elif [[ -f "/usr/local/bin/brew" ]]; then |
| |
| eval "$(/usr/local/bin/brew shellenv)" |
| fi |
| fi |
|
|
| |
| brew update |
| brew install git |
|
|
| |
| curl -Ls https://astral.sh/uv/install.sh | sh |
|
|
| |
| export PATH="$HOME/.local/bin:$PATH" |
|
|
| |
| if [ -f "./web.py" ]; then |
| |
| : |
| elif [ -f "./gcli2api/web.py" ]; then |
| cd ./gcli2api |
| else |
| git clone https://github.com/su-kaka/gcli2api.git |
| cd ./gcli2api |
| fi |
|
|
| |
| git pull |
|
|
| |
| uv sync |
|
|
| |
| if [ -f ".venv/bin/activate" ]; then |
| source .venv/bin/activate |
| else |
| echo "❌ 未找到虚拟环境,请检查 uv 是否安装成功" |
| exit 1 |
| fi |
|
|
| |
| python3 web.py |
|
|