Last active
December 2, 2023 12:30
-
-
Save giddyhup/7013eb8d022e0ce94d68519d3cc32f68 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# install: | |
# curl -s https://gist.githubusercontent.com/giddyhup/7013eb8d022e0ce94d68519d3cc32f68/raw/c77828c8b53f57840ef728a9923c6db942256e89/installohmyzsh_unattended.sh | bash | |
usershell=$(grep $USER /etc/passwd | grep zsh) | |
if [[ $? == 0 ]]; then | |
echo "zsh is already the user's shell, to stay on the safe side we're aborting" | |
exit | |
fi | |
if sudo -n true 2>/dev/null; then | |
echo "I got sudo" | |
else | |
read -p 'What is your password? ' sudo_password | |
fi | |
cd | |
sudo apt update && sudo apt -y install git zsh | |
curl -Lo installohmyzsh.sh https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh | |
sh installohmyzsh.sh --unattended | |
mv .zshrc .zshrc.dist | |
echo "PATH=\"\$HOME/.local/bin:\$HOME/bin:\$PATH\"" > .zshrc | |
echo "export DISPLAY=:0" >> .zshrc | |
echo "export ZSH=$HOME/.oh-my-zsh" >> .zshrc | |
echo "ZSH_THEME=\"fishy\"" >> .zshrc | |
echo "DISABLE_AUTO_TITLE=\"true\"" >> .zshrc | |
echo "ENABLE_CORRECTION=\"true\"" >> .zshrc | |
echo "COMPLETION_WAITING_DOTS=\"true\"" >> .zshrc | |
echo "plugins=(git compleat)" >> .zshrc | |
echo "source \$ZSH/oh-my-zsh.sh" >> .zshrc | |
echo "case \$TERM in" >> .zshrc | |
echo " xterm*)" >> .zshrc | |
echo " precmd () {print -Pn \"\\e]0;\$USER@\$HOST: \$PWD\a\"}" >> .zshrc | |
echo " ;;" >> .zshrc | |
echo "esac" >> .zshrc | |
if sudo -n true 2>/dev/null; then | |
sudo chsh -s "$(which zsh)" "${USER}" | |
else | |
sudo -S chsh -s "$(which zsh)" "${USER}" <<< "${sudo_password}" | |
fi | |
echo "If everything went OK, zsh and oh-my-zsh are installed and set as default shell." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment