Unverified Commit 2d63a582 authored by Samruddhi Khandale's avatar Samruddhi Khandale Committed by GitHub

Common-utils: Fix bug - optional first run image specific notice (#201)

* add DEV_CONTAINERS_DIR as containerEnv

* fix path

* update test

* remove containerEnv
parent 602c3ec7
{ {
"id": "common-utils", "id": "common-utils",
"version": "1.1.1", "version": "1.1.2",
"name": "Common Debian Utilities", "name": "Common Debian Utilities",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/common-utils", "documentationURL": "https://github.com/devcontainers/features/tree/main/src/common-utils",
"description": "Installs a set of common command line utilities, Oh My Zsh!, and sets up a non-root user.", "description": "Installs a set of common command line utilities, Oh My Zsh!, and sets up a non-root user.",
......
...@@ -17,9 +17,7 @@ USER_UID=${UID:-"automatic"} ...@@ -17,9 +17,7 @@ USER_UID=${UID:-"automatic"}
USER_GID=${GID:-"automatic"} USER_GID=${GID:-"automatic"}
ADD_NON_FREE_PACKAGES=${NONFREEPACKAGES:-"false"} ADD_NON_FREE_PACKAGES=${NONFREEPACKAGES:-"false"}
DEV_CONTAINERS_DIR="/usr/local/etc/vscode-dev-containers" MARKER_FILE="/usr/local/etc/vscode-dev-containers/common"
MARKER_FILE="${DEV_CONTAINERS_DIR}/common"
if [ "$(id -u)" -ne 0 ]; then 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.' echo -e 'Script must be run as root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.'
...@@ -234,8 +232,8 @@ if [[ "${PATH}" != *"$HOME/.local/bin"* ]]; then export PATH="${PATH}:$HOME/.loc ...@@ -234,8 +232,8 @@ if [[ "${PATH}" != *"$HOME/.local/bin"* ]]; then export PATH="${PATH}:$HOME/.loc
# Display optional first run image specific notice if configured and terminal is interactive # Display optional first run image specific notice if configured and terminal is interactive
if [ -t 1 ] && [[ "${TERM_PROGRAM}" = "vscode" || "${TERM_PROGRAM}" = "codespaces" ]] && [ ! -f "$HOME/.config/vscode-dev-containers/first-run-notice-already-displayed" ]; then if [ -t 1 ] && [[ "${TERM_PROGRAM}" = "vscode" || "${TERM_PROGRAM}" = "codespaces" ]] && [ ! -f "$HOME/.config/vscode-dev-containers/first-run-notice-already-displayed" ]; then
if [ -f "${DEV_CONTAINERS_DIR}/first-run-notice.txt" ]; then if [ -f "/usr/local/etc/vscode-dev-containers/first-run-notice.txt" ]; then
cat "${DEV_CONTAINERS_DIR}/first-run-notice.txt" cat "/usr/local/etc/vscode-dev-containers/first-run-notice.txt"
elif [ -f "/workspaces/.codespaces/shared/first-run-notice.txt" ]; then elif [ -f "/workspaces/.codespaces/shared/first-run-notice.txt" ]; then
cat "/workspaces/.codespaces/shared/first-run-notice.txt" cat "/workspaces/.codespaces/shared/first-run-notice.txt"
fi fi
...@@ -432,12 +430,12 @@ if [ ! -z "${CONTENTS_URL}" ]; then echo && echo "More info: ${CONTENTS_URL}"; f ...@@ -432,12 +430,12 @@ if [ ! -z "${CONTENTS_URL}" ]; then echo && echo "More info: ${CONTENTS_URL}"; f
echo echo
EOF EOF
)" )"
if [ -f "${DEV_CONTAINERS_DIR}/meta.env" ]; then if [ -f "/usr/local/etc/vscode-dev-containers/meta.env" ]; then
echo "${meta_info_script}" > /usr/local/bin/devcontainer-info echo "${meta_info_script}" > /usr/local/bin/devcontainer-info
chmod +x /usr/local/bin/devcontainer-info chmod +x /usr/local/bin/devcontainer-info
fi fi
if [ ! -d "${DEV_CONTAINERS_DIR}" ]; then if [ ! -d "/usr/local/etc/vscode-dev-containers" ]; then
mkdir -p "$(dirname "${MARKER_FILE}")" mkdir -p "$(dirname "${MARKER_FILE}")"
fi fi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment