aboutsummaryrefslogtreecommitdiff
path: root/src/conda/install.sh
diff options
context:
space:
mode:
authorSamruddhi Khandale <skhandale@microsoft.com>2022-09-06 23:50:11 +0300
committerGitHub <noreply@github.com>2022-09-06 23:50:11 +0300
commita5fbdab3c096152dd3a318c0c23da9465815aa69 (patch)
tree30a1709f45c5351917864a7fd5c05ad782744b0c /src/conda/install.sh
parentd8ee2e8cf193bac39d9f31003f18d90b16dc969e (diff)
fix bug - Debian / Ubuntu base conda-notice.txt error (#135)
* fix bug * move config * fix tests
Diffstat (limited to 'src/conda/install.sh')
-rw-r--r--src/conda/install.sh25
1 files changed, 25 insertions, 0 deletions
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!"