Build zsh

This commit is contained in:
Thomas Forgione 2020-02-05 09:44:54 +01:00
parent af7adfb0ad
commit 3b21af203a
1 changed files with 29 additions and 3 deletions

View File

@ -177,6 +177,7 @@ configure_dotfiles() {
} }
configure_shell() { configure_shell() {
installed_locally=false
yes_no_ask "do you wish to install and configure zsh?" yes_no_ask "do you wish to install and configure zsh?"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
@ -205,8 +206,29 @@ configure_shell() {
test_command zsh test_command zsh
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
if [ $sudo_available -ne 0 ]; then if [ $sudo_available -ne 0 ]; then
error "zsh is needed, but you don't have zsh or sudo" warn "zsh is needed, but you don't have zsh or sudo"
return 1 yes_no_ask "do you want me to compile and install zsh locally?"
if [ $? -ne 0 ]; then
error "zsh is needed, but you refused to install zsh"
return 1
fi
installed_locally=true
info "downloading zsh..."
mkdir tmp
cd tmp
curl https://codeload.github.com/zsh-users/zsh/tar.gz/zsh-5.7.1 --output zsh.tar.gz > /dev/null 2>&1
tar xvf zsh.tar.gz > /dev/null 2>&1
cd zsh-zsh-5.7.1
info "building zsh (this may take a while)..."
./Util/preconfig > /dev/null 2>&1
./configure --prefix ~/.local/share > /dev/null 2>&1
make > /dev/null 2>&1
info "installing zsh (this may take a while)..."
make install > /dev/null 2>&1
cd ../../
rm -rf tmp
info "zsh installed!"
else else
yes_no_ask_required "this magnificent prompt is based on zsh, do you wish to install zsh?" yes_no_ask_required "this magnificent prompt is based on zsh, do you wish to install zsh?"
install zsh install zsh
@ -255,7 +277,11 @@ configure_shell() {
yes_no_ask "do you wish to do that?" yes_no_ask "do you wish to do that?"
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo >> $HOME/.bashrc echo >> $HOME/.bashrc
echo "exec zsh" >> $HOME/.bashrc if [ "$installed_locally" == "true" ]; then
echo "exec ~/.local/share/bin/zsh" >> $HOME/.bashrc
else
echo "exec zsh" >> $HOME/.bashrc
fi
echo >> $HOME/.bashrc echo >> $HOME/.bashrc
else else
info "not doing anything" info "not doing anything"