-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinstall.sh
25 lines (21 loc) · 1.46 KB
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env bash
HAMLET_CLONE_ROOT_DEFAULT="$(pwd)/hamlet"
HAMLET_REPO_CFG_DEFAULT="https://raw.githubusercontent.com/hamlet-io/hamlet-bootstrap/master/config.json"
HAMLET_REPO_BRANCH_DEFAULT="master"
HAMLET_REPO_DEPTH_DEFAULT=1
export HAMLET_CLONE_ROOT="${HAMLET_CLONE_ROOT:-$HAMLET_CLONE_ROOT_DEFAULT}"
if [[ ! -d "${HAMLET_CLONE_ROOT}" ]]; then
# set branches
export HAMLET_REPO_CLI_BRANCH="${HAMLET_REPO_CLI_BRANCH:-$HAMLET_REPO_BRANCH_DEFAULT}"
export HAMLET_REPO_EXECUTOR_BRANCH="${HAMLET_REPO_EXECUTOR_BRANCH:-$HAMLET_REPO_BRANCH_DEFAULT}"
export HAMLET_REPO_PATTERNS_BRANCH="${HAMLET_REPO_PATTERNS_BRANCH:-$HAMLET_REPO_BRANCH_DEFAULT}"
export HAMLET_REPO_ENGINE_BRANCH="${HAMLET_REPO_ENGINE_BRANCH:-$HAMLET_REPO_BRANCH_DEFAULT}"
export HAMLET_REPO_AZURE_BRANCH="${HAMLET_REPO_AZURE_BRANCH:-$HAMLET_REPO_BRANCH_DEFAULT}"
export HAMLET_REPO_AWS_BRANCH="${HAMLET_REPO_AWS_BRANCH:-$HAMLET_REPO_BRANCH_DEFAULT}"
export HAMLET_REPO_BOOTSTRAP_BRANCH="${HAMLET_REPO_BOOTSTRAP_BRANCH:-$HAMLET_REPO_BRANCH_DEFAULT}"
export HAMLET_REPO_CFG="${HAMLET_REPO_CFG:-$HAMLET_REPO_CFG_DEFAULT}"
export HAMLET_REPO_DEPTH=${HAMLET_REPO_DEPTH:-$HAMLET_REPO_DEPTH_DEFAULT}
curl -L "${HAMLET_REPO_CFG}" | jq -r '.Repositories[] | "export BRANCH=HAMLET_REPO_\(.Id)_BRANCH; \(.Clone) && git clone --depth \(env.HAMLET_REPO_DEPTH) --branch ${!BRANCH} \(.Repository) \(env.HAMLET_CLONE_ROOT)/\(.Directory)" ' | bash
else
echo "Hamlet directory already exist."
fi