Skip to content

Commit

Permalink
Merge commit 'e9e2e72ff034fa42d44037a7e762ba97e18af541'
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed May 23, 2024
2 parents 748965d + e9e2e72 commit e22e3e5
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions neurodesk/transparent-singularity/run_transparent_singularity.sh
Original file line number Diff line number Diff line change
Expand Up @@ -243,11 +243,18 @@ while read executable; do \
# --silent is required to suppress bind mound warnings (e.g. for /etc/localtime)
# --cleanenv is required to prevent environment variables on the host to affect the containers (e.g. Julia and R packages), but to work
# correctly with GUIs, the DISPLAY variable needs to be set as well. This only works in singularity >= 3.6.0
# --bind is needed to handle non-default temp directories (Github issue #11)
for customtmp in TMP TMPDIR TEMP TEMPDIR; do
eval tmpvar=\$$customtmp
if [[ -n $tmpvar ]]; then
bindtmpdir="--bind \$$customtmp:/tmp"
fi
done
if printf '%s\n' "$required_version" "$singularity_version" | sort -V | head -n1 | grep -q "$required_version"; then
echo "singularity --silent exec --cleanenv --env DISPLAY=\$DISPLAY \$neurodesk_singularity_opts --pwd \"\$PWD\" $_base/$container $executable \"\$@\"" >> $executable
echo "singularity --silent exec --cleanenv --env DISPLAY=\$DISPLAY $bindtmpdir \$neurodesk_singularity_opts --pwd \"\$PWD\" $_base/$container $executable \"\$@\"" >> $executable
else
echo "Singularity version is older than $required_version. GUIs will not work correctly!"
echo "singularity --silent exec --cleanenv \$neurodesk_singularity_opts --pwd \"\$PWD\" $_base/$container $executable \"\$@\"" >> $executable
echo "singularity --silent exec --cleanenv $bindtmpdir \$neurodesk_singularity_opts --pwd \"\$PWD\" $_base/$container $executable \"\$@\"" >> $executable
fi

chmod a+x $executable
Expand Down

0 comments on commit e22e3e5

Please sign in to comment.