From bd251246c7b3b5268e635241f8b8adc23c905c66 Mon Sep 17 00:00:00 2001
From: Easy Build <easybuild@login2.head.smc.salomon.it4i.cz>
Date: Wed, 6 Feb 2019 13:41:00 +0100
Subject: [PATCH] fix

---
 eb | 40 ++++++++++++++++++++--------------------
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/eb b/eb
index fb97f09..c0ffcdc 100755
--- a/eb
+++ b/eb
@@ -4,7 +4,7 @@
 DIRNAME="/home/easybuild/EasyBuild-wrappers"
 SCRIPTS_DIR="$DIRNAME/scripts"
 
-LMOD=$(echo $LMOD_VERSION)
+LMOD=$(echo "$LMOD_VERSION")
 if [ -z "$LMOD" ]; then
    echo "LMOD version not defined"
    exit 1
@@ -25,61 +25,61 @@ if [ -z "$EB" ]; then
    exit 1
 fi
 
-NAME=$(echo $CLUSTERNAME)
+NAME=$(echo "$CLUSTERNAME")
 if [ -z "$NAME" ]; then
    echo "CLUSTERNAME not defined"
    exit 1
 fi
 
-if [[ ! -z `echo $@ | grep "\-\-rm-module"` ]]; then
-   MODULE=$(echo $@ | sed "s|\-\-rm-module||")
-   $SCRIPTS_DIR/rm-module.sh $MODULE
+if [[ ! -z `echo "$@" | grep "\-\-rm-module"` ]]; then
+   MODULE=$(echo "$@" | sed "s|\-\-rm-module||")
+   "$SCRIPTS_DIR/rm-module.sh" "$MODULE"
    exit 0
 fi
 
 if [[ ! -z `echo $@ | grep "\-\-find-dependency"` ]]; then
    MODULE=$(echo $@ | sed "s|\-\-find-dependency||")
-   $SCRIPTS_DIR/find-dependency.sh $MODULE
+   "$SCRIPTS_DIR/find-dependency.sh" "$MODULE"
    exit 0
 fi
 
 if [[ ! -z `echo $@ | grep "\-\-cache"` ]] && [[ ! $NAME == "UV2000" ]]; then
    echo "== Update lmod system cache files"
-   $LMOD_DIR/update_lmod_system_cache_files $MODULEPATH
+   "$LMOD_DIR/update_lmod_system_cache_files" "$MODULEPATH"
    exit 0
 fi
 
 if [[ ! -z `echo $@ | grep "install-latest-eb-release"` ]]; then
-   $DIRNAME/eb.exe --install-latest-eb-release && $SCRIPTS_DIR/post_install.s
+   eb.exe --install-latest-eb-release && "$SCRIPTS_DIR/post_install.sh"
    exit 0
 fi
 
 if [[ ! -z `echo $@ | grep "containerize"` ]]; then
-   ml Singularity/$SING
+   ml Singularity/"$SING"
    echo "== Load Singularity/$SING"
 fi
 
 mm_message="##### $NAME ($EB) - $WHO ... BUILD
 eb $@"
 
-DRYRUN=$(echo $@ | grep "\-D")
-HELP=$(echo $@ | grep "\-h")
-SEARCH=$(echo $@ | grep "\-S")
+DRYRUN=$(echo "$@" | grep "\-D")
+HELP=$(echo "$@" | grep "\-h")
+SEARCH=$(echo "$@" | grep "\-S")
 
-if [ "$WHO" == 'easybuild' ] && [[ -z $DRYRUN ]] && [[ -z $SEARCH ]]; then
+if [ "$WHO" == 'easybuild' ] && [[ -z "$DRYRUN" ]] && [[ -z "$SEARCH" ]]; then
 	curl -s -i -X POST -d 'payload={"text": "'"$mm_message"'"}' http://mm.it4i.cz/hooks/mxskhwmjxjyq8ghgyuyfo6wwqw > /dev/null
 elif [[ -z $DRYRUN ]]; then
         curl -s -i -X POST -d 'payload={"text": "'"$mm_message"'"}' http://mm.it4i.cz/hooks/7h511fiphpfedx9pkqfhx1h59h > /dev/null
 fi
 
-eb.exe $@
+eb.exe "$@"
 
 RESULT=$?
 
 date=`date +"%m-%d-%y %T"`
 res="false"
 
-if [ $RESULT -eq 0 ]; then
+if [ "$RESULT" -eq 0 ]; then
    mm_message="##### $NAME - $WHO ... SUCCESS
 eb $@"
    res="true"
@@ -89,18 +89,18 @@ eb $@"
    res="false"
 fi
 
-if [ "$WHO" == 'easybuild' ] && [[ -z $DRYRUN ]]; then
+if [ "$WHO" == 'easybuild' ] && [[ -z "$DRYRUN" ]]; then
    curl -s -i -X POST -d 'payload={"text": "'"$mm_message"'"}' http://mm.it4i.cz/hooks/mxskhwmjxjyq8ghgyuyfo6wwqw > /dev/null
-   if [ ! $res == "false" ] && [[ -z $HELP ]] && [[ ! $NAME == "UV2000" ]] && [[ -z $SEARCH ]]; then
+   if [ ! "$res" == "false" ] && [[ -z "$HELP" ]] && [[ ! "$NAME" == "UV2000" ]] && [[ -z "$SEARCH" ]]; then
       echo "== Update lmod system cache files"
-      $LMOD_DIR/update_lmod_system_cache_files $MODULEPATH
+      "$LMOD_DIR/update_lmod_system_cache_files" "$MODULEPATH"
    fi
-elif [[ -z $DRYRUN ]]; then
+elif [[ -z "$DRYRUN" ]]; then
    curl -s -i -X POST -d 'payload={"text": "'"$mm_message"'"}' http://mm.it4i.cz/hooks/7h511fiphpfedx9pkqfhx1h59h > /dev/null
 fi
 
 SINGULARITY=$(ml -t 2>&1 | grep Singularity)
-if [ ! $SINGULARITY == "" ]; then
+if [ ! "$SINGULARITY" == "" ]; then
    ml -Singularity
    echo "== Unload Singularity"
 fi
-- 
GitLab