commit 57cbd1cd162f4326a8a463d9688a44b36c28b5d7
Author: Thomas Schöpping <tschoepp@cit-ec.uni-bielefeld.de>
Date:   Mon Jan 21 14:02:13 2019 +0100

    Bash scripts: introduced a new function to check dependencies.
    This function is used by several files to ensure that git, make, etc. are available.

diff --git a/bootloader/bootloadersetup.sh b/bootloader/bootloadersetup.sh
index d47a5a3..491c25f 100755
--- a/bootloader/bootloadersetup.sh
+++ b/bootloader/bootloadersetup.sh
@@ -263,6 +263,40 @@ function setLogFile {
   return 0
 }
 
+### check whether commands are available #######################################
+# Checks whether the specified commands are available and can be executed.
+#
+# usage:      checkCommand [<command> <command> ...]
+# arguments:  <command>
+#                 Name of the command to check.
+# return:     0
+#                 All requested commands are available.
+#             >0
+#                 Number of requested commands that were not found.
+#             -1
+#                 No argument given.
+#
+function checkCommands {
+  local status=0
+
+  # return if no argument was specified
+  if [ $# -eq 0 ]; then
+    return -1
+  fi
+
+  # check all specified commands
+  while [ $# -gt 0 ]; do
+    command -v $1 &>/dev/null
+    if [ $? -ne 0 ]; then
+      printWarning "Command '$1' not available.\n"
+      status=$((status + 1))
+    fi
+    shift 1
+  done
+
+  return $status
+}
+
 ################################################################################
 # SPECIFIC FUNCTIONS                                                           #
 ################################################################################
@@ -329,6 +363,8 @@ function printHelp {
 #                 Warning: Arborted by user.
 #             -1
 #                 Error: Unexpected user input.
+#             -2
+#                 Error: Missing dependencies.
 #
 function initAmiroBlt {
   printInfo "initializing AMiRo-BLT submodule...\n"
@@ -354,6 +390,13 @@ function initAmiroBlt {
     esac
   fi
 
+  # check dependencies
+  checkCommands git
+  if [ $? -ne 0 ]; then
+    printError "Missing dependencies detected.\n"
+    return -2
+  fi
+
   # initialize submodule to default branch
   cd $bootloaderdir
   git submodule update --init $amirobltdir 2>&1 | tee -a $LOG_FILE
@@ -412,13 +455,30 @@ function amiroBltSetup {
 #
 # usage:      wipeAmiroBlt
 # arguments:  n/a
-# return:     n/a
+# return:     0
+#                 No error or warning occurred.
+#             1
+#                 Warning: AMiRo-BLT Git submodule already empty
+#             2
+#                 Warning: Aborted by user.
+#             -1
+#                 Error: Unexpected input occurred
+#             -2
+#                 Error: Missing dependencies.
+#
 function wipeAmiroBlt {
   printInfo "reset and wipe Git submodule $amirobltdir\n"
   local userdir=$(pwd)
   local bootloaderdir=$(dirname $(realpath ${BASH_SOURCE[0]}))
   local amirobltdir=${bootloaderdir}/AMiRo-BLT
 
+  # check dependencies
+  checkCommands git
+  if [ $? -ne 0 ]; then
+    printError "Missing dependencies detected.\n"
+    return -2
+  fi
+
   # if the AMiRo-BLT folder is empty
   if [ -z "$(ls -A $amirobltdir)" ]; then
     printWarning "$amirobltdir is already empty\n"
diff --git a/kernel/kernelsetup.sh b/kernel/kernelsetup.sh
index b359616..f8aced8 100755
--- a/kernel/kernelsetup.sh
+++ b/kernel/kernelsetup.sh
@@ -263,6 +263,40 @@ function setLogFile {
   return 0
 }
 
+### check whether commands are available #######################################
+# Checks whether the specified commands are available and can be executed.
+#
+# usage:      checkCommand [<command> <command> ...]
+# arguments:  <command>
+#                 Name of the command to check.
+# return:     0
+#                 All requested commands are available.
+#             >0
+#                 Number of requested commands that were not found.
+#             -1
+#                 No argument given.
+#
+function checkCommands {
+  local status=0
+
+  # return if no argument was specified
+  if [ $# -eq 0 ]; then
+    return -1
+  fi
+
+  # check all specified commands
+  while [ $# -gt 0 ]; do
+    command -v $1 &>/dev/null
+    if [ $? -ne 0 ]; then
+      printWarning "Command '$1' not available.\n"
+      status=$((status + 1))
+    fi
+    shift 1
+  done
+
+  return $status
+}
+
 ################################################################################
 # SPECIFIC FUNCTIONS                                                           #
 ################################################################################
@@ -333,6 +367,8 @@ function printHelp {
 #                 Warning: Aborted by user.
 #             -1
 #                 Error: Unexpected user input.
+#             -1
+#                 Error: Missing dependency.
 #
 function initChibiOS {
   printInfo "initializing ChibiOS submodule...\n"
@@ -358,6 +394,13 @@ function initChibiOS {
     esac
   fi
 
+  # check dependencies
+  checkCommands git
+  if [ $? -ne 0 ]; then
+    printError "Missing dependencies detected.\n"
+    return -2
+  fi
+
   # initialize submodule to default branch
   cd $kerneldir
   git submodule update --init $chibiosdir 2>&1 | tee -a $LOG_FILE
@@ -403,6 +446,13 @@ function patchChibiOS {
   local chibiosdir=${kerneldir}/ChibiOS
   local git_branch_patched="AMiRo-OS"
 
+  # check dependencies
+  checkCommands git
+  if [ $? -ne 0 ]; then
+    printError "Missing dependencies detected.\n"
+    return -2
+  fi
+
   # if the ChibiOS folder is empty
   if [ -z "$(ls -A $chibiosdir)" ]; then
     printWarning "$chibiosdir is empty. Please initialize first.\n"
@@ -615,6 +665,13 @@ function wipeChibiOS {
   local chibiosdir=${kerneldir}/ChibiOS
   local git_branch_patched="AMiRo-OS"
 
+  # check dependencies
+  checkCommands git
+  if [ $? -ne 0 ]; then
+    printError "Missing dependencies detected.\n"
+    return -2
+  fi
+
   # if the ChibiOS folder is empty
   if [ -z "$(ls -A $chibiosdir)" ]; then
     printInfo "$chibiosdir is alread empty\n"
diff --git a/periphery-lld/peripherylldsetup.sh b/periphery-lld/peripherylldsetup.sh
index 667e7cc..ecd28bc 100755
--- a/periphery-lld/peripherylldsetup.sh
+++ b/periphery-lld/peripherylldsetup.sh
@@ -263,6 +263,40 @@ function setLogFile {
   return 0
 }
 
+### check whether commands are available #######################################
+# Checks whether the specified commands are available and can be executed.
+#
+# usage:      checkCommand [<command> <command> ...]
+# arguments:  <command>
+#                 Name of the command to check.
+# return:     0
+#                 All requested commands are available.
+#             >0
+#                 Number of requested commands that were not found.
+#             -1
+#                 No argument given.
+#
+function checkCommands {
+  local status=0
+
+  # return if no argument was specified
+  if [ $# -eq 0 ]; then
+    return -1
+  fi
+
+  # check all specified commands
+  while [ $# -gt 0 ]; do
+    command -v $1 &>/dev/null
+    if [ $? -ne 0 ]; then
+      printWarning "Command '$1' not available.\n"
+      status=$((status + 1))
+    fi
+    shift 1
+  done
+
+  return $status
+}
+
 ################################################################################
 # SPECIFIC FUNCTIONS                                                           #
 ################################################################################
@@ -327,6 +361,8 @@ function printHelp {
 #                 Warning: Arborted by user.
 #             -1
 #                 Error: Unexpected user input.
+#             -2
+#                 Error: Missing dependencies.
 #
 function initAmiroLld {
   printInfo "initializing AMiRo-LLD submodule...\n"
@@ -352,6 +388,13 @@ function initAmiroLld {
     esac
   fi
 
+  # check dependencies
+  checkCommands git
+  if [ $? -ne 0 ]; then
+    printError "Missing dependencies detected.\n"
+    return -2
+  fi
+
   # initialize submodule to default branch
   cd $peripheryllddir
   git submodule update --init $amirollddir 2>&1 | tee -a $LOG_FILE
@@ -381,13 +424,30 @@ function initAmiroLld {
 #
 # usage:      wipeAmiroLld
 # arguments:  n/a
-# return:     n/a
+# return:     0
+#                 No error or warning occurred.
+#             1
+#                 Warning: AMiRo-LLD Git submodule already empty
+#             2
+#                 Warning: Aborted by user.
+#             -1
+#                 Error: Unexpected input occurred.
+#             -2
+#                 Error: Missing dependencies.
+#
 function wipeAmiroLld {
   printInfo "reset and wipe Git submodule $amirollddir\n"
   local userdir=$(pwd)
   local peripheryllddir=$(dirname $(realpath ${BASH_SOURCE[0]}))
   local amirollddir=${peripheryllddir}/AMiRo-LLD
 
+  # check dependencies
+  checkCommands git
+  if [ $? -ne 0 ]; then
+    printError "Missing dependencies detected.\n"
+    return -2
+  fi
+
   # if the AMiRo-LLD folder is empty
   if [ -z "$(ls -A $amirollddir)" ]; then
     printWarning "$amirollddir is already empty\n"
diff --git a/setup.sh b/setup.sh
index 3b72a94..bf8b54b 100755
--- a/setup.sh
+++ b/setup.sh
@@ -263,6 +263,40 @@ function setLogFile {
   return 0
 }
 
+### check whether commands are available #######################################
+# Checks whether the specified commands are available and can be executed.
+#
+# usage:      checkCommand [<command> <command> ...]
+# arguments:  <command>
+#                 Name of the command to check.
+# return:     0
+#                 All requested commands are available.
+#             >0
+#                 Number of requested commands that were not found.
+#             -1
+#                 No argument given.
+#
+function checkCommands {
+  local status=0
+
+  # return if no argument was specified
+  if [ $# -eq 0 ]; then
+    return -1
+  fi
+
+  # check all specified commands
+  while [ $# -gt 0 ]; do
+    command -v $1 &>/dev/null
+    if [ $? -ne 0 ]; then
+      printWarning "Command '$1' not available.\n"
+      status=$((status + 1))
+    fi
+    shift 1
+  done
+
+  return $status
+}
+
 ################################################################################
 # SPECIFIC FUNCTIONS                                                           #
 ################################################################################
diff --git a/tools/ide/QtCreator/QtCreatorSetup.sh b/tools/ide/QtCreator/QtCreatorSetup.sh
index 8463946..afd3685 100755
--- a/tools/ide/QtCreator/QtCreatorSetup.sh
+++ b/tools/ide/QtCreator/QtCreatorSetup.sh
@@ -263,6 +263,40 @@ function setLogFile {
   return 0
 }
 
+### check whether commands are available #######################################
+# Checks whether the specified commands are available and can be executed.
+#
+# usage:      checkCommand [<command> <command> ...]
+# arguments:  <command>
+#                 Name of the command to check.
+# return:     0
+#                 All requested commands are available.
+#             >0
+#                 Number of requested commands that were not found.
+#             -1
+#                 No argument given.
+#
+function checkCommands {
+  local status=0
+
+  # return if no argument was specified
+  if [ $# -eq 0 ]; then
+    return -1
+  fi
+
+  # check all specified commands
+  while [ $# -gt 0 ]; do
+    command -v $1 &>/dev/null
+    if [ $? -ne 0 ]; then
+      printWarning "Command '$1' not available.\n"
+      status=$((status + 1))
+    fi
+    shift 1
+  done
+
+  return $status
+}
+
 ################################################################################
 # SPECIFIC FUNCTIONS                                                           #
 ################################################################################
@@ -418,6 +452,8 @@ function detectModules {
 #                 The specified <module> could not be found.
 #             -3
 #                 Parsing the project for the specified module failed.
+#             -4
+#                 Missing dependencies.
 #
 function createModuleProject {
   local userdir=$(pwd)
@@ -430,6 +466,13 @@ function createModuleProject {
   local outvar=""
   local gccoutvar=""
 
+  # check dependencies
+  checkCommands make
+  if [ $? -ne 0 ]; then
+    printError "Missing dependencies detected.\n"
+    return -4
+  fi
+
   # parse arguments
   local otherargs=()
   while [ $# -gt 0 ]; do
diff --git a/tools/ide/idesetup.sh b/tools/ide/idesetup.sh
index a6bbefb..bfb77db 100755
--- a/tools/ide/idesetup.sh
+++ b/tools/ide/idesetup.sh
@@ -263,6 +263,40 @@ function setLogFile {
   return 0
 }
 
+### check whether commands are available #######################################
+# Checks whether the specified commands are available and can be executed.
+#
+# usage:      checkCommand [<command> <command> ...]
+# arguments:  <command>
+#                 Name of the command to check.
+# return:     0
+#                 All requested commands are available.
+#             >0
+#                 Number of requested commands that were not found.
+#             -1
+#                 No argument given.
+#
+function checkCommands {
+  local status=0
+
+  # return if no argument was specified
+  if [ $# -eq 0 ]; then
+    return -1
+  fi
+
+  # check all specified commands
+  while [ $# -gt 0 ]; do
+    command -v $1 &>/dev/null
+    if [ $? -ne 0 ]; then
+      printWarning "Command '$1' not available.\n"
+      status=$((status + 1))
+    fi
+    shift 1
+  done
+
+  return $status
+}
+
 ################################################################################
 # SPECIFIC FUNCTIONS                                                           #
 ################################################################################
