Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:31:47

0001 #!/bin/bash
0002 
0003 # Check if apptainer (or singularity) is available and that unprivileged user namespace is enabled (needed for nested containers)
0004 # It is needed for unit tests in modules HeterogeneousCore/SonicTriton and RecoEcal/EgammaClusterProducers
0005 # It avoids TritonService fallback server error
0006 
0007 if type apptainer >& /dev/null; then
0008         echo "has apptainer"
0009         CONTAINER_CONFIG="/etc/apptainer/apptainer.conf"
0010 else
0011         echo "missing apptainer, checking for singularity..."
0012         if type singularity >& /dev/null; then
0013                 echo "has singularity"
0014                 CONTAINER_CONFIG="/etc/singularity/singularity.conf"
0015         else
0016                 echo "missing singularity also" && exit 1
0017         fi
0018 fi
0019 
0020 if [ -n "$SINGULARITY_CONTAINER" ]; then
0021         if grep -q "^allow setuid = no" $CONTAINER_CONFIG && unshare -U echo >/dev/null 2>&1; then
0022                 echo "has unprivileged user namespace support"
0023         else
0024                 echo "missing unprivileged user namespace support" && exit 1
0025         fi
0026 fi