From 72ccbe9c4ed304997fa5a4fdbf4bd668c69c35b0 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Mon, 7 Jul 2014 17:35:47 +0200 Subject: [PATCH] Fixed check tools --- Makefile | 4 ++-- Tools/check_submodules.sh | 36 ++++++++++++++++++++++++++---------- 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 7ea74eaae2..7703cc04eb 100644 --- a/Makefile +++ b/Makefile @@ -210,11 +210,11 @@ menuconfig: endif $(NUTTX_SRC): - $(Q) if [ -d $(NUTTX_SRC) ]; then ./Tools/check_submodules.sh; else echo ""; echo ""; echo "NuttX submodule missing, doing auto checkout"; git submodule init; git submodule update; fi + $(Q) (./Tools/check_submodules.sh) .PHONY: checksubmodules checksubmodules: - $(Q) if [ -d $(MAVLINK_SRC) ]; then ./Tools/check_submodules.sh; else echo ""; echo ""; echo "MAVLink submodule missing, doing auto checkout"; git submodule init; git submodule update; fi + $(Q) (./Tools/check_submodules.sh) # # Testing targets diff --git a/Tools/check_submodules.sh b/Tools/check_submodules.sh index c431e82252..d31c1588c7 100755 --- a/Tools/check_submodules.sh +++ b/Tools/check_submodules.sh @@ -1,18 +1,34 @@ #!/bin/sh -STATUSRETVAL=$(git status --porcelain | grep -i "M mavlink/include/mavlink/v1.0") -if [ "$STATUSRETVAL" == "" ]; then - echo "checked mavlink submodule, correct version found" + +if [ -d NuttX/nuttx ]; + 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 'git submodule update'" + echo "or follow instructions on http://pixhawk.org/dev/git/submodules" + exit 1 + fi else - echo "mavlink sub repo not at correct version. Try 'git submodule update'" - exit 1 + git submodule init; + git submodule update; fi -STATUSRETVAL=$(git status --porcelain | grep -i "M NuttX") -if [ "$STATUSRETVAL" == "" ]; then - echo "checked NuttX submodule, correct version found" + +if [ -d mavlink/include/mavlink/v1.0 ]; + 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 'git submodule update'" + echo "or follow instructions on http://pixhawk.org/dev/git/submodules" + exit 1 + fi else - echo "NuttX sub repo not at correct version. Try 'git submodule update'" - exit 1 + git submodule init; + git submodule update; fi exit 0