Sdkman-cli: SDKMAN should to be installable without profile modifications

Created on 1 Apr 2017  路  7Comments  路  Source: sdkman/sdkman-cli

There are many cases including CI servers which run all sorts of package version managers and it may not be welcome to have SDKMAN/nvm/rvm/{name other} be loaded into environment by default.

Please wrap the following sections of the installer:

echo "Attempt update of bash profiles..."
echo "Attempt update of zsh profiles..."

with something like:

if [ -z "$SDKMAN_SKIP_PROFILE" ]; then
    # ...
fi
Trello

Most helpful comment

Agreed, I had added something like this to my dotfiles so I can install it and not get my zshrc modified but apparently the string I was searching for doesn't work anymore..

EDIT: This works for now..

curl -s http://get.sdkman.io | sed -e '/if.*sdkman_bashrc/,$d' | bash

All 7 comments

Agreed, I had added something like this to my dotfiles so I can install it and not get my zshrc modified but apparently the string I was searching for doesn't work anymore..

EDIT: This works for now..

curl -s http://get.sdkman.io | sed -e '/if.*sdkman_bashrc/,$d' | bash

Given that the installer is a dynamic bash script that is served from the sdkman-hooks app, it might make sense to introduce a request parameter that allows for this. Something like:

curl -s https://get.sdkman.io?noprofile | bash

Would this work?

I use sdkman to install packages inside docker images. The problem is, that entries are added to .bashrc and therefore doesn't work in non-interactive environment. As workaround I have

RUN echo ". $HOME/.sdkman/bin/sdkman-init.sh" >> ~/.profile

Therefore I think it's better to not disable profile modification, but provide a greater control of it. For example like:

# doesn't modify profiles
curl -s https://get.sdkman.io?profile=none | bash

# modify first existing file
curl -s https://get.sdkman.io?profile=.profile,.bashrc | bash

# modify all existing files
curl -s https://get.sdkman.io?profile=.profile,.bashrc&strategy=all | bash

# modify or create a file
curl -s https://get.sdkman.io?profile=.bash_aliases&create=true | bash

Maybe allow paths like ~/.profile or /etc/bash.bashrc.

@devinsba Thanks for sharing your workaround.

The request parameter to control profile updates sounds like a good idea, and would need to be implemented on the sdkman-hooks project.

Also needed here, in my case i manage SDKs using sdkman but manage the shell integration with jenv - i install sdkman / jdks using ansible and well modifing my ZSH is nothing i desire here. Thank you for working on that

using this right now

curl -s "https://get.sdkman.io" | sed 's!^sdkman_bashrc=".*"$!sdkman_bashrc=/dev/null!' | sed 's!^sdkman_zshrc=".*"$!sdkman_zshrc=/dev/null!' | bash

It looks the sdkman-hooks issue for this work is https://github.com/sdkman/sdkman-hooks/issues/16

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aadrian picture aadrian  路  7Comments

dayja78 picture dayja78  路  6Comments

unknowpe picture unknowpe  路  7Comments

pshirshov picture pshirshov  路  6Comments

OmidTahouri picture OmidTahouri  路  7Comments