Commit 57fad264 authored by Sebastian Wahl's avatar Sebastian Wahl
Browse files

Update for a smoother experience when coming from a Mac. Added info on manual...

Update for a smoother experience when coming from a Mac. Added info on manual install if remote shell is not bash
parent 44287792
Loading
Loading
Loading
Loading
+29 −16
Original line number Diff line number Diff line
@@ -68,7 +68,7 @@ function install_conda_environment() {

	 cd $HOME
	 test -d miniconda3 && mv -v miniconda3 miniconda_$(date +%Y%m%d_%H%M%S)
	 if [[ "$(uname)" == "Darwin" ]] ; then
	 if [[ "`uname`" == "Darwin" ]] ; then
		 curl https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -o Miniconda3.sh
	 else
		 curl https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -o Miniconda3.sh
@@ -78,13 +78,9 @@ function install_conda_environment() {
    source ${HOME}/miniconda3/bin/activate base;
	 conda install jupyterlab nb_conda_kernels --yes

	 # OSX does not like /dev/stdin as it is used below
	 if [[ "$(uname)" == "Darwin" ]] ; then
		 source ~/miniconda3/bin/activate
	 # OSX client or host machines do not like /dev/stdin as it is used below
    # conda env create -f /dev/stdin;
    conda env create -f py3_std.yml
	 else
       conda env create -f /dev/stdin;
	 fi
}

if [[ $# -lt 2 ]]; then
@@ -160,16 +156,33 @@ elif [[ "$task" == "stop" ]]; then

elif [[ "$task" == "install" ]]; then

	if [[ "$(uname)" == "Darwin" ]] && ! [[ "$hname" == "localhost" ]]; then
		echo
		echo " Only local installations supported on Mac OSX."
		echo " Try $0 localhost install to perform a local installation."
		echo " Start your jupyter environment with $0 localhost start."
	# cool trick from https://stackoverflow.com/a/22107893 on how to execute local functions on a remote machine
	# However, OSX client machines do not like /dev/stdin as it has been previously used in the function 
	# install_conda_environment hence we copy py3_std.yml first (see also above)
	#cat py3_std.yml | ssh $hname "$(typeset -f install_conda_environment); install_conda_environment;"
	scp py3_std.yml $hname:
	ssh $hname "$(typeset -f install_conda_environment); install_conda_environment;"
   if [[ $? -ne 0 ]]; then	
		echo
		echo " Installation seems to have failed."
		echo " If the install command e.g. failed with 'else: endif nicht gefunden.' or similar"
		echo " then the remote host doesn't use bash as default shell. Try "
		echo
		echo " scp py3_std.yml $hname:"
		echo " ssh $hname"
		echo " curl https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -o Miniconda3.sh"
		echo ' bash Miniconda3.sh -b -p ${HOME}/miniconda3'
		echo ' source ${HOME}/miniconda3/bin/activate base'
		echo ' conda install jupyterlab nb_conda_kernels --yes'
		echo " conda env create -f py3_std.yml " 
		echo  
		echo " to perform a manual installation." 
		echo
		exit 1
	else
		echo " Installation of py3_std conda environment on $hname sucessfull. No start remote jupyter"
		echo " manager with "
		echo " $0 $hname start"
   fi
	# cool trick from https://stackoverflow.com/a/22107893 on how to execute local functions on a remote machine
	cat py3_std.yml | ssh $hname "$(typeset -f install_conda_environment); install_conda_environment;"

elif [[ "$task" == "update" ]]; then
	echo