#!/bin/bash # install and configure zsh installdeps() { #checking for system systems="ubuntu arch" issue="$(cat /etc/issue)" for item in $systems; do echo $issue | grep -i $item if [ $? -eq 0 ]; then system=$item fi done case $system in ubuntu) sudo apt-get update && sudo apt-get install -y curl zsh git-core vim ;; arch) sudo pacman -Su git zsh curl vim ;; ?) echo "unknown system. could not install anything" ;; esac } zshinstall() { rm -rf ~/.oh-my-zsh/ curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh rm -rf ~/.oh-my-zsh/custom/ cd ~/.oh-my-zsh/ choice="null" while [ $choice != "y" ] && [ $choice != "n" ]; do echo "" read -p "should i clone the zshconfig writeable? [y/n]" choice if [ $choice = "y" ]; then git clone git@git.socialnerds.org:zshconfig.git custom else git clone git://git.socialnerds.org/zshconfig.git custom fi done echo "" read -p "now modify your ~/.zshrc to your needs" vim ~/.zshrc cat /etc/passwd | grep ~ | grep "/bin/zsh" #set default shell if not set already if [ $? -eq 1 ]; then echo "" read -p "time to change your default shell to /bin/zsh" sudo vim /etc/passwd fi } #start of script if [ -d ~/.oh-my-zsh/custom/.git ]; then echo "" echo "skipping zsh installation. it is already there." echo "" read -p "do you want to cleanup and reinstall? [y/n]" choice if [ $choice = "y" ]; then installdeps zshinstall else echo "updating instead..." cd ~/.oh-my-zsh/custom git pull origin master fi else installdeps zshinstall fi #end of file