summaryrefslogtreecommitdiffstats
path: root/build/setup/repos.sh
blob: 208ba3e381711e6a40a105ef02615b72c1876334 (plain)
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#! /usr/bin/env bash

set -o errexit

repo_group="$1"
setup_path="$2"
repos_path="$3"
[ -z "$repo_group" ] && repo_group="all"
[ -z "$setup_path" ] && setup_path="/root/setup"
[ -z "$repos_path" ] && repos_path="/ccpi/repos"

repos_astra=( \
    "https://github.com/astra-toolbox/astra-toolbox.git master astra.sh" \
)

repos_ccpi=( \
    "https://github.com/vais-ral/CCPi-Framework.git master ccpi.sh" \
    "https://github.com/vais-ral/CCPi-FrameworkPlugins.git master ccpi.sh" \
    "https://github.com/vais-ral/CCPi-astra.git master ccpi.sh" \
    "https://github.com/vais-ral/CCPi-Regularisation-Toolkit.git master ccpi.sh" \
)

repos_ufo=( \
    "https://github.com/ufo-kit/ufo-core.git master cmake.sh" \
    "https://github.com/ufo-kit/ufo-filters.git master cmake.sh" \
    "https://github.com/ufo-kit/tofu master python.sh" \
)

repos_all=("${repos_astra[@]}" "${repos_ccpi[@]}")
declare -n repos="repos_$repo_group"

function install_repo {
    repo="$1"
    name=$(basename "$repo" .git)
    branch="$2"
    script="$3"

    [ -d "$name" ] || git clone --recurse-submodules  "$repo"

    (
	cd "$name"
	git pull origin "$branch"
	git checkout "$branch"
	git submodule update --recursive --remote
	bash "$setup_path/build/$script"
	ln -sf "$setup_path/build/$script" ands_install.sh
    )
}

mkdir -p "$repos_path"
(
    cd "$repos_path"
    for repo in "${repos[@]}"; do
	install_repo $repo
    done
)