start.sh: refactor for readability

This commit is contained in:
Erik Sundell
2020-03-29 04:54:48 +02:00
committed by Ben Mares
parent 22c3516abd
commit cd5e45b573

View File

@@ -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