`.sh` installer errors for `conda init` step when called directly or via `sh`
Checklist
- [x] I added a descriptive title
- [x] I searched open reports and couldn't find a duplicate
What happened?
If I call my constructor-generated Linux installer directly, as in ./my-package-0.1-Linux.sh, or via sh, as in sh my-package-0.1-Linux.sh, and chose to update the shell profile "Do you wish to update your shell profile to automatically ...", then the installer generates the following message:
no change /home/runner/Scientific-Python/condabin/conda
no change /home/runner/Scientific-Python/bin/conda
no change /home/runner/Scientific-Python/bin/conda-env
no change /home/runner/Scientific-Python/bin/activate
no change /home/runner/Scientific-Python/bin/deactivate
no change /home/runner/Scientific-Python/etc/profile.d/conda.sh
no change /home/runner/Scientific-Python/etc/fish/conf.d/conda.fish
no change /home/runner/Scientific-Python/shell/condabin/Conda.psm1
no change /home/runner/Scientific-Python/shell/condabin/conda-hook.ps1
no change /home/runner/Scientific-Python/lib/python3.13/site-packages/xontrib/conda.xsh
no change /home/runner/Scientific-Python/etc/profile.d/conda.csh
modified /home/runner/.bashrc
==> For changes to take effect, close and re-open your current shell. <==
error libmamba Please provide a shell type.
Run with --help for more information.
critical libmamba Unknown shell type. Aborting.
I don't get this message if I call the installer with bash, as in bash my-package-0.1-Linux.sh.
The error appears to be because the installer is executing the second of these two lines:
*zsh) "$PREFIX/bin/python" -m conda init zsh ;;
*) "$PREFIX/bin/python" -m conda init ;;
Superficially, it seems that this second line should be "$PREFIX/bin/python" -m conda init $SHELL, and that the case statement there is redundant - but I'm sure I'm missing something ...
See https://github.com/scientific-python/installer/issues/5 for original discovery.
Additional Context
No response
I think it comes from the mamba side: https://github.com/conda/constructor/blob/7558141203ac998a873b25cb56614ccbc830d820/constructor/header.sh#L707-L710
Ah yes - you're right. Is this a bug then in Mamba? And / or does it need another clause for bash, as in:
case $SHELL in
*zsh) "$PREFIX/bin/mamba" shell init --shell zsh ;;
*bash) "$PREFIX/bin/mamba" shell init --shell bash ;;
*) "$PREFIX/bin/mamba" shell init ;;
esac
Or even:
$PREFIX/bin/mamba" shell init --shell $(basename $SHELL)
?