From 9949e1468b3ba50494e8ac7d7058d8a6489462d1 Mon Sep 17 00:00:00 2001 From: Paul Taylor <178183+trxcllnt@users.noreply.github.com> Date: Wed, 12 Jul 2023 08:17:15 -0700 Subject: [PATCH] remove /etc/profile.d/00-restore-env.sh (#94) --- features/common/install.sh | 5 ----- features/src/cmake/common/install.sh | 5 ----- features/src/cmake/devcontainer-feature.json | 2 +- features/src/cuda/common/install.sh | 5 ----- features/src/cuda/devcontainer-feature.json | 2 +- features/src/gcc/common/install.sh | 5 ----- features/src/gcc/devcontainer-feature.json | 2 +- features/src/gitlab-cli/common/install.sh | 5 ----- .../src/gitlab-cli/devcontainer-feature.json | 2 +- features/src/llvm/common/install.sh | 5 ----- features/src/llvm/devcontainer-feature.json | 2 +- features/src/mambaforge/.bashrc | 2 +- features/src/mambaforge/common/install.sh | 5 ----- .../src/mambaforge/devcontainer-feature.json | 2 +- features/src/ninja/common/install.sh | 5 ----- features/src/ninja/devcontainer-feature.json | 2 +- features/src/nvhpc/common/install.sh | 5 ----- features/src/nvhpc/devcontainer-feature.json | 2 +- features/src/oneapi/common/install.sh | 5 ----- features/src/oneapi/devcontainer-feature.json | 2 +- features/src/python-lit/common/install.sh | 5 ----- .../src/python-lit/devcontainer-feature.json | 2 +- .../src/rapids-build-utils/common/install.sh | 5 ----- .../devcontainer-feature.json | 2 +- features/src/rust/common/install.sh | 5 ----- features/src/rust/devcontainer-feature.json | 2 +- features/src/sccache/common/install.sh | 5 ----- .../src/sccache/devcontainer-feature.json | 2 +- features/src/utils/common/install.sh | 5 ----- features/src/utils/devcontainer-feature.json | 2 +- features/src/utils/install.sh | 20 +++++++++++++++---- 31 files changed, 31 insertions(+), 94 deletions(-) diff --git a/features/common/install.sh b/features/common/install.sh index 1b955bbc..217d4548 100755 --- a/features/common/install.sh +++ b/features/common/install.sh @@ -26,11 +26,6 @@ export BASH_ENV=/etc/bash.bash_env; EOF )"; -# Ensure that login shells get the correct path if the user updated the PATH using ENV. -rm -f /etc/profile.d/00-restore-env.sh -echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh -chmod +x /etc/profile.d/00-restore-env.sh - if ! grep -qE '^BASH_ENV=/etc/bash.bash_env$' /etc/environment; then echo "BASH_ENV=/etc/bash.bash_env" >> /etc/environment; fi diff --git a/features/src/cmake/common/install.sh b/features/src/cmake/common/install.sh index 1b955bbc..217d4548 100755 --- a/features/src/cmake/common/install.sh +++ b/features/src/cmake/common/install.sh @@ -26,11 +26,6 @@ export BASH_ENV=/etc/bash.bash_env; EOF )"; -# Ensure that login shells get the correct path if the user updated the PATH using ENV. -rm -f /etc/profile.d/00-restore-env.sh -echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh -chmod +x /etc/profile.d/00-restore-env.sh - if ! grep -qE '^BASH_ENV=/etc/bash.bash_env$' /etc/environment; then echo "BASH_ENV=/etc/bash.bash_env" >> /etc/environment; fi diff --git a/features/src/cmake/devcontainer-feature.json b/features/src/cmake/devcontainer-feature.json index d1873271..1ce28c12 100644 --- a/features/src/cmake/devcontainer-feature.json +++ b/features/src/cmake/devcontainer-feature.json @@ -1,7 +1,7 @@ { "name": "CMake", "id": "cmake", - "version": "23.8.0", + "version": "23.8.1", "description": "A feature to install CMake", "options": { "version": { diff --git a/features/src/cuda/common/install.sh b/features/src/cuda/common/install.sh index 1b955bbc..217d4548 100755 --- a/features/src/cuda/common/install.sh +++ b/features/src/cuda/common/install.sh @@ -26,11 +26,6 @@ export BASH_ENV=/etc/bash.bash_env; EOF )"; -# Ensure that login shells get the correct path if the user updated the PATH using ENV. -rm -f /etc/profile.d/00-restore-env.sh -echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh -chmod +x /etc/profile.d/00-restore-env.sh - if ! grep -qE '^BASH_ENV=/etc/bash.bash_env$' /etc/environment; then echo "BASH_ENV=/etc/bash.bash_env" >> /etc/environment; fi diff --git a/features/src/cuda/devcontainer-feature.json b/features/src/cuda/devcontainer-feature.json index 0e17da40..9010bf05 100644 --- a/features/src/cuda/devcontainer-feature.json +++ b/features/src/cuda/devcontainer-feature.json @@ -1,7 +1,7 @@ { "name": "CUDA Toolkit", "id": "cuda", - "version": "23.8.0", + "version": "23.8.1", "description": "A feature to install the NVIDIA CUDA Toolkit", "options": { "version": { diff --git a/features/src/gcc/common/install.sh b/features/src/gcc/common/install.sh index 1b955bbc..217d4548 100755 --- a/features/src/gcc/common/install.sh +++ b/features/src/gcc/common/install.sh @@ -26,11 +26,6 @@ export BASH_ENV=/etc/bash.bash_env; EOF )"; -# Ensure that login shells get the correct path if the user updated the PATH using ENV. -rm -f /etc/profile.d/00-restore-env.sh -echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh -chmod +x /etc/profile.d/00-restore-env.sh - if ! grep -qE '^BASH_ENV=/etc/bash.bash_env$' /etc/environment; then echo "BASH_ENV=/etc/bash.bash_env" >> /etc/environment; fi diff --git a/features/src/gcc/devcontainer-feature.json b/features/src/gcc/devcontainer-feature.json index e7a7dd6a..8ccddac0 100644 --- a/features/src/gcc/devcontainer-feature.json +++ b/features/src/gcc/devcontainer-feature.json @@ -1,7 +1,7 @@ { "name": "GCC", "id": "gcc", - "version": "23.8.1", + "version": "23.8.2", "description": "A feature to install gcc", "options": { "version": { diff --git a/features/src/gitlab-cli/common/install.sh b/features/src/gitlab-cli/common/install.sh index 1b955bbc..217d4548 100755 --- a/features/src/gitlab-cli/common/install.sh +++ b/features/src/gitlab-cli/common/install.sh @@ -26,11 +26,6 @@ export BASH_ENV=/etc/bash.bash_env; EOF )"; -# Ensure that login shells get the correct path if the user updated the PATH using ENV. -rm -f /etc/profile.d/00-restore-env.sh -echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh -chmod +x /etc/profile.d/00-restore-env.sh - if ! grep -qE '^BASH_ENV=/etc/bash.bash_env$' /etc/environment; then echo "BASH_ENV=/etc/bash.bash_env" >> /etc/environment; fi diff --git a/features/src/gitlab-cli/devcontainer-feature.json b/features/src/gitlab-cli/devcontainer-feature.json index 6de0d1bc..b961fee6 100644 --- a/features/src/gitlab-cli/devcontainer-feature.json +++ b/features/src/gitlab-cli/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "gitlab-cli", - "version": "23.8.0", + "version": "23.8.1", "name": "GitLab CLI", "documentationURL": "https://github.com/rapidsai/devcontainers/features/tree/main/src/gitlab-cli", "description": "Installs the GitLab CLI. Auto-detects latest version and installs needed dependencies.", diff --git a/features/src/llvm/common/install.sh b/features/src/llvm/common/install.sh index 1b955bbc..217d4548 100755 --- a/features/src/llvm/common/install.sh +++ b/features/src/llvm/common/install.sh @@ -26,11 +26,6 @@ export BASH_ENV=/etc/bash.bash_env; EOF )"; -# Ensure that login shells get the correct path if the user updated the PATH using ENV. -rm -f /etc/profile.d/00-restore-env.sh -echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh -chmod +x /etc/profile.d/00-restore-env.sh - if ! grep -qE '^BASH_ENV=/etc/bash.bash_env$' /etc/environment; then echo "BASH_ENV=/etc/bash.bash_env" >> /etc/environment; fi diff --git a/features/src/llvm/devcontainer-feature.json b/features/src/llvm/devcontainer-feature.json index d6c8156a..6b1697b8 100644 --- a/features/src/llvm/devcontainer-feature.json +++ b/features/src/llvm/devcontainer-feature.json @@ -1,7 +1,7 @@ { "name": "LLVM compilers and tools", "id": "llvm", - "version": "23.8.0", + "version": "23.8.1", "description": "A feature to install LLVM compilers and tools", "options": { "version": { diff --git a/features/src/mambaforge/.bashrc b/features/src/mambaforge/.bashrc index 8ce38d40..1d054380 100644 --- a/features/src/mambaforge/.bashrc +++ b/features/src/mambaforge/.bashrc @@ -2,7 +2,7 @@ export MAMBA_NO_BANNER="${MAMBA_NO_BANNER:-1}"; for default_conda_env_name in ${DEFAULT_CONDA_ENV:-} ${CONDA_DEFAULT_ENV:-} base; do if [ -z "${default_conda_env_name:-}" ]; then continue; fi - if echo "${CONDA_PROMPT_MODIFIER:-}" | grep -qF "($default_conda_env_name)"; then + if grep -qF "(${default_conda_env_name})" <<< "${CONDA_PROMPT_MODIFIER:-}"; then break; fi conda activate "$default_conda_env_name" 2>/dev/null && break || continue; diff --git a/features/src/mambaforge/common/install.sh b/features/src/mambaforge/common/install.sh index 1b955bbc..217d4548 100755 --- a/features/src/mambaforge/common/install.sh +++ b/features/src/mambaforge/common/install.sh @@ -26,11 +26,6 @@ export BASH_ENV=/etc/bash.bash_env; EOF )"; -# Ensure that login shells get the correct path if the user updated the PATH using ENV. -rm -f /etc/profile.d/00-restore-env.sh -echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh -chmod +x /etc/profile.d/00-restore-env.sh - if ! grep -qE '^BASH_ENV=/etc/bash.bash_env$' /etc/environment; then echo "BASH_ENV=/etc/bash.bash_env" >> /etc/environment; fi diff --git a/features/src/mambaforge/devcontainer-feature.json b/features/src/mambaforge/devcontainer-feature.json index 2e9a82b7..450a724a 100644 --- a/features/src/mambaforge/devcontainer-feature.json +++ b/features/src/mambaforge/devcontainer-feature.json @@ -1,7 +1,7 @@ { "name": "Mambaforge", "id": "mambaforge", - "version": "23.8.3", + "version": "23.8.4", "description": "A feature to install mambaforge", "options": { "version": { diff --git a/features/src/ninja/common/install.sh b/features/src/ninja/common/install.sh index 1b955bbc..217d4548 100755 --- a/features/src/ninja/common/install.sh +++ b/features/src/ninja/common/install.sh @@ -26,11 +26,6 @@ export BASH_ENV=/etc/bash.bash_env; EOF )"; -# Ensure that login shells get the correct path if the user updated the PATH using ENV. -rm -f /etc/profile.d/00-restore-env.sh -echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh -chmod +x /etc/profile.d/00-restore-env.sh - if ! grep -qE '^BASH_ENV=/etc/bash.bash_env$' /etc/environment; then echo "BASH_ENV=/etc/bash.bash_env" >> /etc/environment; fi diff --git a/features/src/ninja/devcontainer-feature.json b/features/src/ninja/devcontainer-feature.json index 2c97e3a3..420c8c32 100644 --- a/features/src/ninja/devcontainer-feature.json +++ b/features/src/ninja/devcontainer-feature.json @@ -1,7 +1,7 @@ { "name": "Ninja build", "id": "ninja", - "version": "23.8.0", + "version": "23.8.1", "description": "A feature to install ninja-build", "options": { "version": { diff --git a/features/src/nvhpc/common/install.sh b/features/src/nvhpc/common/install.sh index 1b955bbc..217d4548 100755 --- a/features/src/nvhpc/common/install.sh +++ b/features/src/nvhpc/common/install.sh @@ -26,11 +26,6 @@ export BASH_ENV=/etc/bash.bash_env; EOF )"; -# Ensure that login shells get the correct path if the user updated the PATH using ENV. -rm -f /etc/profile.d/00-restore-env.sh -echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh -chmod +x /etc/profile.d/00-restore-env.sh - if ! grep -qE '^BASH_ENV=/etc/bash.bash_env$' /etc/environment; then echo "BASH_ENV=/etc/bash.bash_env" >> /etc/environment; fi diff --git a/features/src/nvhpc/devcontainer-feature.json b/features/src/nvhpc/devcontainer-feature.json index 8641ca1b..e42ae279 100644 --- a/features/src/nvhpc/devcontainer-feature.json +++ b/features/src/nvhpc/devcontainer-feature.json @@ -1,7 +1,7 @@ { "name": "NVHPC SDK", "id": "nvhpc", - "version": "23.8.0", + "version": "23.8.1", "description": "A feature to install the NVHPC SDK", "options": { "version": { diff --git a/features/src/oneapi/common/install.sh b/features/src/oneapi/common/install.sh index 1b955bbc..217d4548 100755 --- a/features/src/oneapi/common/install.sh +++ b/features/src/oneapi/common/install.sh @@ -26,11 +26,6 @@ export BASH_ENV=/etc/bash.bash_env; EOF )"; -# Ensure that login shells get the correct path if the user updated the PATH using ENV. -rm -f /etc/profile.d/00-restore-env.sh -echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh -chmod +x /etc/profile.d/00-restore-env.sh - if ! grep -qE '^BASH_ENV=/etc/bash.bash_env$' /etc/environment; then echo "BASH_ENV=/etc/bash.bash_env" >> /etc/environment; fi diff --git a/features/src/oneapi/devcontainer-feature.json b/features/src/oneapi/devcontainer-feature.json index e8b5446d..e8fa9cd4 100644 --- a/features/src/oneapi/devcontainer-feature.json +++ b/features/src/oneapi/devcontainer-feature.json @@ -1,7 +1,7 @@ { "name": "Intel oneapi toolchain", "id": "oneapi", - "version": "23.8.0", + "version": "23.8.1", "description": "A feature to install the Intel oneapi toolchain", "options": { "version": { diff --git a/features/src/python-lit/common/install.sh b/features/src/python-lit/common/install.sh index 1b955bbc..217d4548 100755 --- a/features/src/python-lit/common/install.sh +++ b/features/src/python-lit/common/install.sh @@ -26,11 +26,6 @@ export BASH_ENV=/etc/bash.bash_env; EOF )"; -# Ensure that login shells get the correct path if the user updated the PATH using ENV. -rm -f /etc/profile.d/00-restore-env.sh -echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh -chmod +x /etc/profile.d/00-restore-env.sh - if ! grep -qE '^BASH_ENV=/etc/bash.bash_env$' /etc/environment; then echo "BASH_ENV=/etc/bash.bash_env" >> /etc/environment; fi diff --git a/features/src/python-lit/devcontainer-feature.json b/features/src/python-lit/devcontainer-feature.json index 934a6739..6e87a043 100644 --- a/features/src/python-lit/devcontainer-feature.json +++ b/features/src/python-lit/devcontainer-feature.json @@ -1,7 +1,7 @@ { "name": "python-lit testing framework", "id": "python-lit", - "version": "23.8.0", + "version": "23.8.1", "description": "A feature to install python-lit", "options": { "version": { diff --git a/features/src/rapids-build-utils/common/install.sh b/features/src/rapids-build-utils/common/install.sh index 1b955bbc..217d4548 100755 --- a/features/src/rapids-build-utils/common/install.sh +++ b/features/src/rapids-build-utils/common/install.sh @@ -26,11 +26,6 @@ export BASH_ENV=/etc/bash.bash_env; EOF )"; -# Ensure that login shells get the correct path if the user updated the PATH using ENV. -rm -f /etc/profile.d/00-restore-env.sh -echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh -chmod +x /etc/profile.d/00-restore-env.sh - if ! grep -qE '^BASH_ENV=/etc/bash.bash_env$' /etc/environment; then echo "BASH_ENV=/etc/bash.bash_env" >> /etc/environment; fi diff --git a/features/src/rapids-build-utils/devcontainer-feature.json b/features/src/rapids-build-utils/devcontainer-feature.json index 0214894c..c0606b23 100644 --- a/features/src/rapids-build-utils/devcontainer-feature.json +++ b/features/src/rapids-build-utils/devcontainer-feature.json @@ -1,7 +1,7 @@ { "name": "NVIDIA RAPIDS devcontainer build utilities", "id": "rapids-build-utils", - "version": "23.8.2", + "version": "23.8.3", "description": "A feature to install the RAPIDS devcontainer build utilities", "containerEnv": { "BASH_ENV": "/etc/bash.bash_env" diff --git a/features/src/rust/common/install.sh b/features/src/rust/common/install.sh index 1b955bbc..217d4548 100755 --- a/features/src/rust/common/install.sh +++ b/features/src/rust/common/install.sh @@ -26,11 +26,6 @@ export BASH_ENV=/etc/bash.bash_env; EOF )"; -# Ensure that login shells get the correct path if the user updated the PATH using ENV. -rm -f /etc/profile.d/00-restore-env.sh -echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh -chmod +x /etc/profile.d/00-restore-env.sh - if ! grep -qE '^BASH_ENV=/etc/bash.bash_env$' /etc/environment; then echo "BASH_ENV=/etc/bash.bash_env" >> /etc/environment; fi diff --git a/features/src/rust/devcontainer-feature.json b/features/src/rust/devcontainer-feature.json index ab2baffd..d7d33952 100644 --- a/features/src/rust/devcontainer-feature.json +++ b/features/src/rust/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "rust", - "version": "23.8.0", + "version": "23.8.1", "name": "Rust", "documentationURL": "https://github.com/rapidsai/devcontainers/features/tree/main/src/rust", "description": "Installs Rust, common Rust utilities, and their required dependencies", diff --git a/features/src/sccache/common/install.sh b/features/src/sccache/common/install.sh index 1b955bbc..217d4548 100755 --- a/features/src/sccache/common/install.sh +++ b/features/src/sccache/common/install.sh @@ -26,11 +26,6 @@ export BASH_ENV=/etc/bash.bash_env; EOF )"; -# Ensure that login shells get the correct path if the user updated the PATH using ENV. -rm -f /etc/profile.d/00-restore-env.sh -echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh -chmod +x /etc/profile.d/00-restore-env.sh - if ! grep -qE '^BASH_ENV=/etc/bash.bash_env$' /etc/environment; then echo "BASH_ENV=/etc/bash.bash_env" >> /etc/environment; fi diff --git a/features/src/sccache/devcontainer-feature.json b/features/src/sccache/devcontainer-feature.json index 728ea03e..361201e7 100644 --- a/features/src/sccache/devcontainer-feature.json +++ b/features/src/sccache/devcontainer-feature.json @@ -1,7 +1,7 @@ { "name": "sccache", "id": "sccache", - "version": "23.8.0", + "version": "23.8.1", "description": "A feature to install sccache", "options": { "version": { diff --git a/features/src/utils/common/install.sh b/features/src/utils/common/install.sh index 1b955bbc..217d4548 100755 --- a/features/src/utils/common/install.sh +++ b/features/src/utils/common/install.sh @@ -26,11 +26,6 @@ export BASH_ENV=/etc/bash.bash_env; EOF )"; -# Ensure that login shells get the correct path if the user updated the PATH using ENV. -rm -f /etc/profile.d/00-restore-env.sh -echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh -chmod +x /etc/profile.d/00-restore-env.sh - if ! grep -qE '^BASH_ENV=/etc/bash.bash_env$' /etc/environment; then echo "BASH_ENV=/etc/bash.bash_env" >> /etc/environment; fi diff --git a/features/src/utils/devcontainer-feature.json b/features/src/utils/devcontainer-feature.json index a424c1bb..4b39c24b 100644 --- a/features/src/utils/devcontainer-feature.json +++ b/features/src/utils/devcontainer-feature.json @@ -1,7 +1,7 @@ { "name": "devcontainer-utils", "id": "utils", - "version": "23.8.4", + "version": "23.8.5", "description": "A feature to install RAPIDS devcontainer utility scripts", "containerEnv": { "BASH_ENV": "/etc/bash.bash_env" diff --git a/features/src/utils/install.sh b/features/src/utils/install.sh index c2f4a5f1..2f298c22 100644 --- a/features/src/utils/install.sh +++ b/features/src/utils/install.sh @@ -101,7 +101,7 @@ for dir in $(for_each_user_bashrc 'echo "$(dirname "$(realpath -m "$0")")"'); do # Create ~/.cache, i.e. $XDG_CONFIG_HOME mkdir -p -m 0755 "${dir}"/.config/{clangd,pip}; # Create ~/.local/state, i.e. $XDG_STATE_HOME - mkdir -p -m 0755 "${dir}"/.local/{bin,state}; + mkdir -p -m 0755 "${dir}"/.local/state; # Create or update ~/.ssh/known_hosts mkdir -p -m 0700 "${dir}"/.ssh; touch "${dir}"/.ssh/known_hosts; @@ -111,14 +111,26 @@ ${known_hosts} ____EOF done +rm -rf /root/.cache; +rm -rf /root/.local/{bin,state}; +rm -rf /root/.config/{clangd,pip}; + # Find the non-root user find_non_root_user; + +USERHOME="$(bash -c "echo ~${USERNAME}")"; + # Add user to the crontab group -usermod -aG crontab ${USERNAME}; +usermod -aG crontab "${USERNAME}"; + # Allow user to edit the crontab -echo ${USERNAME} >> /etc/cron.allow; +echo "${USERNAME}" >> /etc/cron.allow; + +# Create ~/.cache, i.e. $XDG_CONFIG_HOME +mkdir -p -m 0755 "${USERHOME}"/.local/bin; + # Ensure the user owns their homedir -chown -R ${USERNAME}:${USERNAME} "$(bash -c "echo ~${USERNAME}")"; +chown -R "${USERNAME}:${USERNAME}" "${USERHOME}"; # Generate bash completions if dpkg -s bash-completion >/dev/null 2>&1; then