forked from devcontainers/features
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall_jupyterlab_existing_sudoers_file.sh
More file actions
executable file
·36 lines (24 loc) · 1.15 KB
/
Copy pathinstall_jupyterlab_existing_sudoers_file.sh
File metadata and controls
executable file
·36 lines (24 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
set -e
# Optional: Import test library
source dev-container-features-test-lib
# Always run these checks as the non-root user
user="$(whoami)"
check "user" grep vscode <<< "$user"
# Check for an installation of JupyterLab
check "version" jupyter lab --version
# Check location of JupyterLab installation
packages="$(python3 -m pip list)"
check "location" grep jupyter <<< "$packages"
# Check for git extension
check "jupyterlab_git" grep jupyterlab_git <<< "$packages"
# Check for correct JupyterLab configuration
check "config" grep ".*.allow_origin = '*'" /home/vscode/.jupyter/jupyter_server_config.py
# Check for PATH modification
check "default path has jupyterlab" grep "Defaults secure_path=/home/${user}/.local/bin" /etc/sudoers.d/$user
# Check if previous PATH exists
check "existing default path is preserved" grep "Defaults secure_path=.*original_content_of_sudoers_file" /etc/sudoers.d/$user
# Check if PATH modification includes original and new paths
check "existing path included with jupyterlab" grep "Defaults secure_path.*/home/${user}/.local/bin.*original_content_of_sudoers_file" /etc/sudoers.d/$user
# Report result
reportResults