Skip to content

Instantly share code, notes, and snippets.

@cesalazar
Last active June 22, 2017 20:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cesalazar/452bb9bf7f9f6dd89e69b5ed40fc130b to your computer and use it in GitHub Desktop.
Save cesalazar/452bb9bf7f9f6dd89e69b5ed40fc130b to your computer and use it in GitHub Desktop.
Install zsh if it isn't available then clone/setup prezto and change the shell. Just curl && exec it
#!/bin/bash
N_ZSH="\n zsh not found. Installing it\n" # Not found
Y_ZSH="\n zsh found. Cloning prezto\n" # Yes found :P
install_zsh (){
sudo apt-get update && sudo apt-get -y install zsh
}
clone_prezto (){
/bin/zsh - <<'EOF'
echo -e "\033[1;34m\n Cloning prezto\n\033[0m"
git clone --recursive https://github.com/sorin-ionescu/prezto.git \
"${ZDOTDIR:-$HOME}/.zprezto"
EOF
}
set_prezto (){
/bin/zsh - <<'EOF'
echo -e "\033[1;34m\n Setting up prezto\n\033[0m"
setopt EXTENDED_GLOB
for rcfile in "${ZDOTDIR:-$HOME}"/.zprezto/runcoms/^README.md(.N); do
ln -s "$rcfile" "${ZDOTDIR:-$HOME}/.${rcfile:t}"
done
EOF
}
cd "$HOME" || echo $'Can\'t cd into $HOME' && exit 1
# Is zsh installed?
if [ "$(which zsh)" != 0 ]
then
echo -e "\033[1;31m${N_ZSH}\033[0m"
install_zsh && clone_prezto && set_prezto
else
echo -e "\033[1;34m${Y_ZSH}\033[0m"
clone_prezto && set_prezto
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment