Files
docker-stacks/base-notebook/start.sh
Stanislav Khotinok 00591d836e Removed empty spaces
2017-05-18 16:29:51 +02:00

31 lines
801 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
# Change GID of NB_USER to NB_GID if NB_GID is passed as a parameter
if [ "$NB_GID" ] ; then
groupmod -g $NB_GID -o $(id -g -n $NB_USER)
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