diff options
-rwxr-xr-x | src/anaconda/install.sh | 25 | ||||
-rwxr-xr-x | src/common-utils/install.sh | 18 | ||||
-rw-r--r-- | src/conda/install.sh | 25 | ||||
-rwxr-xr-x | test/anaconda/test.sh | 1 | ||||
-rw-r--r-- | test/conda/install_conda.sh | 1 | ||||
-rwxr-xr-x | test/conda/test.sh | 1 |
6 files changed, 53 insertions, 18 deletions
diff --git a/src/anaconda/install.sh b/src/anaconda/install.sh index 1802ce3..468fd01 100755 --- a/src/anaconda/install.sh +++ b/src/anaconda/install.sh @@ -103,4 +103,29 @@ if ! conda --version &> /dev/null ; then updaterc "export CONDA_DIR=${CONDA_DIR}/bin" fi +# Display a notice on conda when not running in GitHub Codespaces +mkdir -p /usr/local/etc/vscode-dev-containers +cat << 'EOF' > /usr/local/etc/vscode-dev-containers/conda-notice.txt +When using "conda" from outside of GitHub Codespaces, note the Anaconda repository contains +restrictions on commercial use that may impact certain organizations. See https://aka.ms/ghcs-conda + +EOF + +notice_script="$(cat << 'EOF' +if [ -t 1 ] && [ "${IGNORE_NOTICE}" != "true" ] && [ "${TERM_PROGRAM}" = "vscode" ] && [ "${CODESPACES}" != "true" ] && [ ! -f "$HOME/.config/vscode-dev-containers/conda-notice-already-displayed" ]; then + cat "/usr/local/etc/vscode-dev-containers/conda-notice.txt" + mkdir -p "$HOME/.config/vscode-dev-containers" + ((sleep 10s; touch "$HOME/.config/vscode-dev-containers/conda-notice-already-displayed") &) +fi +EOF +)" + +if [ -f "/etc/zsh/zshrc" ]; then + echo "${notice_script}" | tee -a /etc/zsh/zshrc +fi + +if [ -f "/etc/bash.bashrc" ]; then + echo "${notice_script}" | tee -a /etc/bash.bashrc +fi + echo "Done!"
\ No newline at end of file diff --git a/src/common-utils/install.sh b/src/common-utils/install.sh index 46e285b..0a62569 100755 --- a/src/common-utils/install.sh +++ b/src/common-utils/install.sh @@ -448,22 +448,4 @@ echo -e "\ RC_SNIPPET_ALREADY_ADDED=${RC_SNIPPET_ALREADY_ADDED}\n\ ZSH_ALREADY_INSTALLED=${ZSH_ALREADY_INSTALLED}" > "${MARKER_FILE}" -# Display a notice on conda when not running in GitHub Codespaces -cat << 'EOF' > ${DEV_CONTAINERS_DIR}/conda-notice.txt -When using "conda" from outside of GitHub Codespaces, note the Anaconda repository contains -restrictions on commercial use that may impact certain organizations. See https://aka.ms/ghcs-conda - -EOF - -notice_script="$(cat << 'EOF' -if [ -t 1 ] && [ "${IGNORE_NOTICE}" != "true" ] && [ "${TERM_PROGRAM}" = "vscode" ] && [ "${CODESPACES}" != "true" ] && [ ! -f "$HOME/.config/vscode-dev-containers/conda-notice-already-displayed" ]; then - cat "${DEV_CONTAINERS_DIR}/conda-notice.txt" - mkdir -p "$HOME/.config/vscode-dev-containers" - ((sleep 10s; touch "$HOME/.config/vscode-dev-containers/conda-notice-already-displayed") &) -fi -EOF -)" - -echo "${notice_script}" | tee -a /etc/bash.bashrc >> /etc/zsh/zshrc - echo "Done!" diff --git a/src/conda/install.sh b/src/conda/install.sh index ee4ff09..89d2fcb 100644 --- a/src/conda/install.sh +++ b/src/conda/install.sh @@ -98,4 +98,29 @@ if ! conda --version &> /dev/null ; then find "${CONDA_DIR}" -type d -print0 | xargs -n 1 -0 chmod g+s fi +# Display a notice on conda when not running in GitHub Codespaces +mkdir -p /usr/local/etc/vscode-dev-containers +cat << 'EOF' > /usr/local/etc/vscode-dev-containers/conda-notice.txt +When using "conda" from outside of GitHub Codespaces, note the Anaconda repository contains +restrictions on commercial use that may impact certain organizations. See https://aka.ms/ghcs-conda + +EOF + +notice_script="$(cat << 'EOF' +if [ -t 1 ] && [ "${IGNORE_NOTICE}" != "true" ] && [ "${TERM_PROGRAM}" = "vscode" ] && [ "${CODESPACES}" != "true" ] && [ ! -f "$HOME/.config/vscode-dev-containers/conda-notice-already-displayed" ]; then + cat "/usr/local/etc/vscode-dev-containers/conda-notice.txt" + mkdir -p "$HOME/.config/vscode-dev-containers" + ((sleep 10s; touch "$HOME/.config/vscode-dev-containers/conda-notice-already-displayed") &) +fi +EOF +)" + +if [ -f "/etc/zsh/zshrc" ]; then + echo "${notice_script}" | tee -a /etc/zsh/zshrc +fi + +if [ -f "/etc/bash.bashrc" ]; then + echo "${notice_script}" | tee -a /etc/bash.bashrc +fi + echo "Done!" diff --git a/test/anaconda/test.sh b/test/anaconda/test.sh index 511291a..c2eafe0 100755 --- a/test/anaconda/test.sh +++ b/test/anaconda/test.sh @@ -7,6 +7,7 @@ source dev-container-features-test-lib # Definition specific tests check "version" conda --version +check "if conda-notice.txt exists" cat /usr/local/etc/vscode-dev-containers/conda-notice.txt # Report result reportResults
\ No newline at end of file diff --git a/test/conda/install_conda.sh b/test/conda/install_conda.sh index 92fd2e0..efe7f5e 100644 --- a/test/conda/install_conda.sh +++ b/test/conda/install_conda.sh @@ -7,6 +7,7 @@ source dev-container-features-test-lib check "conda" conda --version | grep 4.12.0 check "conda-forge" conda config --show channels | grep conda-forge +check "if conda-notice.txt exists" cat /usr/local/etc/vscode-dev-containers/conda-notice.txt # Report result reportResults diff --git a/test/conda/test.sh b/test/conda/test.sh index 69120d9..24755c5 100755 --- a/test/conda/test.sh +++ b/test/conda/test.sh @@ -7,6 +7,7 @@ source dev-container-features-test-lib # Definition specific tests check "version" conda --version +check "if conda-notice.txt exists" cat /usr/local/etc/vscode-dev-containers/conda-notice.txt # Report result reportResults |