mirror of
https://github.com/jupyter/docker-stacks.git
synced 2025-10-08 10:34:06 +00:00
Fix all shellcheck warnings
This commit is contained in:
@@ -13,8 +13,10 @@ if [[ -n "${JUPYTERHUB_API_TOKEN}" ]]; then
|
|||||||
# launched by JupyterHub, use single-user entrypoint
|
# launched by JupyterHub, use single-user entrypoint
|
||||||
exec /usr/local/bin/start-singleuser.sh "$@"
|
exec /usr/local/bin/start-singleuser.sh "$@"
|
||||||
elif [[ -n "${JUPYTER_ENABLE_LAB}" ]]; then
|
elif [[ -n "${JUPYTER_ENABLE_LAB}" ]]; then
|
||||||
|
# shellcheck disable=SC1091
|
||||||
. /usr/local/bin/start.sh $wrapper jupyter lab "$@"
|
. /usr/local/bin/start.sh $wrapper jupyter lab "$@"
|
||||||
else
|
else
|
||||||
echo "WARN: Jupyter Notebook deprecation notice https://github.com/jupyter/docker-stacks#jupyter-notebook-deprecation-notice."
|
echo "WARN: Jupyter Notebook deprecation notice https://github.com/jupyter/docker-stacks#jupyter-notebook-deprecation-notice."
|
||||||
|
# shellcheck disable=SC1091
|
||||||
. /usr/local/bin/start.sh $wrapper jupyter notebook "$@"
|
. /usr/local/bin/start.sh $wrapper jupyter notebook "$@"
|
||||||
fi
|
fi
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
# set default ip to 0.0.0.0
|
# set default ip to 0.0.0.0
|
||||||
if [[ "$NOTEBOOK_ARGS $@" != *"--ip="* ]]; then
|
if [[ "$NOTEBOOK_ARGS $*" != *"--ip="* ]]; then
|
||||||
NOTEBOOK_ARGS="--ip=0.0.0.0 $NOTEBOOK_ARGS"
|
NOTEBOOK_ARGS="--ip=0.0.0.0 $NOTEBOOK_ARGS"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -14,6 +14,7 @@ fi
|
|||||||
# These won't be passed from DockerSpawner 0.9,
|
# These won't be passed from DockerSpawner 0.9,
|
||||||
# so avoid specifying --arg=empty-string
|
# so avoid specifying --arg=empty-string
|
||||||
if [ -n "$NOTEBOOK_DIR" ]; then
|
if [ -n "$NOTEBOOK_DIR" ]; then
|
||||||
|
# shellcheck disable=SC2089
|
||||||
NOTEBOOK_ARGS="--notebook-dir='$NOTEBOOK_DIR' $NOTEBOOK_ARGS"
|
NOTEBOOK_ARGS="--notebook-dir='$NOTEBOOK_DIR' $NOTEBOOK_ARGS"
|
||||||
fi
|
fi
|
||||||
if [ -n "$JPY_PORT" ]; then
|
if [ -n "$JPY_PORT" ]; then
|
||||||
@@ -36,4 +37,5 @@ if [ -n "$JPY_HUB_API_URL" ]; then
|
|||||||
fi
|
fi
|
||||||
NOTEBOOK_BIN="jupyterhub-singleuser"
|
NOTEBOOK_BIN="jupyterhub-singleuser"
|
||||||
|
|
||||||
|
# shellcheck disable=SC1091,SC2086,SC2090
|
||||||
. /usr/local/bin/start.sh "$NOTEBOOK_BIN" $NOTEBOOK_ARGS "$@"
|
. /usr/local/bin/start.sh "$NOTEBOOK_BIN" $NOTEBOOK_ARGS "$@"
|
||||||
|
@@ -21,6 +21,7 @@ run-hooks () {
|
|||||||
case "$f" in
|
case "$f" in
|
||||||
*.sh)
|
*.sh)
|
||||||
echo "$0: running $f"
|
echo "$0: running $f"
|
||||||
|
# shellcheck disable=SC1090
|
||||||
source "$f"
|
source "$f"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
@@ -98,7 +99,7 @@ if [ "$(id -u)" == 0 ] ; then
|
|||||||
# Exec the command as NB_USER with the PATH and the rest of
|
# Exec the command as NB_USER with the PATH and the rest of
|
||||||
# the environment preserved
|
# the environment preserved
|
||||||
run-hooks /usr/local/bin/before-notebook.d
|
run-hooks /usr/local/bin/before-notebook.d
|
||||||
echo "Executing the command: ${cmd[@]}"
|
echo "Executing the command: " "${cmd[@]}"
|
||||||
exec sudo -E -H -u "$NB_USER" PATH="$PATH" XDG_CACHE_HOME="/home/$NB_USER/.cache" PYTHONPATH="${PYTHONPATH:-}" "${cmd[@]}"
|
exec sudo -E -H -u "$NB_USER" PATH="$PATH" XDG_CACHE_HOME="/home/$NB_USER/.cache" PYTHONPATH="${PYTHONPATH:-}" "${cmd[@]}"
|
||||||
else
|
else
|
||||||
if [[ "$NB_UID" == "$(id -u jovyan 2>/dev/null)" && "$NB_GID" == "$(id -g jovyan 2>/dev/null)" ]]; then
|
if [[ "$NB_UID" == "$(id -u jovyan 2>/dev/null)" && "$NB_GID" == "$(id -g jovyan 2>/dev/null)" ]]; then
|
||||||
@@ -110,7 +111,7 @@ else
|
|||||||
if [[ "$STATUS" != "0" ]]; then
|
if [[ "$STATUS" != "0" ]]; then
|
||||||
if [[ -w /etc/passwd ]]; then
|
if [[ -w /etc/passwd ]]; then
|
||||||
echo "Adding passwd file entry for $(id -u)"
|
echo "Adding passwd file entry for $(id -u)"
|
||||||
cat /etc/passwd | sed -e "s/^jovyan:/nayvoj:/" > /tmp/passwd
|
sed -e "s/^jovyan:/nayvoj:/" /etc/passwd > /tmp/passwd
|
||||||
echo "jovyan:x:$(id -u):$(id -g):,,,:/home/jovyan:/bin/bash" >> /tmp/passwd
|
echo "jovyan:x:$(id -u):$(id -g):,,,:/home/jovyan:/bin/bash" >> /tmp/passwd
|
||||||
cat /tmp/passwd > /etc/passwd
|
cat /tmp/passwd > /etc/passwd
|
||||||
rm /tmp/passwd
|
rm /tmp/passwd
|
||||||
@@ -127,10 +128,10 @@ else
|
|||||||
# Warn if looks like user want to override uid/gid but hasn't
|
# Warn if looks like user want to override uid/gid but hasn't
|
||||||
# run the container as root.
|
# run the container as root.
|
||||||
if [[ -n "$NB_UID" && "$NB_UID" != "$(id -u)" ]]; then
|
if [[ -n "$NB_UID" && "$NB_UID" != "$(id -u)" ]]; then
|
||||||
echo 'Container must be run as root to set $NB_UID'
|
echo "Container must be run as root to set NB_UID to $NB_UID"
|
||||||
fi
|
fi
|
||||||
if [[ -n "$NB_GID" && "$NB_GID" != "$(id -g)" ]]; then
|
if [[ -n "$NB_GID" && "$NB_GID" != "$(id -g)" ]]; then
|
||||||
echo 'Container must be run as root to set $NB_GID'
|
echo "Container must be run as root to set NB_GID to $NB_GID"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -142,6 +143,6 @@ else
|
|||||||
|
|
||||||
# Execute the command
|
# Execute the command
|
||||||
run-hooks /usr/local/bin/before-notebook.d
|
run-hooks /usr/local/bin/before-notebook.d
|
||||||
echo "Executing the command: ${cmd[@]}"
|
echo "Executing the command: " "${cmd[@]}"
|
||||||
exec "${cmd[@]}"
|
exec "${cmd[@]}"
|
||||||
fi
|
fi
|
||||||
|
@@ -18,10 +18,10 @@ set -e
|
|||||||
|
|
||||||
# letsencrypt certificate server type (default is production).
|
# letsencrypt certificate server type (default is production).
|
||||||
# Set `CERT_SERVER=--staging` for staging.
|
# Set `CERT_SERVER=--staging` for staging.
|
||||||
: ${CERT_SERVER=''}
|
: "${CERT_SERVER=''}"
|
||||||
|
|
||||||
# Create Docker volume to contain the cert
|
# Create Docker volume to contain the cert
|
||||||
: ${SECRETS_VOLUME:=my-notebook-secrets}
|
: "${SECRETS_VOLUME:=my-notebook-secrets}"
|
||||||
docker volume create --name $SECRETS_VOLUME 1>/dev/null
|
docker volume create --name $SECRETS_VOLUME 1>/dev/null
|
||||||
# Generate the cert and save it to the Docker volume
|
# Generate the cert and save it to the Docker volume
|
||||||
docker run --rm -it \
|
docker run --rm -it \
|
||||||
|
@@ -3,9 +3,9 @@
|
|||||||
# Distributed under the terms of the Modified BSD License.
|
# Distributed under the terms of the Modified BSD License.
|
||||||
|
|
||||||
# Set reasonable default VM settings
|
# Set reasonable default VM settings
|
||||||
: ${VIRTUALBOX_CPUS:=4}
|
: "${VIRTUALBOX_CPUS:=4}"
|
||||||
export VIRTUALBOX_CPUS
|
export VIRTUALBOX_CPUS
|
||||||
: ${VIRTUALBOX_MEMORY_SIZE:=4096}
|
: "${VIRTUALBOX_MEMORY_SIZE:=4096}"
|
||||||
export VIRTUALBOX_MEMORY_SIZE
|
export VIRTUALBOX_MEMORY_SIZE
|
||||||
|
|
||||||
docker-machine create --driver virtualbox "$@"
|
docker-machine create --driver virtualbox "$@"
|
||||||
|
@@ -5,6 +5,7 @@
|
|||||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
# Setup environment
|
# Setup environment
|
||||||
|
# shellcheck disable=SC1091
|
||||||
source "$DIR/env.sh"
|
source "$DIR/env.sh"
|
||||||
|
|
||||||
# Build the notebook image
|
# Build the notebook image
|
||||||
|
@@ -5,6 +5,7 @@
|
|||||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
# Setup environment
|
# Setup environment
|
||||||
|
# shellcheck disable=SC1091
|
||||||
source "$DIR/env.sh"
|
source "$DIR/env.sh"
|
||||||
|
|
||||||
# Bring down the notebook container, using container name as project name
|
# Bring down the notebook container, using container name as project name
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
export NAME
|
export NAME
|
||||||
|
|
||||||
# Exposed container port
|
# Exposed container port
|
||||||
: ${PORT:=80}
|
: "${PORT:=80}"
|
||||||
export PORT
|
export PORT
|
||||||
|
|
||||||
# Container work volume name
|
# Container work volume name
|
||||||
|
@@ -58,6 +58,7 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Setup environment
|
# Setup environment
|
||||||
|
# shellcheck disable=SC1091
|
||||||
source "$DIR/env.sh"
|
source "$DIR/env.sh"
|
||||||
|
|
||||||
# Create a Docker volume to store notebooks
|
# Create a Docker volume to store notebooks
|
||||||
|
Reference in New Issue
Block a user