Unverified Commit a5fbdab3 authored by Samruddhi Khandale's avatar Samruddhi Khandale Committed by GitHub

fix bug - Debian / Ubuntu base conda-notice.txt error (#135)

* fix bug

* move config

* fix tests
parent d8ee2e8c
......@@ -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
......@@ -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!"
......@@ -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!"
......@@ -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
......@@ -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
......@@ -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
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