-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.sh
26 lines (23 loc) · 954 Bytes
/
init.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
#!/bin/sh
#
# TODO check if cleansed git local repo (to avoid to commit undesired files with the submodules)
if [ ! -d Scripts ]; then
echo "Adding 'Scripts' to repository && commit changes";
git submodule add https://github.com/xldeveloper/Scripts.git Scripts \
&& git commit -am "Added 'Scripts' git sub-module" \
&& git submodule init \
&& git submodule update;
# add other sub-modules
if [ -d Scripts ]; then
./Scripts/git-add-submodule-pairs.sh "https://github.com/xldeveloper/Sample2D.git" "Sample2D" "https://github.com/xldeveloper/Sample3D.git" "Sample3D";
git commit -am "Added sub-modules";
fi;
fi;
#check if '.gitmodules' file exist (!0)
gitmodulesfile=$(ls -a '.gitmodules' 2>/dev/null | sed -e "/\.$/d" | wc -l);
if [ ! $gitmodulesfile -eq 0 ]; then
echo "Initializing & updating sub-modules";
git submodule init \
&& git submodule update --init --recursive \
&& git submodule update --remote --rebase --recursive;
fi;