Files
ECAP_Server/third_party/init.bash
T
2026-07-14 16:26:51 +08:00

28 lines
720 B
Bash

#!/usr/bin/env bash
set -euo pipefail
root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$root"
origin="$(git remote get-url origin)"
origin="${origin%/}"
remote_root="$(printf '%s\n' "$origin" | sed -E 's#/[^/]+(\.git)?$##')"
fetch_repo() {
local repo="$1"
local branch="$2"
local dir="$3"
if [ -d "$dir" ]; then
echo "文件夹【$dir】已存在 跳过初始化 "
else
git clone --branch "$branch" --single-branch "$repo" "$dir"
fi
}
fetch_repo_ex() {
local name="$1"
local repo="${remote_root}/${name}"
local branch="master"
fetch_repo "$repo" "$branch" "third_party/${name}"
}
fetch_repo_ex "build_infra"
fetch_repo_ex "CPP_Core"
fetch_repo_ex "SSR"
fetch_repo_ex "eacp_webapp"