forked from coop-cloud/abra
feat(installer): check if ~/local/.bin is in $PATH
This commit is contained in:
parent
3d46ce6db2
commit
383f857f4a
|
@ -42,6 +42,21 @@ function install_abra_release {
|
|||
echo "downloading $ABRA_VERSION $PLATFORM binary release for abra..."
|
||||
curl --progress-bar "$release_url" --output "$HOME/.local/bin/abra"
|
||||
chmod +x "$HOME/.local/bin/abra"
|
||||
x=$(echo $PATH | grep $HOME/.local/bin)
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "$(tput setaf 3)WARNING: $HOME/.local/bin/ is not in \$PATH! If you want to run abra by just typing "abra" you should add it to your \$PATH! To do that run:$(tput sgr0)"
|
||||
p=$HOME/.local/bin
|
||||
com="echo PATH=\$PATH:$p"
|
||||
if [[ $SHELL =~ "bash" ]]; then
|
||||
echo "echo $com >> $HOME/.bashrc"
|
||||
elif [[ $SHELL =~ "fizsh" ]]; then
|
||||
echo "echo $com >> $HOME/.fizsh/.fizshrc"
|
||||
elif [[ $SHELL =~ "zsh" ]]; then
|
||||
echo "echo $com >> $HOME/.zshrc"
|
||||
else
|
||||
echo "echo $com >> $HOME/.profile"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "abra installed to $HOME/.local/bin/abra"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue