Skip to content

Instantly share code, notes, and snippets.

@soifou
Last active August 8, 2021 12:57
Show Gist options
  • Select an option

  • Save soifou/c99be4373f6ffe3b4ff7 to your computer and use it in GitHub Desktop.

Select an option

Save soifou/c99be4373f6ffe3b4ff7 to your computer and use it in GitHub Desktop.
Quickly setup zsh powered by antigen on fresh Debian servers
#!/bin/bash
# Quickly setup Zsh powered by antigen on fresh Debian servers
# Usage: bash -c "$(curl -fsSL https://gist.github.com/soifou/c99be4373f6ffe3b4ff7/raw/COMMIT_ID/zsh-antigen-debian.sh)"
if [[ $(which zsh | wc -m) == 0 ]]; then
echo "Zsh is not installed... installing"
apt-get install zsh
fi
if [[ $(which git | wc -m) == 0 ]]; then
echo "Git is not installed... installing"
apt-get install git
fi
if [[ ! -d $HOME/antigen ]]; then
echo "Clone antigen repository..."
git clone https://github.com/zsh-users/antigen.git $HOME/.antigen
fi
if [[ -f $HOME/.zshrc ]]; then
echo "Found existing zshrc... backup"
mv $HOME/.zshrc $HOME/.zshrc.dotbackup
fi
echo "Configuring zshrc..."
cat > "$HOME/.zshrc" <<EOF
LC_CTYPE=en_US.UTF-8
LC_ALL=en_US.UTF-8
source $HOME/.antigen/antigen.zsh
antigen use oh-my-zsh
antigen bundle debian
antigen bundle git
antigen bundle command-not-found
antigen bundle zsh-users/zsh-syntax-highlighting
antigen theme bureau
antigen apply
EOF
TEST_CURRENT_SHELL=$(expr "$SHELL" : '.*/\(.*\)')
if [ "$TEST_CURRENT_SHELL" != "zsh" ]; then
echo "\033[0;34mTime to change your default shell to zsh!\033[0m"
chsh -s $(grep /zsh$ /etc/shells | tail -1)
fi
unset TEST_CURRENT_SHELL
echo "Reload shell..."
env zsh
source $HOME/.zshrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment