From cd5e45b5735de7e316f7ea15c70ce8b103545fd2 Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Sun, 29 Mar 2020 04:54:48 +0200 Subject: [PATCH] start.sh: refactor for readability --- base-notebook/start.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/base-notebook/start.sh b/base-notebook/start.sh index cbf474e7..052c9fb2 100755 --- a/base-notebook/start.sh +++ b/base-notebook/start.sh @@ -93,9 +93,14 @@ if [ "$(id -u)" == 0 ] ; then # home directory as a fallback if they don't have one mounted already. if [[ "${NB_USER}" != "jovyan" ]]; then if [[ ! -e "/home/${NB_USER}" ]]; then - echo "Copying home dir to /home/${NB_USER}" + echo "Attempting to copy /home/jovyan to /home/${NB_USER}..." mkdir "/home/${NB_USER}" - cp -a /home/jovyan/. "/home/${NB_USER}/" || ln -s /home/jovyan "/home/${NB_USER}" + if cp -a /home/jovyan/. "/home/${NB_USER}/"; then + echo "Done" + else + echo "Failed. Attempting to symlink /home/jovyan to /home/${NB_USER}..." + ln -s /home/jovyan "/home/${NB_USER}" && echo "Done" + fi fi # Ensure the current working directory is updated if [[ "${PWD}/" == "/home/jovyan/"* ]]; then