From 828e137fdf150054e9d605b6b4dcbbbeb9b94e36 Mon Sep 17 00:00:00 2001
From: Miguel Prada <miguel.prada@tecnalia.com>
Date: Fri, 17 May 2019 13:01:53 +0200
Subject: [PATCH] Relax some shellcheck tests and fix remaining issues

---
 deploy/base/ros_entrypoint.bash     |  1 +
 scripts/ci_run_entry_points.sh      |  4 ++--
 scripts/roslaunch_test_generator.sh | 15 ++++++++-------
 3 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/deploy/base/ros_entrypoint.bash b/deploy/base/ros_entrypoint.bash
index 01fe41c..0f3ec1f 100755
--- a/deploy/base/ros_entrypoint.bash
+++ b/deploy/base/ros_entrypoint.bash
@@ -2,5 +2,6 @@
 set -e
 
 # setup application environment
+# shellcheck disable=SC1091
 source "/root/catkin_ws/install/setup.bash"
 exec "$@"
diff --git a/scripts/ci_run_entry_points.sh b/scripts/ci_run_entry_points.sh
index b262dd9..87b25d4 100755
--- a/scripts/ci_run_entry_points.sh
+++ b/scripts/ci_run_entry_points.sh
@@ -1,7 +1,7 @@
 #!/bin/bash
 
-echo Looking up and executing user entry scripts in: $1
+echo Looking up and executing user entry scripts in: "$1"
 
-find -L $1 -name ci_entry_script.bash -exec bash -c 'echo Running entry script from $(basename $(dirname {})) ; {} ' \;
+find -L "$1" -name ci_entry_script.bash -exec bash -c 'echo Running entry script from $(basename $(dirname $1)) ; $1 ' _ {} \;
 
 echo Finalized running the user entry scripts
diff --git a/scripts/roslaunch_test_generator.sh b/scripts/roslaunch_test_generator.sh
index 8d8f8f1..f620745 100644
--- a/scripts/roslaunch_test_generator.sh
+++ b/scripts/roslaunch_test_generator.sh
@@ -1,14 +1,15 @@
 #!/usr/bin/env bash
 
-for foo in $(find $(pwd) -name "package.xml") ; do
-  package_name=$(basename $(realpath $(dirname $foo)))
-  echo Entering package: $package_name
-  cd $(realpath $(dirname $foo))
-  if [[ -n $(grep -i "roslaunch_add_file_check" CMakeLists.txt) ]] ; then
-    echo Package $package_name already has roslaunch_add_file_check - skipping
+# shellcheck disable=SC2044
+for foo in $(find "$(pwd)" -name "package.xml") ; do
+  package_name=$(basename "$(realpath "$(dirname "$foo")")")
+  echo Entering package: "$package_name"
+  cd "$(realpath "$(dirname "$foo")")" || exit
+  if grep -q -i "roslaunch_add_file_check" CMakeLists.txt; then
+    echo Package "$package_name" already has roslaunch_add_file_check - skipping
   else
     if [[ -n $(find . -type f -name "*.launch") ]] ; then
-      echo Adding roslaunch_add_file_check to $package_name
+      echo Adding roslaunch_add_file_check to "$package_name"
 cat <<EOT >> CMakeLists.txt
 
 ## WARNING: automatically generated code; can be (and probably is) very buggy
-- 
GitLab