Skip to content
Snippets Groups Projects
Commit 2297cfba authored by Sylvester Joosten's avatar Sylvester Joosten
Browse files

Improved environment setup

parent 771af559
No related branches found
No related tags found
No related merge requests found
This commit is part of merge request !81. Comments created here will be created in the context of that merge request.
...@@ -131,6 +131,7 @@ RUN cd /opt/spack-environment \ ...@@ -131,6 +131,7 @@ RUN cd /opt/spack-environment \
&& echo "Grabbing environment info" \ && echo "Grabbing environment info" \
&& spack env activate --sh -d . \ && spack env activate --sh -d . \
| sed "s?LD_LIBRARY_PATH=?&/lib/x86_64-linux-gnu:?" \ | sed "s?LD_LIBRARY_PATH=?&/lib/x86_64-linux-gnu:?" \
| sed '/MANPATH/ s/;$/:;/' \
> /etc/profile.d/z10_spack_environment.sh \ > /etc/profile.d/z10_spack_environment.sh \
&& cd /opt/spack-environment \ && cd /opt/spack-environment \
&& echo -n "" \ && echo -n "" \
...@@ -140,17 +141,7 @@ RUN cd /opt/spack-environment \ ...@@ -140,17 +141,7 @@ RUN cd /opt/spack-environment \
| grep software \ | grep software \
| awk '{print $2}'` \ | awk '{print $2}'` \
&& echo "export PODIO=${PODIO};" \ && echo "export PODIO=${PODIO};" \
>> /etc/profile.d/z11_jug_env.sh \ >> /etc/profile.d/z10_spack_environment.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 \
&& cd /opt/spack-environment && spack env activate . \ && cd /opt/spack-environment && spack env activate . \
&& echo -n "" \ && echo -n "" \
&& echo "Installing additional python packages" \ && echo "Installing additional python packages" \
...@@ -163,6 +154,7 @@ RUN cd /opt/spack-environment \ ...@@ -163,6 +154,7 @@ RUN cd /opt/spack-environment \
&& echo "Executing cmake patch for dd4hep 16.1" \ && echo "Executing cmake patch for dd4hep 16.1" \
&& sed -i "s/FIND_PACKAGE(Python/#&/" /usr/local/cmake/DD4hepBuild.cmake && sed -i "s/FIND_PACKAGE(Python/#&/" /usr/local/cmake/DD4hepBuild.cmake
## make sure we have the entrypoints setup correctly ## make sure we have the entrypoints setup correctly
ENTRYPOINT [] ENTRYPOINT []
CMD ["bash", "--rcfile", "/etc/profile", "-l"] CMD ["bash", "--rcfile", "/etc/profile", "-l"]
...@@ -193,16 +185,18 @@ RUN find -L /usr/local/* \ ...@@ -193,16 +185,18 @@ RUN find -L /usr/local/* \
## and links therin for more info ## and links therin for more info
RUN strip --remove-section=.note.ABI-tag /usr/local/lib/libQt5Core.so 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 \ RUN spack debug report \
| sed "s/^/ - /" | sed "s/\* \*\*//" | sed "s/\*\*//" \ | sed "s/^/ - /" | sed "s/\* \*\*//" | sed "s/\*\*//" \
>> /etc/jug_info \ >> /etc/jug_info \
&& spack find --no-groups --long --variants | 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 \ COPY eic-shell /usr/local/bin/eic-shell
&& chmod +x /usr/local/bin/eic-info 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 ## STAGE 3
...@@ -219,13 +213,10 @@ RUN --mount=from=staging,target=/staging \ ...@@ -219,13 +213,10 @@ RUN --mount=from=staging,target=/staging \
rm -rf /usr/local \ rm -rf /usr/local \
&& cp -r /staging/opt/software /opt/software \ && cp -r /staging/opt/software /opt/software \
&& cp -r /staging/usr/local /usr/local \ && cp -r /staging/usr/local /usr/local \
&& cp /staging/etc/profile.d/z11_jug_env.sh \ && cp /staging/etc/profile.d/*.sh /etc/profile.d/ \
/etc/profile.d/z11_jug_env.sh \ && cp /staging/etc/eic-env.sh /etc/eic-env.sh \
&& cat /staging/etc/profile.d/z10_spack_environment.sh \ && cp /staging/etc/jug_info /etc/jug_info \
| sed '/MANPATH/ s/;$/:;/' \ && cp -r /staging/.singularity.d /.singularity.d
> /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
ARG JUG_VERSION=1 ARG JUG_VERSION=1
RUN echo "" >> /etc/jug_info \ RUN echo "" >> /etc/jug_info \
......
#!/bin/bash
for i in /etc/profile.d/*.sh; do
source $i
done
#!/bin/bash
cat /etc/jug_info
#!/usr/bin/env bash #!/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=() piped_args=()
if [ -p /dev/stdin ]; then if [ -p /dev/stdin ]; then
# If we want to read the input line by line # If we want to read the input line by line
...@@ -26,12 +8,15 @@ if [ -p /dev/stdin ]; then ...@@ -26,12 +8,15 @@ if [ -p /dev/stdin ]; then
done done
fi fi
## Properly setup environment
source /etc/eic-env.sh
### Fire off bash ### Fire off bash
if [ "${#piped_args[@]}" != "0" ]; then if [ "${#piped_args[@]}" != "0" ]; then
echo "${#piped_args[@]}" printf "%s\n" "${piped_args[@]}" | bash -s -- --norc --noprofile
printf "%s\n" "${piped_args[@]}" | bash -s -- --norc
elif [ $# -gt 0 ]; then elif [ $# -gt 0 ]; then
exec bash --norc -c "$@" exec bash -c "$@"
else else
exec bash --norc exec bash --norc --noprofile
fi fi
#!/usr/bin/env bash #!/usr/bin/env bash
source /etc/profile
## Force environment to be clean ## Force environment to be clean
source /etc/eic-env.sh source /etc/eic-env.sh
......
#!/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
#!/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
#!/bin/bash
source /etc/eic-env.sh
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment