setup_submodules
1.41 KB
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
#!/bin/bash
function print_usage_exit() {
echo "Usage $0 -i|--install|-u|--update"
echo " -i or --install Install the submodules mentioned in the submodules.list"
echo " -u or --update Update the submodules mentioned in the submodules.list"
echo " "
exit 1
}
function read_submodules() {
if [ -e ./submodules.list ]; then
source ./submodules.list
fi
}
function add_submodules() {
for SUB_MODULE in ${SUB_MODULES}
do
git submodule add -f git@gitlab.osdev.nl:OpenSystemsDevelopment/${SUB_MODULE} ${SUB_MODULE}
git config submodule.${SUB_MODULE}.url git@gitlab.osdev.nl:OpenSystemsDevelopment/${SUB_MODULE}
done
}
function get_submodules() {
git submodule update --init --recursive
}
function update_submodules() {
git submodule update --recursive
}
# =============================================================================
# == T H E M A I N E N T R Y O F T H I S S C R I P T ==
# =============================================================================
read_submodules
case "$1" in
-i*|--install*)
echo "Installing submodules for this repository ( ${PWD} )"
add_submodules
get_submodules
;;
-u*|--update*)
echo "Update submodules : ${SUB_MODULES}"
update_submodules
;;
*)
echo "No parameters found..."
print_usage_exit
;;
esac