aboutsummaryrefslogtreecommitdiff
path: root/Tools/check_submodules.sh
blob: 4b8789b28894cee4d3f6c1fec98c60eb0d3d7e12 (plain) (blame)
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
#!/bin/sh

[ -n "$NUTTX_SRC" ] && {
    # NUTTX_SRC is set, meaning user is overriding the NuttX tree to use. Don't 
    # use submodules to pull an alternatiie tree
    echo "Skipping submodules as NUTTX_SRC is set to $NUTTX_SRC"
    exit 0
}

if [ -d NuttX/nuttx ];
	then
	STATUSRETVAL=$(git status --porcelain | grep -i "NuttX")
	if [ "$STATUSRETVAL" == "" ]; then
		echo "Checked NuttX submodule, correct version found"
	else
		echo "NuttX sub repo not at correct version. Try 'make updatesubmodules'"
		echo "or follow instructions on http://pixhawk.org/dev/git/submodules"
		exit 1
	fi
else
	git submodule init;
	git submodule update;
fi


if [ -d mavlink/include/mavlink/v1.0 ];
	then
	STATUSRETVAL=$(git status --porcelain | grep -i "mavlink/include/mavlink/v1.0")
	if [ "$STATUSRETVAL" == "" ]; then
		echo "Checked mavlink submodule, correct version found"
	else
		echo "mavlink sub repo not at correct version. Try 'make updatesubmodules'"
		echo "or follow instructions on http://pixhawk.org/dev/git/submodules"
		exit 1
	fi
else
	git submodule init;
	git submodule update;
fi

exit 0