Commit 489bc324 authored by Min RK's avatar Min RK

warn about unused config

if some env vars are set that aren't used,
complain about it so behaviour is a bit less surprising
parent 9e6b4a53
...@@ -27,7 +27,7 @@ if [ $(id -u) == 0 ] ; then ...@@ -27,7 +27,7 @@ if [ $(id -u) == 0 ] ; then
fi fi
# Enable sudo if requested # Enable sudo if requested
if [ ! -z "$GRANT_SUDO" ]; then if [ "$GRANT_SUDO" == "1" ]; then
echo "$NB_USER ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/notebook echo "$NB_USER ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/notebook
fi fi
...@@ -35,6 +35,15 @@ if [ $(id -u) == 0 ] ; then ...@@ -35,6 +35,15 @@ if [ $(id -u) == 0 ] ; then
echo "Execute the command as $NB_USER" echo "Execute the command as $NB_USER"
exec su $NB_USER -c "env PATH=$PATH $*" exec su $NB_USER -c "env PATH=$PATH $*"
else else
if [[ ! -z "$NB_UID" && "$NB_UID" != "$(id -u)" ]]; then
echo 'Container must be run as root to set $NB_UID'
fi
if [[ ! -z "$NB_GID" && "$NB_GID" != "$(id -g)" ]]; then
echo 'Container must be run as root to set $NB_GID'
fi
if [[ "$GRANT_SUDO" == "1" ]]; then
echo 'Container must be run as root to grant sudo permissions'
fi
# Exec the command # Exec the command
echo "Execute the command" echo "Execute the command"
exec $* exec $*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment