Skip to content

Instantly share code, notes, and snippets.

@prometheusaiolos
Created November 23, 2023 05:51
Show Gist options
  • Save prometheusaiolos/71584f8d2eca62f3f175b3f0b3473352 to your computer and use it in GitHub Desktop.
Save prometheusaiolos/71584f8d2eca62f3f175b3f0b3473352 to your computer and use it in GitHub Desktop.
My WSL Setup Script
#!/bin/bash
# Function to install Zsh and Git if they are not installed
install_dependencies() {
echo "Checking for Zsh and Git..."
if ! command -v zsh >/dev/null 2>&1; then
echo "Zsh is not installed. Installing Zsh..."
sudo apt-get update && sudo apt-get install -y zsh
else
echo "Zsh is already installed."
fi
if ! command -v git >/dev/null 2>&1; then
echo "Git is not installed. Installing Git..."
sudo apt-get install -y git
else
echo "Git is already installed."
fi
}
# Function to install Oh-My-Zsh
install_oh_my_zsh() {
echo "Installing Oh-My-Zsh..."
sh -c "$(wget https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"
}
# Function to install Powerlevel10k
install_powerlevel10k() {
echo "Installing Powerlevel10k theme..."
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
echo 'source ~/.oh-my-zsh/custom/themes/powerlevel10k/powerlevel10k.zsh-theme' >>~/.zshrc
}
# Function to apply default configurations
apply_default_configs() {
echo "Applying default configurations..."
# Add your default configurations here
# For example, you might want to set ZSH_THEME="powerlevel10k/powerlevel10k" in your .zshrc
sed -i 's/^ZSH_THEME=".*"/ZSH_THEME="powerlevel10k\/powerlevel10k"/' ~/.zshrc
}
# Main script execution
install_dependencies
install_oh_my_zsh
install_powerlevel10k
apply_default_configs
echo "Setup complete. Please restart your terminal."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment