Commit cafbb94c authored by Kennedy, Joseph H's avatar Kennedy, Joseph H
Browse files

Fix rhea setup script to not cause a logout

Problem was because `set -eu` was sourced in the git-lfs install script,
but conda's activate and deactivate scripts don't play will with
`set -eu`. Instead, this script is called in a bash subshell.

Also, some cleanup of the bash script.

Fixes #12
parent bc16b94c
#!/usr/bin/env bash
set -eu
if [ -d "$HOME/.local/bin" ]; then
case ":$PATH:" in
*:$HOME/\.local/bin:*)
if [ -d "${HOME}/.local/bin" ]; then
case ":${PATH}:" in
*:${HOME}/\.local/bin:*)
# echo 'on path'
;;
*)
echo '$HOME/.local/bin not found in $PATH. Adding it to $PATH'
export PATH=$PATH:$HOME/.local/bin
export PATH=${PATH}:${HOME}/.local/bin
;;
esac
fi
if [ -d "$HOME/.modulefiles" ]; then
case ":$MODULEPATH:" in
*:$HOME/\.modulefiles:*)
if [ -d "${HOME}/.modulefiles" ]; then
case ":${MODULEPATH}:" in
*:${HOME}/\.modulefiles:*)
# echo 'on path'
;;
*)
echo '$HOME/.modulefiles not found in $MODULEPATH. Adding it to $MODULEPATH'
export MODULEPATH=$HOME/.modulefiles:$MODULEPATH
export MODULEPATH=${HOME}/.modulefiles:${MODULEPATH}
;;
esac
fi
......@@ -29,22 +30,26 @@ if [ ! -x "$(command -v git-lfs)" ]; then
echo 'git-lfs not installed! Installing... into $HOME/.local/bin'
echo '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'
mkdir -p $HOME/.local/lib
pushd $HOME/.local/lib
mkdir -p "${HOME}/.local/lib"
pushd "${HOME}/.local/lib" > /dev/null
wget https://github.com/git-lfs/git-lfs/releases/download/v2.3.4/git-lfs-linux-amd64-2.3.4.tar.gz
tar -zxf git-lfs-linux-amd64-2.3.4.tar.gz
cd git-lfs-2.3.4
sed -i 's/\/usr\/local/\$HOME\/.local/g' install.sh
. install.sh
sed -i 's/\/usr\/local/\${HOME}\/.local/g' install.sh
bash install.sh
popd
popd > /dev/null
echo 'In the future, be sure to include $HOME/.local/bin in your path:'
echo ' export PATH=$PATH:$HOME/.local/bin'
echo ' export PATH=${PATH}:${HOME}/.local/bin'
echo 'Note: You will likely want to put this in your .bashrc, or similar.'
fi
#NOTE: conda deactivate and activate scripts don't play well with set -eu. For more details, see
# https://github.com/conda/conda/issues/3200
set +eu
if [[ $(hostname -s) = rhea* ]]; then
module unload PE-pgi PE-gnu PE-intel
module load PE-gnu/4.8.2
......@@ -59,6 +64,3 @@ if [[ $(hostname -s) = rhea* ]]; then
. deactivate && . activate LIVVpy2
fi
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment