Last active
August 29, 2015 14:23
-
-
Save NonLogicalDev/2c709d36c1b4aa4016c0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
############################################### | |
# INStALL: curl -L https://goo.gl/XzaObE | bash | |
############################################### | |
ZSHELL_LOC=/bin/zsh | |
main() { | |
Log0 "Installing Packages" | |
MAIN_PACKAGES=("git" "zsh" "vim" "exuberant-ctags") | |
ProvisionPackages "${MAIN_PACKAGES[@]}" | |
Log0 "Setting up Shell" | |
SetUpShell | |
} | |
SetUpShell() { | |
Log1 "Deleting Directories and Files" | |
rm -rf ${ZDOTDIR:-$HOME}/.zprezto | |
rm -rf ${ZDOTDIR:-$HOME}/.zshrc | |
rm -rf ${ZDOTDIR:-$HOME}/.zlogin | |
rm -rf ${ZDOTDIR:-$HOME}/.zlogout | |
rm -rf ${ZDOTDIR:-$HOME}/.zpreztorc | |
rm -rf ${ZDOTDIR:-$HOME}/.zprofile | |
rm -rf ${ZDOTDIR:-$HOME}/.zshenv | |
read -r -d '' ZSH_CLONE <<'EOS' | |
git clone --recursive https://github.com/sorin-ionescu/prezto.git "${ZDOTDIR:-$HOME}/.zprezto" | |
EOS | |
read -r -d '' ZSH_SETUP <<'EOS' | |
setopt EXTENDED_GLOB | |
for rcfile in "${ZDOTDIR:-$HOME}"/.zprezto/runcoms/^README.md(.N); do | |
ln -s "$rcfile" "${ZDOTDIR:-$HOME}/.${rcfile:t}" | |
done | |
EOS | |
Log1 "Installing Zprezto" | |
zsh -c "$ZSH_CLONE" && zsh -c "$ZSH_SETUP" | |
sudo chsh -s $ZSHELL_LOC $USER | |
} | |
# Utility Functions | |
ProvisionPackages() { | |
local PACKAGES=$1 | |
for pkg in PACKAGES | |
do | |
local pck=$pkg | |
Log1 "Installing $pkg..." | |
sudo apt-get install -y "$pck" | |
done | |
} | |
Log0() { | |
echo "$(tput setaf 1)>>>>>>>>>>>>> $1 <<<<<<<<<<<<<<<$(tput sgr0)" | |
} | |
Log1() { | |
echo ">>> $(tput setaf 2)$1$(tput sgr0)" | |
} | |
define(){ IFS='\n' read -r -d '' ${1} || true; } | |
main "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment