-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclone-and-link-all-git-repos.sh
106 lines (85 loc) · 2.86 KB
/
clone-and-link-all-git-repos.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
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/usr/bin/env bash
# -----------------------------------------------------------------------------
# Safety settings (see https://gist.github.com/ilg-ul/383869cbb01f61a51c4d).
if [[ ! -z ${DEBUG} ]]
then
set ${DEBUG} # Activate the expand mode if DEBUG is anything but empty.
else
DEBUG=""
fi
set -o errexit # Exit if command failed.
set -o pipefail # Exit if pipe failed.
set -o nounset # Exit if variable not set.
# Remove the initial space and instead use '\n'.
IFS=$'\n\t'
# -----------------------------------------------------------------------------
# Identify the script location, to reach, for example, the helper scripts.
script_path="$0"
if [[ "${script_path}" != /* ]]
then
# Make relative path absolute.
script_path="$(pwd)/$0"
fi
script_name="$(basename "${script_path}")"
script_folder_path="$(dirname "${script_path}")"
script_folder_name="$(basename "${script_folder_path}")"
# =============================================================================
# Clone a repo and checkout the development branch, possibly a given commit.
function clone()
{
local repo_name="$1"
local branch_name="$2"
if [ -d "${repo_name}.git" ]
then
echo "${repo_name}.git already present, skiped..."
else
git clone --branch "${branch_name}" https://github.com/micro-os-plus/${repo_name}.git ${repo_name}.git
fi
}
function clone-and-link()
{
local repo_name="$1"
clone "${repo_name}" "xpack-develop"
# Link it to the central xPacks repo.
xpm link -C ${repo_name}.git
}
# -----------------------------------------------------------------------------
# "$1" is an optional destination folder path.
# The default is `${HOME}/Work/micro-os-plus-xpack-repos`.
(
if [ $# -ge 1 ]
then
dest="$1"
else
dest="${HOME}/Work/micro-os-plus-xpack-repos"
fi
mkdir -p "${dest}"
cd "${dest}"
clone "helper-scripts" "master"
clone-and-link "architecture-cortexm-xpack"
clone-and-link "architecture-riscv-xpack"
clone-and-link "architecture-synthetic-posix-xpack"
clone-and-link "build-helper-xpack"
clone-and-link "cmsis-os-xpack"
clone-and-link "devices-sifive-xpack"
clone-and-link "devices-stm32f0-extras-xpack"
clone-and-link "devices-stm32f4-extras-xpack"
clone-and-link "diag-trace-xpack"
clone-and-link "libs-c-xpack"
clone-and-link "libs-cpp-estd-xpack"
clone-and-link "libs-cpp-xpack"
clone-and-link "memory-allocators-xpack"
clone-and-link "micro-test-plus-xpack"
clone-and-link "platform-sifive-arty-xpack"
clone-and-link "platform-sifive-hifive1-xpack"
clone-and-link "platform-stm32f4discovery-xpack"
clone-and-link "posix-io-xpack"
clone-and-link "rtos-xpack"
clone-and-link "semihosting-xpack"
clone-and-link "startup-xpack"
clone-and-link "utils-lists-xpack"
clone-and-link "version-xpack"
)
echo
echo "Done."
# -----------------------------------------------------------------------------