From d3f24bfd93d1861788dbe65f62ca51649f19c248 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 11 Jan 2023 14:45:02 -0600 Subject: [PATCH 1/4] feat: support apptainer (in particular avoid warnings) --- install.sh | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/install.sh b/install.sh index 8131a00..12496b2 100755 --- a/install.sh +++ b/install.sh @@ -39,6 +39,7 @@ while [ $# -gt 0 ]; do ;; -t|--tmpdir) export TMPDIR=$2 + export APPTAINER_TMPDIR=$2 export SINGULARITY_TMPDIR=$2 shift shift @@ -85,14 +86,22 @@ mkdir -p $PREFIX/local/lib || exit 1 function install_singularity() { SINGULARITY= - ## check for a singularity install - ## default singularity if new enough - if [ $(type -P singularity ) ]; then - SINGULARITY=$(which singularity) + ## check for an apptainer install + ## default to apptainer if found + if [ $(type -P apptainer ) ]; then + SINGULARITY=$(which apptainer) SINGULARITY_VERSION=`$SINGULARITY --version` - if [ ${SINGULARITY_VERSION:0:1} = 2 ]; then - ## too old, look for something else - SINGULARITY= + fi + if [ -z $SINGULARITY ]; then + ## check for a singularity install + ## default to singularity if new enough + if [ $(type -P singularity ) ]; then + SINGULARITY=$(which singularity) + SINGULARITY_VERSION=`$SINGULARITY --version` + if [ ${SINGULARITY_VERSION:0:1} = 2 ]; then + ## too old, look for something else + SINGULARITY= + fi fi fi if [ -z $SINGULARITY ]; then @@ -102,16 +111,18 @@ function install_singularity() { ## whatever is in the path is next elif [ $(type -P singularity ) ]; then SINGULARITY=$(which singularity) + ## cvmfs apptainer is last resort (sandbox mode can cause issues) + elif [ -f "/cvmfs/oasis.opensciencegrid.org/mis/apptainer/bin/apptainer" ]; then ## cvmfs singularity is last resort (sandbox mode can cause issues) elif [ -f "/cvmfs/oasis.opensciencegrid.org/mis/singularity/bin/singularity" ]; then SINGULARITY="/cvmfs/oasis.opensciencegrid.org/mis/singularity/bin/singularity" ## not good... else - echo "ERROR: no singularity found, please make sure you have singularity in your \$PATH" + echo "ERROR: no apptainer or singularity found, please make sure you have apptainer or singularity in your \$PATH" exit 1 fi fi - echo " - Found singularity at $SINGULARITY" + echo " - Found apptainer/singularity at $SINGULARITY" ## get singularity version ## we only care if is 2.x or not, so we can use singularity --version @@ -182,7 +193,7 @@ function install_singularity() { ## is always bound. We also check for the existence of a few standard ## locations (/scratch /volatile /cache) and bind those too if found echo " - Determining additional bind paths" - BINDPATH=${SINGULARITY_BINDPATH} + BINDPATH=${SINGULARITY_BINDPATH}${APPTAINER_BINDPATH:+,${APPTAINER_BINDPATH}} echo " --> system bindpath: $BINDPATH" PREFIX_ROOT="/$(realpath $PREFIX | cut -d "/" -f2)" for dir in /w /work /scratch /volatile /cache /gpfs /gpfs01 /gpfs02 $PREFIX_ROOT; do @@ -197,7 +208,7 @@ function install_singularity() { done ## create a new top-level eic-shell launcher script - ## that sets the EIC_SHELL_PREFIX and then starts singularity + ## that sets the EIC_SHELL_PREFIX and then starts apptainer/singularity cat << EOF > eic-shell #!/bin/bash @@ -219,7 +230,7 @@ function print_the_help { echo " -v,--version Version to install (D: \$VERSION) (requires cvmfs)" echo " -h,--help Print this message" echo "" - echo " Start the eic-shell containerized software environment (Singularity version)." + echo " Start the eic-shell containerized software environment (Apptainer/Singularity version)." echo "" echo "EXAMPLES: " echo " - Start an interactive shell: ./eic-shell" @@ -298,6 +309,7 @@ if [ ! -z \${UPGRADE} ]; then fi export EIC_SHELL_PREFIX=$PREFIX/local +export APPTAINER_BINDPATH=$BINDPATH export SINGULARITY_BINDPATH=$BINDPATH \${SINGULARITY:-$SINGULARITY} exec \${SINGULARITY_OPTIONS:-} \${SIF:-$SIF} eic-shell \$@ EOF @@ -344,7 +356,7 @@ function install_docker() { fi ## create a new top-level eic-shell launcher script - ## that sets the EIC_SHELL_PREFIX and then starts singularity + ## that sets the EIC_SHELL_PREFIX and then starts apptainer/singularity cat << EOF > eic-shell #!/bin/bash From b5454af104b27e2b8b4d35b7af1a309f60ee32d6 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 12 Nov 2025 19:16:53 -0600 Subject: [PATCH 2/4] Use $() instead of backticks Co-authored-by: Dmitry Kalinkin --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 12496b2..6feac6c 100755 --- a/install.sh +++ b/install.sh @@ -97,7 +97,7 @@ function install_singularity() { ## default to singularity if new enough if [ $(type -P singularity ) ]; then SINGULARITY=$(which singularity) - SINGULARITY_VERSION=`$SINGULARITY --version` + SINGULARITY_VERSION=$($SINGULARITY --version) if [ ${SINGULARITY_VERSION:0:1} = 2 ]; then ## too old, look for something else SINGULARITY= From 6c2871d329dcc6bc53c8130607a2f3218e39c74b Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sun, 18 Jan 2026 17:35:35 -0600 Subject: [PATCH 3/4] fix: combine SINGULARITY/APPTAINER_BINDPATH, deduplicate (ignored order is fine) --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 6feac6c..dd0d758 100755 --- a/install.sh +++ b/install.sh @@ -193,7 +193,7 @@ function install_singularity() { ## is always bound. We also check for the existence of a few standard ## locations (/scratch /volatile /cache) and bind those too if found echo " - Determining additional bind paths" - BINDPATH=${SINGULARITY_BINDPATH}${APPTAINER_BINDPATH:+,${APPTAINER_BINDPATH}} + BINDPATH=$(echo ${SINGULARITY_BINDPATH},${APPTAINER_BINDPATH} | tr ',' '\n' | sort -u | tr '\n' ',' | sed 's/,$//') echo " --> system bindpath: $BINDPATH" PREFIX_ROOT="/$(realpath $PREFIX | cut -d "/" -f2)" for dir in /w /work /scratch /volatile /cache /gpfs /gpfs01 /gpfs02 $PREFIX_ROOT; do From e875bf6c23fbf6a55389163c23628c04a65d8870 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sun, 18 Jan 2026 17:56:07 -0600 Subject: [PATCH 4/4] Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- install.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/install.sh b/install.sh index dd0d758..22a8466 100755 --- a/install.sh +++ b/install.sh @@ -92,7 +92,7 @@ function install_singularity() { SINGULARITY=$(which apptainer) SINGULARITY_VERSION=`$SINGULARITY --version` fi - if [ -z $SINGULARITY ]; then + if [ -z "$SINGULARITY" ]; then ## check for a singularity install ## default to singularity if new enough if [ $(type -P singularity ) ]; then @@ -104,7 +104,7 @@ function install_singularity() { fi fi fi - if [ -z $SINGULARITY ]; then + if [ -z "$SINGULARITY" ]; then ## first priority: a known good install (this one is on JLAB) if [ -d "/apps/singularity/3.7.1/bin/" ]; then SINGULARITY="/apps/singularity/3.7.1/bin/singularity" @@ -113,6 +113,7 @@ function install_singularity() { SINGULARITY=$(which singularity) ## cvmfs apptainer is last resort (sandbox mode can cause issues) elif [ -f "/cvmfs/oasis.opensciencegrid.org/mis/apptainer/bin/apptainer" ]; then + SINGULARITY="/cvmfs/oasis.opensciencegrid.org/mis/apptainer/bin/apptainer" ## cvmfs singularity is last resort (sandbox mode can cause issues) elif [ -f "/cvmfs/oasis.opensciencegrid.org/mis/singularity/bin/singularity" ]; then SINGULARITY="/cvmfs/oasis.opensciencegrid.org/mis/singularity/bin/singularity" @@ -356,7 +357,7 @@ function install_docker() { fi ## create a new top-level eic-shell launcher script - ## that sets the EIC_SHELL_PREFIX and then starts apptainer/singularity + ## that sets the EIC_SHELL_PREFIX and then starts docker cat << EOF > eic-shell #!/bin/bash