Fix all shellcheck warnings

This commit is contained in:
Ayaz Salikhov
2021-05-21 15:49:49 +03:00
parent 3734d39090
commit c0ae562059
9 changed files with 19 additions and 11 deletions

View File

@@ -13,8 +13,10 @@ if [[ -n "${JUPYTERHUB_API_TOKEN}" ]]; then
# launched by JupyterHub, use single-user entrypoint
exec /usr/local/bin/start-singleuser.sh "$@"
elif [[ -n "${JUPYTER_ENABLE_LAB}" ]]; then
# shellcheck disable=SC1091
. /usr/local/bin/start.sh $wrapper jupyter lab "$@"
else
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 "$@"
fi

View File

@@ -5,7 +5,7 @@
set -e
# 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"
fi
@@ -14,6 +14,7 @@ fi
# These won't be passed from DockerSpawner 0.9,
# so avoid specifying --arg=empty-string
if [ -n "$NOTEBOOK_DIR" ]; then
# shellcheck disable=SC2089
NOTEBOOK_ARGS="--notebook-dir='$NOTEBOOK_DIR' $NOTEBOOK_ARGS"
fi
if [ -n "$JPY_PORT" ]; then
@@ -36,4 +37,5 @@ if [ -n "$JPY_HUB_API_URL" ]; then
fi
NOTEBOOK_BIN="jupyterhub-singleuser"
# shellcheck disable=SC1091,SC2086,SC2090
. /usr/local/bin/start.sh "$NOTEBOOK_BIN" $NOTEBOOK_ARGS "$@"

View File

@@ -21,6 +21,7 @@ run-hooks () {
case "$f" in
*.sh)
echo "$0: running $f"
# shellcheck disable=SC1090
source "$f"
;;
*)
@@ -98,7 +99,7 @@ if [ "$(id -u)" == 0 ] ; then
# Exec the command as NB_USER with the PATH and the rest of
# the environment preserved
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[@]}"
else
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 [[ -w /etc/passwd ]]; then
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
cat /tmp/passwd > /etc/passwd
rm /tmp/passwd
@@ -127,10 +128,10 @@ else
# Warn if looks like user want to override uid/gid but hasn't
# run the container as root.
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
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
@@ -142,6 +143,6 @@ else
# Execute the command
run-hooks /usr/local/bin/before-notebook.d
echo "Executing the command: ${cmd[@]}"
echo "Executing the command: " "${cmd[@]}"
exec "${cmd[@]}"
fi

View File

@@ -18,10 +18,10 @@ set -e
# letsencrypt certificate server type (default is production).
# Set `CERT_SERVER=--staging` for staging.
: ${CERT_SERVER=''}
: "${CERT_SERVER=''}"
# 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
# Generate the cert and save it to the Docker volume
docker run --rm -it \

View File

@@ -3,9 +3,9 @@
# Distributed under the terms of the Modified BSD License.
# Set reasonable default VM settings
: ${VIRTUALBOX_CPUS:=4}
: "${VIRTUALBOX_CPUS:=4}"
export VIRTUALBOX_CPUS
: ${VIRTUALBOX_MEMORY_SIZE:=4096}
: "${VIRTUALBOX_MEMORY_SIZE:=4096}"
export VIRTUALBOX_MEMORY_SIZE
docker-machine create --driver virtualbox "$@"

View File

@@ -5,6 +5,7 @@
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# Setup environment
# shellcheck disable=SC1091
source "$DIR/env.sh"
# Build the notebook image

View File

@@ -5,6 +5,7 @@
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# Setup environment
# shellcheck disable=SC1091
source "$DIR/env.sh"
# Bring down the notebook container, using container name as project name

View File

@@ -10,7 +10,7 @@
export NAME
# Exposed container port
: ${PORT:=80}
: "${PORT:=80}"
export PORT
# Container work volume name

View File

@@ -58,6 +58,7 @@ else
fi
# Setup environment
# shellcheck disable=SC1091
source "$DIR/env.sh"
# Create a Docker volume to store notebooks