#!/bin/bash # Default settings start=`date +%s` bold=$(tput bold) normal=$(tput sgr0) red=`tput setaf 1` green=`tput setaf 2` reset=`tput sgr0` VIMREPO="https://gist.github.com/frizbee/8174f50d6863666efb217615bc1ecfac/raw/42db6ec0527de01e1215ca29689ea7ef10b7d51d/vimrc" beginDeploy() { echo echo "${bold}$1${normal}" } sudo yum update sudo yum -y install guake # setup Guake terminal, beter that builtin beginDeploy "######### ZSH ##########" # Setup ZSH if [ ! -x "/usr/bin/zsh" ]; then sudo yum update && sudo yum -y install zsh sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" else echo "${green}ZSH already installed!${reset}" fi # source ~/.zshrc # Use this command if shell not changed: chsh -s /bin/zsh beginDeploy "######### edit ZSH ##########" zshrc="$HOME/.zshrc" echo -n "Do you want to edit zshrc? [y/n] > " editzshrc= read editzshrc if [ "$editzshrc" != "n" ]; then if [ -f "$zshrc" ]; then echo "$zshrc found" sed -i -e 's/(git)/(git ruby git-flow bundler)/g' $zshrc echo "alias update='sudo yum -y update'" >> $zshrc echo "alias gsweep='git branch --merged master | command grep -vE \"^(\*|\s*staging\s*|\s*develop\s*|\s*master\s*$)\" | command xargs -n 1 git branch -d'" >> $zshrc echo "alias gb=\"git for-each-ref --sort=committerdate refs/heads/ --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) | %(authorname) | (%(color:green)%(committerdate:relative)%(color:reset))| %(contents:subject) ' | column -t -s '|'"\" >> $zshrc else echo "$zshrc not found" echo "${red}Exit program!${reset}" exit 1 fi else echo "${green}Skipping edit ZSHRC...${reset}" fi beginDeploy "######### Python ##########" if ! python3 -c 'import sys; print(sys.version_info[:])'; then sudo yum install -y python3 python3 --version else echo "${green}Python already installed!${reset}" fi beginDeploy "######### Golang #########" # For CentOS 7 only # https://gist.github.com/RaviTezu/848dc4dee712d162503a0d9207728d34 if [ -f "/bin/go" ]; then echo "${green}Go installed!${reset}" else sudo rpm --import https://mirror.go-repo.io/centos/RPM-GPG-KEY-GO-REPO curl -s https://mirror.go-repo.io/centos/go-repo.repo | sudo tee /etc/yum.repos.d/go-repo.repo sudo yum install golang mkdir ~/go which go fi beginDeploy "########## Intall RipGrep ############" if [ ! -x "/usr/bin/rg" ]; then sudo yum-config-manager --add-repo=https://copr.fedorainfracloud.org/coprs/carlwgeorge/ripgrep/repo/epel-7/carlwgeorge-ripgrep-epel-7.repo sudo yum install -y ripgrep else echo "${green}RipGrep already installed${reset}" fi beginDeploy "########### Install Plug and clone .vimrc ############" if [ -f "$HOME/.vim/autoload/plug.vim" ]; then echo "${green}Plug already installed${reset}" else curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim fi if [ ! -d "$HOME/.vim" ]; then echo "${red}Vim not installed${reset}" # yum install gcc make ncurses ncurses-devel # yum install ctags git tcl-devel ruby-devel python-devel fi if [ -f ~/.vimrc ] || [ -h ~/.vimrc ]; then echo "${green}.vimrc already exists${reset}" echo -n "Do you want to rewreite it? [y/n] > " vimrc= read vimrc if [ "$vimrc" != "n" ]; then echo "${green}Removing old .vimrc${reset}" rm -f "$HOME/.vimrc" echo "${green}Cloning .vimrc${reset}" sh -c "curl -s $VIMREPO >> ~/.vimrc" else echo "${green}Skipping cloning .vimrc${reset}" fi else echo "${green}Cloning .vimrc${reset}" if [ -d "$HOME/.vim" ]; then sh -c "curl -s $VIMREPO >> ~/.vimrc" else echo "${red}Please install VIM first${reset}" echo "${red}Exit program{$reset}" exit 1 fi fi beginDeploy "############# Setup Ruby with libraries ##############" sudo yum install -y git-core \ zlib \ zlib-devel \ gcc-c++ \ patch \ readline \ readline-devel \ libyaml-devel \ libffi-devel \ openssl-devel \ make \ bzip2 \ autoconf \ automake \ libtool \ bison \ curl \ sqlite-devel \ nodejs \ yarn cd ~ if [ ! -d "$HOME/.rbenv" ]; then git clone git://github.com/sstephenson/rbenv.git .rbenv echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zshrc echo 'eval "$(rbenv init -)"' >> ~/.zshrc else echo "${green}Upgrading rbenv${reset}" git -C "$(rbenv root)" pull fi #exec $SHELL if [ ! -d "$HOME/.rbenv/plugins/ruby-build" ]; then git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.zshrc #exec $SHELL else echo "${green}Upgrading ruby-build${reset}" git -C "$(rbenv root)"/plugins/ruby-build pull fi if [ ! -d "$HOME/.rbenv/versions/2.7.1" ]; then rbenv install 2.7.1 rbenv global 2.7.1 fi echo -n "${green}Current ruby: ${reset}" ruby -v echo "gem: --no-document" > ~/.gemrc gem install bundler gem install rails rbenv rehash beginDeploy "############# Setup GIT ##############" git config --global color.ui true git config --global user.name "Name" git config --global user.email "email@email.com" # ssh-keygen -t rsa -b 4096 -C "YOUR@EMAIL.com"