From c12a205ab8e195541acfe0cb654b4888e16ea05c Mon Sep 17 00:00:00 2001 From: Josh Spicer Date: Fri, 3 Jun 2022 10:46:25 -0400 Subject: Pass options via environment variables (#39) * up to docker-in-docker converted * first pass at the rest of the features (and bash linting and updated CLI * move shell linter to own file * rename feature.json -> devcontainer-feature.json * continue on error * continue on error in right spot * formatting * fix AZ_VERSION * update python * restore variable name * update linter actions, fix dind/dfd/desktop scripts, add test-scenaerios * add tree because I like tree * glob for shell linter * fix test-scenarios * shell linter * more shell helper --- src/jupyterlab/devcontainer-feature.json | 33 ++++++++++++++++++++++++++++++++ src/jupyterlab/feature.json | 27 -------------------------- src/jupyterlab/install.sh | 13 ++++++------- 3 files changed, 39 insertions(+), 34 deletions(-) create mode 100644 src/jupyterlab/devcontainer-feature.json delete mode 100644 src/jupyterlab/feature.json (limited to 'src/jupyterlab') diff --git a/src/jupyterlab/devcontainer-feature.json b/src/jupyterlab/devcontainer-feature.json new file mode 100644 index 0000000..8546925 --- /dev/null +++ b/src/jupyterlab/devcontainer-feature.json @@ -0,0 +1,33 @@ +{ + "id": "jupyterlab", + "name": "Jupyter Lab", + "options": { + "version": { + "type": "string", + "proposals": [ + "latest", + "3.6.2" + ], + "default": "latest", + "description": "Select or enter a jupyterlab version." + }, + "python_binary": { + "type": "string", + "proposals": [ + "python", + "/usr/local/python/bin/python" + ], + "default": "python", + "description": "Select or enter the python binary path." + } + }, + "extensions": [ + "ms-python.python", + "ms-python.vscode-pylance", + "ms-toolsai.jupyter" + ], + "install": { + "app": "", + "file": "install.sh" + } +} \ No newline at end of file diff --git a/src/jupyterlab/feature.json b/src/jupyterlab/feature.json deleted file mode 100644 index 86010c3..0000000 --- a/src/jupyterlab/feature.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "id": "jupyterlab", - "name": "Jupyter Lab", - "options": { - "version": { - "type": "string", - "proposals": ["latest", "3.6.2"], - "default": "latest", - "description": "Select or enter a jupyterlab version." - }, - "pythonBinary": { - "type": "string", - "proposals": ["python", "/usr/local/python/bin/python"], - "default": "python", - "description": "Select or enter the python binary path." - } - }, - "extensions": [ - "ms-python.python", - "ms-python.vscode-pylance", - "ms-toolsai.jupyter" - ], - "install": { - "app": "", - "file": "install.sh" - } -} \ No newline at end of file diff --git a/src/jupyterlab/install.sh b/src/jupyterlab/install.sh index 4d426a4..f6c30d3 100644 --- a/src/jupyterlab/install.sh +++ b/src/jupyterlab/install.sh @@ -6,15 +6,14 @@ # # Docs: https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/docs/jupyterlab.md # Maintainer: The VS Code and Codespaces Teams -# -# Syntax: ./jupyter-debian.sh set -ex -VERSION=${1:-"latest"} -USERNAME=${2:-"automatic"} -PYTHON=${3:-"python"} -ALLOW_ALL_ORIGINS=${4:-""} +VERSION=${VERSION:-"latest"} +PYTHON=${PYTHON_BINARY:-"python"} + +USERNAME=${USERNAME:-"automatic"} +ALLOW_ALL_ORIGINS=${ALLOW_ALL_ORIGINS:-""} if [ "$(id -u)" -ne 0 ]; then echo -e 'Script must be run as root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.' @@ -25,7 +24,7 @@ fi if [ "${USERNAME}" = "auto" ] || [ "${USERNAME}" = "automatic" ]; then USERNAME="" POSSIBLE_USERS=("vscode" "node" "codespace" "$(awk -v val=1000 -F ":" '$3==val{print $1}' /etc/passwd)") - for CURRENT_USER in ${POSSIBLE_USERS[@]}; do + for CURRENT_USER in "${POSSIBLE_USERS[@]}"; do if id -u ${CURRENT_USER} > /dev/null 2>&1; then USERNAME=${CURRENT_USER} break -- cgit v1.2.3