From 528afa0ced23e19766d1dca90e22c0780875825a Mon Sep 17 00:00:00 2001 From: BlackNet Dev Date: Sat, 16 May 2020 19:48:40 +0200 Subject: [PATCH] add install script --- install.sh | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 install.sh diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..6177f08 --- /dev/null +++ b/install.sh @@ -0,0 +1,42 @@ +#!/usr/bin/bash +cd ~ + +# get os_id for zsh installtion +if [[ -r /etc/os-release ]]; then + os_id=$(grep -oP '(?<=^ID=).+' /etc/os-release | tr -d '"') +fi + +# check if zsh shell installed +if [[ ! -f "/usr/bin/zsh" || ! -f "/bin/zsh" ]]; then + case $os_id in + *arch*|*manjaro*) + sudo pacman -S zsh --noconfirm + ;; + *debian*|*ubuntu*|*raspbian*) + sudo apt install zsh -y + ;; + *) + esac +fi + +# check if oh my zsh installed +if [ ! -d "~/.oh-my-zsh" ]; then + sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended + chsh -s $(which zsh) +fi + +# install rainbow theme & alias plugin +wget -xqO ~/.oh-my-zsh/custom/themes/rainbow.zsh-theme https://gitea.mkex.de/blacknet76/rainbow-zsh-theme/raw/branch/master/rainbow.zsh-theme +mkdir -p ~/.oh-my-zsh/custom/plugins/rainbow-alias/ +wget -xqO ~/.oh-my-zsh/custom/plugins/rainbow-alias/rainbow-alias.plugin.zsh https://gitea.mkex.de/blacknet76/rainbow-zsh-theme/raw/branch/master/rainbow-alias.plugin.zsh + +# install needfull plugins +git clone https://github.com/zsh-users/zsh-autosuggestions.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions +git clone https://github.com/zsh-users/zsh-history-substring-search ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-history-substring-search +git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting + +# set rainbow as theme +sed -i.bak 's/^[[:space:]]*ZSH_THEME=.*/ZSH_THEME="rainbow"/' .zshrc +# add neefull plugins +sed -i -e 's/\(^plugins=([^)]*\)/\1 rainbow-alias zsh-autosuggestions zsh-history-substring-search zsh-syntax-highlighting/' .zshrc +