From 5883fe335e281b2ef5ee030847d80d82e8b445eb Mon Sep 17 00:00:00 2001
From: Sylvester Joosten <sjoosten@anl.gov>
Date: Tue, 15 Jun 2021 22:52:27 +0000
Subject: [PATCH] fix sh compatibility of singularity launcher

---
 containers/jug/eic-env.sh                         | 10 +++++-----
 containers/jug/eic-shell                          |  2 +-
 containers/jug/entrypoint.sh                      |  2 +-
 containers/jug/singularity.d/env/99-zz_jug_env.sh |  2 +-
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/containers/jug/eic-env.sh b/containers/jug/eic-env.sh
index 2475ddca1..f320442cb 100755
--- a/containers/jug/eic-env.sh
+++ b/containers/jug/eic-env.sh
@@ -1,7 +1,7 @@
 #!/bin/bash
 
 for i in /etc/profile.d/*.sh; do
-  source $i
+  . $i
 done
 
 export PS1='eic-shell> \[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
@@ -10,13 +10,13 @@ export LS_COLORS='rs=0:di=01;34:ln=01;36:mh=00:pi=40;33'
 ## redefine ls and less as functions, as this is something we
 ## can import into our plain bash --norc --noprofile session
 ## (aliases cannot be transferred to a child shell)
-function ls {
+ls () {
   /bin/ls --color=auto $@
 }
-function less {
+less () {
   /usr/bin/less -R $@
 }
-function grep {
+grep () {
   /bin/grep --color=auto $@
 }
 MYSHELL=$(ps -p $$ | awk '{print($4);}' | tail -n1)
@@ -24,7 +24,7 @@ MYSHELL=$(ps -p $$ | awk '{print($4);}' | tail -n1)
 ## in all shells and we only care about bash here. Note that
 ## the singularity startup runs in plain sh which requires the
 ## if statement
-if [ "$MYSHELL" == "bash" ]; then
+if [ "$MYSHELL" = "bash" ]; then
   export -f ls
   export -f less
   export -f grep
diff --git a/containers/jug/eic-shell b/containers/jug/eic-shell
index 1a4a7612a..e31800377 100755
--- a/containers/jug/eic-shell
+++ b/containers/jug/eic-shell
@@ -9,7 +9,7 @@ if [ -p /dev/stdin ]; then
 fi
 
 ## Properly setup environment
-source /etc/eic-env.sh
+. /etc/eic-env.sh
 
 
 ### Fire off bash
diff --git a/containers/jug/entrypoint.sh b/containers/jug/entrypoint.sh
index a69c40d97..79465dce1 100755
--- a/containers/jug/entrypoint.sh
+++ b/containers/jug/entrypoint.sh
@@ -1,6 +1,6 @@
 #!/usr/bin/env bash
 
 ## Force environment to be clean
-source /etc/eic-env.sh
+. /etc/eic-env.sh
 
 exec "$@"
diff --git a/containers/jug/singularity.d/env/99-zz_jug_env.sh b/containers/jug/singularity.d/env/99-zz_jug_env.sh
index d3d3d3749..ab161b0b5 100755
--- a/containers/jug/singularity.d/env/99-zz_jug_env.sh
+++ b/containers/jug/singularity.d/env/99-zz_jug_env.sh
@@ -1,3 +1,3 @@
 #!/bin/bash
 
-source /etc/eic-env.sh
+. /etc/eic-env.sh
-- 
GitLab