diff --git a/lazyDir/centos7.Dockerfile b/lazyDir/centos7.Dockerfile index 0f3d453..edfaba8 100644 --- a/lazyDir/centos7.Dockerfile +++ b/lazyDir/centos7.Dockerfile @@ -52,6 +52,26 @@ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && \ echo $TZ > /etc/timezone +############################### +# Enable Software Collections # +############################### + +# Add repos, keys and tools +RUN yum -q clean expire-cache && \ + yum -q makecache && \ + yum -y install --setopt=tsflags=nodocs \ + centos-release-scl \ + scl-utils-build \ + && \ + rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo && \ + yum -q -y clean all --enablerepo='*' + +# Enable SCLs for any later bash session +COPY scl_enable.sh /usr/local/bin/scl_enable +ENV BASH_ENV="/usr/local/bin/scl_enable" \ + ENV="/usr/local/bin/scl_enable" \ + PROMPT_COMMAND=". /usr/local/bin/scl_enable" + ################################## # Application level requirements # ################################## diff --git a/lazyDir/scl_enable.sh b/lazyDir/scl_enable.sh new file mode 100755 index 0000000..fe24391 --- /dev/null +++ b/lazyDir/scl_enable.sh @@ -0,0 +1,24 @@ +# Make sure home bin directory is in PATH +if ! [[ "${PATH}" =~ "${HOME}/bin" ]]; then + export PATH="${HOME}/bin:${PATH}" +fi + +# Store current debug flag status +WAS_TRACE=0 +if [[ ${SHELLOPTS} =~ xtrace ]]; then + WAS_TRACE=1 +fi + +# Activate all Software Collections - if any +test -x /usr/bin/scl || { echo "ERROR: scl util not available"; exit 1; } +OIFS=$IFS +IFS=$'\n' +SCLS=($(scl --list)) +if [ ${#SCLS[@]} -ne 0 ]; then + test $WAS_TRACE -eq 0 || set +x + source scl_source enable "${SCLS[@]}" + test $WAS_TRACE -eq 0 || set -x +fi +IFS=$OIFS + +unset BASH_ENV PROMPT_COMMAND ENV