Athena-OS / athena

Athena OS is a Arch/Nix-based distro focused on Cybersecurity. Learn, practice and enjoy with any hacking tool!
https://athenaos.org
MIT License
1.03k stars 78 forks source link

[BUG]: "conda activate" can not work in the ".bashrc" environment. #66

Closed Ekkosun closed 1 year ago

Ekkosun commented 1 year ago

Athena OS version

v23.06.23

Which environment or technology are you using?

Kernel version

6.4.11-zen2-1-zen

Involved software

miniconda

Repro steps

For all version of miniconda:

Expected behavior

the prompt changes from (base) to (test)

Actual behavior

the prompt is still (base)

Diagnostic logs

i find the reason why the prompt doesn't change is that the line in .bashrc export PROMPT_COMMAND='source ~/.bashrc no-repeat-flag' conda adds the conda init lines in ~/.bashrc , but this command execute for every time a command is finished in bash. so the prompt doesn't change.

if [[ $1 != no-repeat-flag  ]]; then
    __conda_setup="$('/home/kumquat/miniconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
    if [ $? -eq 0 ]; then
        eval "$__conda_setup"
    else
        if [ -f "/home/kumquat/miniconda3/etc/profile.d/conda.sh" ]; then
            . "/home/kumquat/miniconda3/etc/profile.d/conda.sh"
        else
            export PATH="/home/kumquat/miniconda3/bin:$PATH"
        fi
    fi
    unset __conda_setup
fi
# <<< conda initialize <<<
conda activate $CONDA_DEFAULT_ENV

The code is my solution to this issue

D3vil0p3r commented 1 year ago

Thank you very much. Here https://athenaos.org/en/support/troubleshooting/#tools added the details you reported in the issue. I'm not sure to add that code directly on .bashrc because Athena has not Conda installed by default.

Ekkosun commented 1 year ago

Thank you for your attention。