├── README.md └── install-zsh-theme.sh /README.md: -------------------------------------------------------------------------------- 1 | # linux-scripts 2 | 3 | ## Install zsh theme 4 | ``` 5 | wget -O- https://raw.githubusercontent.com/Gobidev/linux-scripts/master/install-zsh-theme.sh | bash 6 | ``` -------------------------------------------------------------------------------- /install-zsh-theme.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This scripts installs zsh with my custom theme and .zshrc 4 | # based on https://github.com/RubixDev/HandyLinuxStuff/blob/main/zish/install.sh 5 | 6 | _COLOR () { echo "\\033[38;5;$1m"; } 7 | BOLD () { if [ "$1" != "" ]; then echo "$(BOLD)$(_COLOR "$1")"; else echo "\\033[1m"; fi; } 8 | NORMAL () { if [ "$1" != "" ]; then echo "$(NORMAL)$(_COLOR "$1")"; else echo "\\033[22m"; fi; } 9 | RESET () { echo "\\033[0m"; } 10 | 11 | # Install zsh if not installed 12 | if ! command -v zsh &> /dev/null; then 13 | echo "zsh is not installed, installing.." 14 | if command -v pacman &> /dev/null; then 15 | sudo pacman -S zsh --noconfirm 16 | elif command -v apt &> /dev/null; then 17 | sudo apt install zsh -y 18 | elif command -v dnf &> /dev/null; then 19 | sudo dnf install zsh -y 20 | fi 21 | fi 22 | 23 | # Install git if not installed 24 | if ! command -v git &> /dev/null; then 25 | echo "git is not installed, installing.." 26 | if command -v pacman &> /dev/null; then 27 | sudo pacman -S git --noconfirm 28 | elif command -v apt &> /dev/null; then 29 | sudo apt install git -y 30 | elif command -v dnf &> /dev/null; then 31 | sudo dnf install git -y 32 | fi 33 | fi 34 | 35 | # Install pfetch, if not installed 36 | if ! command -v pfetch &> /dev/null; then 37 | echo "pfetch is not installed, installing to /usr/local/bin/pfetch" 38 | sudo wget -O /usr/local/bin/pfetch https://raw.githubusercontent.com/dylanaraps/pfetch/master/pfetch && sudo chmod +x /usr/local/bin/pfetch 39 | fi 40 | 41 | # Check if wget or curl and git is installed 42 | wget --version > /dev/null || { 43 | curl --version > /dev/null || { 44 | echo -e "$(BOLD 1)You have neither wget nor curl installed.$(NORMAL) Please install at least one of them.$(RESET)" 45 | exit 127 46 | } 47 | } 48 | 49 | git --version > /dev/null || { 50 | echo -e "$(BOLD 1)git is not installed.$(NORMAL) Please make sure it is correctly installed on your system.$(RESET)" 51 | exit 127 52 | } 53 | 54 | # Install Oh My Zsh 55 | echo -e "$(NORMAL 6)Installing oh-my-zsh$(RESET)" 56 | sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended || { 57 | sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended || exit 1 58 | } 59 | echo -e "$(NORMAL 2)..done$(RESET)" 60 | 61 | # Install necessary plugins 62 | echo -e "$(NORMAL 6)Installing zsh-autosuggestions$(RESET)" 63 | git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions || exit 1 64 | echo -e "$(NORMAL 2)..done$(RESET)" 65 | 66 | echo -e "$(NORMAL 6)Installing zsh-syntax-highlighting$(RESET)" 67 | git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting || exit 1 68 | echo -e "$(NORMAL 2)..done$(RESET)" 69 | 70 | # Install theme 71 | echo -e "$(NORMAL 6)Installing agnoster theme$(RESET)" 72 | wget -O- https://raw.githubusercontent.com/Gobidev/zsh-theme/master/agnoster.zsh-theme > ~/.oh-my-zsh/custom/themes/agnoster.zsh-theme || { 73 | curl -fsSL https://raw.githubusercontent.com/Gobidev/zsh-theme/master/agnoster.zsh-theme > ~/.oh-my-zsh/custom/themes/agnoster.zsh-theme || exit 1 74 | } 75 | echo -e "$(NORMAL 2)..done$(RESET)" 76 | 77 | 78 | # Create backup of .zshrc 79 | echo -e "$(NORMAL 6)Backing up .zshrc to .zshrc-old$(RESET)" 80 | cp ~/.zshrc .zshrc-old 81 | echo -e "$(NORMAL 2)..done$(RESET)" 82 | 83 | # Install .zshrc 84 | echo -e "$(NORMAL 6)Installing .zshrc$(RESET)" 85 | wget -O- https://raw.githubusercontent.com/Gobidev/dotfiles/main/.zshrc > ~/.zshrc || { 86 | curl -fsSL https://raw.githubusercontent.com/Gobidev/dotfiles/main/.zshrc > ~/.zshrc || exit 1 87 | } 88 | echo -e "$(NORMAL 2)..done$(RESET)" 89 | --------------------------------------------------------------------------------