px4-firmware/Tools/check_submodules.sh

122 lines
2.9 KiB
Bash
Raw Normal View History

#!/bin/sh
2014-07-07 12:35:47 -03:00
[ -n "$GIT_SUBMODULES_ARE_EVIL" ] && {
# GIT_SUBMODULES_ARE_EVIL is set, meaning user doesn't want submodules
echo "Skipping submodules. NUTTX_SRC is set to $NUTTX_SRC"
exit 0
}
2014-07-07 12:35:47 -03:00
if [ -d NuttX/nuttx ];
then
2014-07-10 11:14:21 -03:00
STATUSRETVAL=$(git submodule summary | grep -A20 -i "NuttX" | grep "<")
if [ -z "$STATUSRETVAL" ]; then
2014-07-07 17:20:55 -03:00
echo "Checked NuttX submodule, correct version found"
2014-07-07 12:35:47 -03:00
else
2015-02-03 15:27:51 -04:00
echo ""
echo ""
echo "New commits required:"
echo "$(git submodule summary)"
2014-07-12 14:28:10 -03:00
echo ""
echo ""
echo " NuttX sub repo not at correct version. Try 'git submodule update'"
echo " or follow instructions on http://pixhawk.org/dev/git/submodules"
echo ""
echo " DO NOT FORGET TO RUN 'make distclean && make archives' AFTER EACH NUTTX UPDATE!"
2014-07-07 12:35:47 -03:00
exit 1
fi
else
2014-07-07 12:35:47 -03:00
git submodule init;
git submodule update;
fi
2014-07-07 12:35:47 -03:00
if [ -d mavlink/include/mavlink/v1.0 ];
then
2014-07-10 11:14:21 -03:00
STATUSRETVAL=$(git submodule summary | grep -A20 -i "mavlink/include/mavlink/v1.0" | grep "<")
if [ -z "$STATUSRETVAL" ]; then
2014-07-07 17:20:55 -03:00
echo "Checked mavlink submodule, correct version found"
2014-07-07 12:35:47 -03:00
else
2014-07-10 11:14:21 -03:00
echo ""
echo ""
echo "New commits required:"
echo "$(git submodule summary)"
echo ""
2015-02-03 15:27:51 -04:00
echo ""
echo "mavlink sub repo not at correct version. Try 'git submodule update'"
echo "or follow instructions on http://pixhawk.org/dev/git/submodules"
2014-07-07 12:35:47 -03:00
exit 1
fi
2014-07-07 12:18:54 -03:00
else
2014-07-07 12:35:47 -03:00
git submodule init;
git submodule update;
2014-07-07 12:18:54 -03:00
fi
2014-07-08 13:19:17 -03:00
2014-07-12 10:45:05 -03:00
if [ -d uavcan ]
2014-07-08 13:19:17 -03:00
then
2014-07-12 10:45:05 -03:00
STATUSRETVAL=$(git submodule summary | grep -A20 -i uavcan | grep "<")
if [ -z "$STATUSRETVAL" ]
then
2014-07-08 13:19:17 -03:00
echo "Checked uavcan submodule, correct version found"
else
2015-02-03 15:27:51 -04:00
echo ""
echo ""
echo "New commits required:"
echo "$(git submodule summary)"
2014-07-12 10:45:05 -03:00
echo ""
echo ""
echo "uavcan sub repo not at correct version. Try 'git submodule update'"
2014-07-08 13:19:17 -03:00
echo "or follow instructions on http://pixhawk.org/dev/git/submodules"
2015-02-03 15:27:51 -04:00
exit 1
fi
else
git submodule init;
git submodule update;
fi
if [ -d Tools/gencpp ]
then
STATUSRETVAL=$(git submodule summary | grep -A20 -i gencpp | grep "<")
if [ -z "$STATUSRETVAL" ]
then
echo "Checked gencpp submodule, correct version found"
else
2014-07-12 10:45:05 -03:00
echo ""
echo ""
echo "New commits required:"
echo "$(git submodule summary)"
echo ""
2015-02-03 15:27:51 -04:00
echo ""
echo "gencpp sub repo not at correct version. Try 'git submodule update'"
echo "or follow instructions on http://pixhawk.org/dev/git/submodules"
exit 1
fi
else
git submodule init;
git submodule update;
fi
if [ -d Tools/genmsg ]
then
STATUSRETVAL=$(git submodule summary | grep -A20 -i genmsg | grep "<")
if [ -z "$STATUSRETVAL" ]
then
echo "Checked genmsg submodule, correct version found"
else
echo ""
echo ""
echo "New commits required:"
echo "$(git submodule summary)"
echo ""
echo ""
echo "genmsg sub repo not at correct version. Try 'git submodule update'"
echo "or follow instructions on http://pixhawk.org/dev/git/submodules"
2014-07-08 13:19:17 -03:00
exit 1
fi
else
git submodule init;
git submodule update;
2014-07-08 13:19:17 -03:00
fi
exit 0