diff --git a/containers/jug/Dockerfile.dev b/containers/jug/Dockerfile.dev index 15083ce7bd5e456dd2956e0a1b1d979efc84d032..a56e3d9409d6fd071d6b3ff6ab1bc3f5c47dbf51 100644 --- a/containers/jug/Dockerfile.dev +++ b/containers/jug/Dockerfile.dev @@ -131,6 +131,7 @@ RUN cd /opt/spack-environment \ && echo "Grabbing environment info" \ && spack env activate --sh -d . \ | sed "s?LD_LIBRARY_PATH=?&/lib/x86_64-linux-gnu:?" \ + | sed '/MANPATH/ s/;$/:;/' \ > /etc/profile.d/z10_spack_environment.sh \ && cd /opt/spack-environment \ && echo -n "" \ @@ -140,17 +141,7 @@ RUN cd /opt/spack-environment \ | grep software \ | awk '{print $2}'` \ && echo "export PODIO=${PODIO};" \ - >> /etc/profile.d/z11_jug_env.sh \ - && echo "export BINARY_TAG=x86_64-linux-gcc9-opt" \ - >> /etc/profile.d/z11_jug_env.sh \ - && echo "if [ ! -z \${ATHENA_PREFIX} ]; then" \ - >> /etc/profile.d/z11_jug_env.sh \ - && echo "export LD_LIBRARY_PATH=\$ATHENA_PREFIX/lib:\$LD_LIBRARY_PATH" \ - >> /etc/profile.d/z11_jug_env.sh \ - && echo "export PATH=\$ATHENA_PREFIX/bin:\$PATH" \ - >> /etc/profile.d/z11_jug_env.sh \ - && echo "fi" \ - >> /etc/profile.d/z11_jug_env.sh \ + >> /etc/profile.d/z10_spack_environment.sh \ && cd /opt/spack-environment && spack env activate . \ && echo -n "" \ && echo "Installing additional python packages" \ @@ -163,6 +154,7 @@ RUN cd /opt/spack-environment \ && echo "Executing cmake patch for dd4hep 16.1" \ && sed -i "s/FIND_PACKAGE(Python/#&/" /usr/local/cmake/DD4hepBuild.cmake + ## make sure we have the entrypoints setup correctly ENTRYPOINT [] CMD ["bash", "--rcfile", "/etc/profile", "-l"] @@ -193,16 +185,18 @@ RUN find -L /usr/local/* \ ## and links therin for more info RUN strip --remove-section=.note.ABI-tag /usr/local/lib/libQt5Core.so -COPY eic-shell /usr/local/bin/eic-shell -COPY entrypoint.sh /usr/local/sbin/entrypoint.sh - RUN spack debug report \ | sed "s/^/ - /" | sed "s/\* \*\*//" | sed "s/\*\*//" \ >> /etc/jug_info \ - && spack find --no-groups --long --variants | sed "s/^/ - /" >> /etc/jug_info \ - && echo "#!/bin/bash" > /usr/local/bin/eic-info \ - && echo "cat /etc/jug_info" >> /usr/local/bin/eic-info \ - && chmod +x /usr/local/bin/eic-info + && spack find --no-groups --long --variants | sed "s/^/ - /" >> /etc/jug_info + +COPY eic-shell /usr/local/bin/eic-shell +COPY eic-info /usr/local/bin/eic-info +COPY entrypoint.sh /usr/local/sbin/entrypoint.sh +COPY eic-env.sh /etc/eic-env.sh +COPY profile.d/a00_setup.sh /etc/profile.d +COPY profile.d/z11_jug_env.sh /etc/profile.d +COPY singularity.d /.singularity.d ## ======================================================================================== ## STAGE 3 @@ -219,13 +213,10 @@ RUN --mount=from=staging,target=/staging \ rm -rf /usr/local \ && cp -r /staging/opt/software /opt/software \ && cp -r /staging/usr/local /usr/local \ - && cp /staging/etc/profile.d/z11_jug_env.sh \ - /etc/profile.d/z11_jug_env.sh \ - && cat /staging/etc/profile.d/z10_spack_environment.sh \ - | sed '/MANPATH/ s/;$/:;/' \ - > /etc/profile.d/z10_spack_env.sh \ - && cat /etc/profile.d/z1*.sh > /etc/eic-env.sh \ - && cp /staging/etc/jug_info /etc/jug_info + && cp /staging/etc/profile.d/*.sh /etc/profile.d/ \ + && cp /staging/etc/eic-env.sh /etc/eic-env.sh \ + && cp /staging/etc/jug_info /etc/jug_info \ + && cp -r /staging/.singularity.d /.singularity.d ARG JUG_VERSION=1 RUN echo "" >> /etc/jug_info \ diff --git a/containers/jug/eic-env.sh b/containers/jug/eic-env.sh new file mode 100755 index 0000000000000000000000000000000000000000..c540db1db5a945dcfad7e9309c8c7509b2d803d8 --- /dev/null +++ b/containers/jug/eic-env.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +for i in /etc/profile.d/*.sh; do + source $i +done diff --git a/containers/jug/eic-info b/containers/jug/eic-info new file mode 100755 index 0000000000000000000000000000000000000000..135bb4e6d8593bab4dc22a0eaf13e84065318c46 --- /dev/null +++ b/containers/jug/eic-info @@ -0,0 +1,3 @@ +#!/bin/bash + +cat /etc/jug_info diff --git a/containers/jug/eic-shell b/containers/jug/eic-shell index 40f1dfe0260a7f8fc2143e99a2f7b079eec8e169..1a4a7612a300cb7faef6da88e8e41ea75a8274e4 100755 --- a/containers/jug/eic-shell +++ b/containers/jug/eic-shell @@ -1,23 +1,5 @@ #!/usr/bin/env bash -## Force environment to be clean -export LD_LIBRARY_PATH="/lib/x86_64-linux-gnu:/usr/local/lib64:/usr/local/lib" -export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin -[ ! -z "$CC" ] && unset CC -[ ! -z "$CXX" ] && unset CXX -[ ! -z "$JUPYTER_CONFIG_DIR" ] && unset JUPYTER_CONFIG_DIR -[ ! -z "$JUPYTER_PATH" ] && unset JUPYTER_PATH -[ ! -z "$CLING_STANDARD_PCH" ] && unset CLING_STANDARD_PCH -[ ! -z "$USER_PATH" ] && unset USER_PATH -[ ! -z "$SHLIB_PATH ] && unset SHLIB_PATH -[ ! -z "$LIBPATH ] && unset $LIBPATH -[ ! -z "$CMAKE_PREFIX_PATH" ] && unset CMAKE_PREFIX_PATH -[ ! -z "$SOFTWARE_HOME" ] && unset SOFTWARE_HOME -[ ! -z "$ROOTSYS" ] && unset ROOTSYS - -## Properly setup environment -source /etc/eic-env.sh - piped_args=() if [ -p /dev/stdin ]; then # If we want to read the input line by line @@ -26,12 +8,15 @@ if [ -p /dev/stdin ]; then done fi +## Properly setup environment +source /etc/eic-env.sh + + ### Fire off bash if [ "${#piped_args[@]}" != "0" ]; then - echo "${#piped_args[@]}" - printf "%s\n" "${piped_args[@]}" | bash -s -- --norc + printf "%s\n" "${piped_args[@]}" | bash -s -- --norc --noprofile elif [ $# -gt 0 ]; then - exec bash --norc -c "$@" + exec bash -c "$@" else - exec bash --norc + exec bash --norc --noprofile fi diff --git a/containers/jug/entrypoint.sh b/containers/jug/entrypoint.sh index 589ff3c92e83867c9a4f2c4f6407c5ac671ba3fb..a69c40d97a514040c4e0eeadb697e0e2c36b3360 100755 --- a/containers/jug/entrypoint.sh +++ b/containers/jug/entrypoint.sh @@ -1,6 +1,5 @@ #!/usr/bin/env bash -source /etc/profile ## Force environment to be clean source /etc/eic-env.sh diff --git a/containers/jug/profile.d/a00_setup.sh b/containers/jug/profile.d/a00_setup.sh new file mode 100755 index 0000000000000000000000000000000000000000..b53b07492e6c9b239ea70d208312045869219450 --- /dev/null +++ b/containers/jug/profile.d/a00_setup.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +## Force environment to be clean +export LD_LIBRARY_PATH="/lib/x86_64-linux-gnu:/usr/local/lib64:/usr/local/lib" +export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +[ ! -z "$CC" ] && unset CC +[ ! -z "$CXX" ] && unset CXX +[ ! -z "$JUPYTER_CONFIG_DIR" ] && unset JUPYTER_CONFIG_DIR +[ ! -z "$JUPYTER_PATH" ] && unset JUPYTER_PATH +[ ! -z "$CLING_STANDARD_PCH" ] && unset CLING_STANDARD_PCH +[ ! -z "$USER_PATH" ] && unset USER_PATH +[ ! -z "$SHLIB_PATH" ] && unset SHLIB_PATH +[ ! -z "$LIBPATH" ] && unset $LIBPATH +[ ! -z "$CMAKE_PREFIX_PATH" ] && unset CMAKE_PREFIX_PATH +[ ! -z "$SOFTWARE_HOME" ] && unset SOFTWARE_HOME +[ ! -z "$ROOTSYS" ] && unset ROOTSYS + +export PS1='eic-shell> +\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' +export LS_COLORS='rs=0:di=01;34:ln=01;36:mh=00:pi=40;33' +export GREP_OPTIONS='--color=auto' + +function ls { + /bin/ls --color=auto + } +function less { + /usr/bin/less -RAW_CONTROL_CHARS + } +export -f ls +export -f less diff --git a/containers/jug/profile.d/z11_jug_env.sh b/containers/jug/profile.d/z11_jug_env.sh new file mode 100755 index 0000000000000000000000000000000000000000..0e2c23b7b0fb58c04a88415e24572634d2dabe1f --- /dev/null +++ b/containers/jug/profile.d/z11_jug_env.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +export BINARY_TAG=x86_64-linux-gcc9-opt +if [ ! -z ${ATHENA_PREFIX} ]; then + if [ "$LD_LIBRARY_PATH" != *"${ATHENA_PREFIX}/lib"* ]; then + export LD_LIBRARY_PATH=$ATHENA_PREFIX/lib:$LD_LIBRARY_PATH + export PATH=$ATHENA_PREFIX/bin:$PATH + fi +fi diff --git a/containers/jug/singularity.d/env/99-zz_jug_env.sh b/containers/jug/singularity.d/env/99-zz_jug_env.sh new file mode 100755 index 0000000000000000000000000000000000000000..d3d3d3749dff29be19b2b91b87ee45f9676ae1d4 --- /dev/null +++ b/containers/jug/singularity.d/env/99-zz_jug_env.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +source /etc/eic-env.sh