Files
docker-stacks/base-notebook/start.sh
Peter Parente 1480d6f88e Add generic start.sh to base-notebook
* Update doc in base-notebook to describe use case
* Rebase start-notebook.sh on it
2016-08-09 16:10:22 -04:00

26 lines
642 B
Bash
Executable File

#!/bin/bash
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
set -e
# Handle special flags if we're root
if [ $UID == 0 ] ; then
# Change UID of NB_USER to NB_UID if it does not match
if [ "$NB_UID" != $(id -u $NB_USER) ] ; then
usermod -u $NB_UID $NB_USER
chown -R $NB_UID $CONDA_DIR .
fi
# Enable sudo if requested
if [ ! -z "$GRANT_SUDO" ]; then
echo "$NB_USER ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/notebook
fi
# Exec the command as NB_USER
exec su $NB_USER -c "env PATH=$PATH $*"
else
# Exec the command
exec $*
fi