diff options
Diffstat (limited to 'share/spack/docker/entrypoint.bash')
-rwxr-xr-x | share/spack/docker/entrypoint.bash | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/share/spack/docker/entrypoint.bash b/share/spack/docker/entrypoint.bash new file mode 100755 index 0000000000..58d6281084 --- /dev/null +++ b/share/spack/docker/entrypoint.bash @@ -0,0 +1,43 @@ +#! /usr/bin/env bash -e +# +# Copyright 2013-2018 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +if [ "$1" '=' 'docker-shell' ] ; then + if [ -t 0 ] ; then + exec bash -il + else + ( + echo -n "It looks like you're trying to run an intractive shell" + echo -n " session, but either no psuedo-TTY is allocateed for this" + echo -n " container's STDIN, or it is closed." + echo + + echo -n "Make sure you run docker with the --interactive and --tty" + echo -n " options." + echo + ) >&2 + + exit 1 + fi +else + exec 3>&1 + exec 4>&2 + + exec 1>&- + exec 2>&- + + source /etc/profile.d/spack.sh + source /etc/profile.d/handle-ssh.sh + + exec 1>&3 + exec 2>&4 + + exec 3>&- + exec 4>&- + + spack "$@" + exit $? +fi |