#!/bin/sh set -e set -x USAGE=" Usage: `basename $0` [zsh] [vim] [--force] " install_zsh=true force_install=false install_vim=false clean_all=false while [ "$1" != "" ]; do case "$1" in zsh ) install_zsh=true ;; --skip-zsh ) install_zsh=false ;; --with-vim ) install_vim=true ;; --force ) force_install=true ;; --clean-all ) clean_all=true ;; * ) echo $USAGE exit 1 esac shift done function setup_X { cp ./defaults/.xinitrc ~/ cp ./defaults/.Xdefaults ~/ } function setup_zsh { curl https://raw.githubusercontent.com/mamikonyana/.dotfiles/gh-pages/defaults/zshrc.zsh-template -o ~/.zshrc if ! [[ -d ~/.oh-my-zsh ]] ; then sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --keep-zshrc --unattended else # TODO(arsen): Check that it point to a correct repository. if $force_install ; then echo "Deleting the contents of ~/.oh-my-zsh" rm -rf ~/.oh-my-zsh sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --keep-zshrc --unattended fi fi # TODO(arsen): Figure out a way to get this variable from shell, it's there in terminal ZSH_CUSTOM=~/.oh-my-zsh/custom mkdir -p $ZSH_CUSTOM/themes curl https://raw.githubusercontent.com/mamikonyana/esqaw-zsh-theme/master/esqaw.zsh-theme -o $ZSH_CUSTOM/themes/esqaw.zsh-theme echo "Done Setting up zsh." exec zsh -l } function setup_vim { echo "Installing vim using setup-vim.sh script" ./setup-vim.sh } if $clean_all ; then rm -rf ~/.oh-my-zsh mv ~/.zshrc ~/.zshrc.backup || true fi if $install_zsh ; then setup_zsh fi if $install_vim ; then setup_vim fi