Refactor install scripts (KISS)
This commit is contained in:
parent
9373174c6a
commit
a57e94a912
19
install.sh
19
install.sh
|
@ -5,20 +5,19 @@ RS=$(tput sgr0)
|
||||||
|
|
||||||
src=$(cd "$(dirname "$0")"; pwd)
|
src=$(cd "$(dirname "$0")"; pwd)
|
||||||
if [ ! -d $src/install ]; then
|
if [ ! -d $src/install ]; then
|
||||||
echo -e "$GREEN==> Cloning dotfiles repo"
|
echo -e "$GREEN==> Cloning dotfiles repo$RS"
|
||||||
git clone https://github.com/hlissner/dotfiles.git ~/.dotfiles | sed "s/^/ /"
|
git clone https://github.com/hlissner/dotfiles.git ~/.dotfiles | sed "s/^/ /"
|
||||||
src="~/.dotfiles"
|
src="~/.dotfiles"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
{
|
$src/install/osx
|
||||||
$src/install/osx
|
$src/install/zsh
|
||||||
$src/install/zsh
|
$src/install/brew
|
||||||
$src/install/brew
|
$src/install/git
|
||||||
$src/install/git
|
$src/install/rvm
|
||||||
$src/install/rvm
|
$src/install/tmux
|
||||||
$src/install/tmux
|
|
||||||
} | sed "s/^/ /"
|
|
||||||
|
|
||||||
echo "Done!"
|
echo
|
||||||
|
echo "${GREEN}Done!$RS"
|
||||||
echo "And if you want to install vim, run:"
|
echo "And if you want to install vim, run:"
|
||||||
echo " sh <(curl https://raw.github.com/hlissner/mlvim/master/install.sh -L)"
|
echo " sh <(curl https://raw.github.com/hlissner/mlvim/master/install.sh -L)"
|
||||||
|
|
64
install/brew
64
install/brew
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/zsh
|
#!/bin/zsh
|
||||||
|
|
||||||
if ! command-exists brew ; then
|
if ! command-exists brew; then
|
||||||
echoh "==> Homebrew: Installing"
|
echo "==> Homebrew: Installing"
|
||||||
|
|
||||||
# http://mxcl.github.com/homebrew/
|
# http://mxcl.github.com/homebrew/
|
||||||
ruby <(curl -fsSkL raw.github.com/mxcl/homebrew/go) | indent
|
ruby <(curl -fsSkL raw.github.com/mxcl/homebrew/go) | indent
|
||||||
|
@ -10,43 +10,41 @@ elif [ "$1" = "--force" ]; then
|
||||||
FORCE=1
|
FORCE=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "==> Homebrew: Updating"
|
||||||
|
# Make sure we’re using the latest Homebrew
|
||||||
|
brew update
|
||||||
|
|
||||||
if [ $FORCE ]; then
|
if [ $FORCE ]; then
|
||||||
echoh "==> Homebrew: Installing essential brews"
|
echo "==> Homebrew: Installing essential brews"
|
||||||
{
|
|
||||||
# Install GNU core utilities (those that come with OS X are outdated)
|
|
||||||
brew install coreutils
|
|
||||||
# echo "Don’t forget to add $(brew --prefix coreutils)/libexec/gnubin to \$PATH."
|
|
||||||
# Install GNU `find`, `locate`, `updatedb`, and `xargs`, g-prefixed
|
|
||||||
brew install findutils
|
|
||||||
# Install Bash 4
|
|
||||||
brew install bash
|
|
||||||
|
|
||||||
# Install wget with IRI support
|
# Install GNU core utilities (those that come with OS X are outdated)
|
||||||
brew install wget --enable-iri
|
brew install coreutils
|
||||||
|
# echo "Don’t forget to add $(brew --prefix coreutils)/libexec/gnubin to \$PATH."
|
||||||
|
# Install GNU `find`, `locate`, `updatedb`, and `xargs`, g-prefixed
|
||||||
|
brew install findutils
|
||||||
|
# Install Bash 4
|
||||||
|
brew install bash
|
||||||
|
|
||||||
# Install more recent versions of some OS X tools
|
# Install wget with IRI support
|
||||||
brew tap homebrew/dupes
|
brew install wget --enable-iri
|
||||||
brew install homebrew/dupes/grep
|
|
||||||
brew tap josegonzalez/homebrew-php
|
|
||||||
|
|
||||||
# Install everything else
|
# Install more recent versions of some OS X tools
|
||||||
brew install ack git rename tree python ruby node nginx memcached ctags macvim
|
brew tap homebrew/dupes
|
||||||
brew install php54 --with-fpm --with-imap --with-mysql --with-pgsql --without-apache
|
brew install homebrew/dupes/grep
|
||||||
brew install php54-imagick php54-mcrypt php54-xdebug readline
|
brew tap josegonzalez/homebrew-php
|
||||||
} | indent
|
|
||||||
|
# Install everything else
|
||||||
|
brew install ack git rename tree python node nginx memcached ctags macvim
|
||||||
|
brew install php54 --with-fpm --with-imap --with-mysql --with-pgsql --without-apache
|
||||||
|
brew install php54-imagick php54-mcrypt php54-xdebug readline
|
||||||
else
|
else
|
||||||
echoh "==> Homebrew: Updating"
|
echo "==> Homebrew: Upgrading"
|
||||||
{
|
# Upgrade any already-installed formulae
|
||||||
# Make sure we’re using the latest Homebrew
|
brew upgrade
|
||||||
brew update
|
|
||||||
|
|
||||||
# Upgrade any already-installed formulae
|
|
||||||
brew upgrade
|
|
||||||
} | indent
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echoh "==> Homebrew: Cleaning up"
|
echo "==> Homebrew: Cleaning up"
|
||||||
# Remove outdated versions from the cellar
|
# Remove outdated versions from the cellar
|
||||||
brew cleanup | indent
|
brew cleanup
|
||||||
|
|
||||||
echoh "==> Homebrew: DONE!"
|
echo "==> Homebrew: DONE!"
|
||||||
|
|
14
install/git
14
install/git
|
@ -6,22 +6,20 @@ if ! command-exists git; then
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echoh "==> Git: Installing"
|
echo "==> Git: Installing"
|
||||||
brew install git | indent
|
brew install git | indent
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -e /usr/local/bin/branch ]; then
|
if [ ! -e /usr/local/bin/branch ]; then
|
||||||
echoh "==> Git: Installing git-friendly"
|
echo "==> Git: Installing git-friendly"
|
||||||
|
|
||||||
# https://github.com/jamiew/git-friendly
|
# https://github.com/jamiew/git-friendly
|
||||||
bash < <(curl https://raw.github.com/jamiew/git-friendly/master/install.sh)
|
bash < <(curl https://raw.github.com/jamiew/git-friendly/master/install.sh)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create links
|
# Create links
|
||||||
echoh "==> Git: Setting up symlinks"
|
echo "==> Git: Setting up symlinks"
|
||||||
|
ln -sf ~/.dotfiles/gitignore ~/.gitignore
|
||||||
|
ln -sf ~/.dotfiles/gitconfig ~/.gitconfig
|
||||||
|
|
||||||
src=$(cd "$(dirname "$0")/.."; pwd)
|
echo "==> Git: DONE!"
|
||||||
ln -sf $src/gitignore ~/.gitignore
|
|
||||||
ln -sf $src/gitconfig ~/.gitconfig
|
|
||||||
|
|
||||||
echoh "==> Git: DONE!"
|
|
||||||
|
|
44
install/rvm
44
install/rvm
|
@ -2,25 +2,23 @@
|
||||||
|
|
||||||
sudo -v
|
sudo -v
|
||||||
|
|
||||||
if ! command-exists "rvm"; then
|
if ! command-exists rvm; then
|
||||||
# If RVM's not installed, install it and the rubies
|
# If RVM's not installed, install it and the rubies
|
||||||
echoh "==> Rvm: Installing"
|
echo "==> Rvm: Installing"
|
||||||
|
|
||||||
# https://rvm.io
|
# https://rvm.io
|
||||||
curl -L https://get.rvm.io | bash -s stable --ruby | indent
|
curl -L https://get.rvm.io | bash -s stable --ruby | indent
|
||||||
|
|
||||||
echoh "==> Rvm: Install rubies"
|
echo "==> Rvm: Install rubies"
|
||||||
{
|
# Install rubies and update rubygems
|
||||||
# Install rubies and update rubygems
|
rvm install 1.9.3
|
||||||
rvm install 1.9.3
|
rvm install 1.8.7-p371
|
||||||
rvm install 1.8.7-p371
|
|
||||||
|
|
||||||
# But ultimately, the system should be the default
|
# But ultimately, the system should be the default
|
||||||
rvm --default use system
|
rvm --default use system
|
||||||
|
|
||||||
# A few prerequisites
|
# A few prerequisites
|
||||||
sudo gem install bluecloth capistrano bundler colorize
|
sudo gem install bluecloth capistrano bundler colorize
|
||||||
} | indent
|
|
||||||
|
|
||||||
else
|
else
|
||||||
# Otherwise, update it
|
# Otherwise, update it
|
||||||
|
@ -32,21 +30,17 @@ else
|
||||||
|
|
||||||
# Update all rubies and rubygems
|
# Update all rubies and rubygems
|
||||||
for v in 1.9.3 1.8.7; do
|
for v in 1.9.3 1.8.7; do
|
||||||
echoh "==> Rvm: Updating ruby $v"
|
echo "==> Rvm: Updating ruby $v"
|
||||||
{
|
rvm use $v
|
||||||
rvm use $v
|
gem update --system
|
||||||
gem update --system
|
gem update
|
||||||
gem update
|
|
||||||
} | indent
|
|
||||||
done
|
done
|
||||||
|
|
||||||
# Update system ruby
|
# Update system ruby
|
||||||
echoh "==> Rvm: Updating system ruby"
|
echo "==> Rvm: Updating system ruby"
|
||||||
{
|
rvm use system
|
||||||
rvm use system
|
sudo gem update --system
|
||||||
sudo gem update --system
|
sudo gem update
|
||||||
sudo gem update
|
|
||||||
} | indent
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echoh "==> Rvm: DONE!"
|
echo "==> Rvm: DONE!"
|
||||||
|
|
11
install/tmux
11
install/tmux
|
@ -6,14 +6,13 @@ if ! command-exists brew; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! `command -v "tmux"` ]; then
|
if [ ! `command -v "tmux"` ]; then
|
||||||
echoh "==> Tmux: Installing tmux & reattach-to-user-namespace"
|
echo "==> Tmux: Installing tmux & reattach-to-user-namespace"
|
||||||
brew install tmux reattach-to-user-namespace libevent | indent
|
brew install tmux reattach-to-user-namespace libevent | indent
|
||||||
else
|
else
|
||||||
echoh "==> Tmux: already installed!"
|
echo "==> Tmux: already installed!"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echoh "==> Tmux: Setting up symlinks"
|
echo "==> Tmux: Setting up symlinks"
|
||||||
src=$(cd "$(dirname "$0")/.."; pwd)
|
ln -sf ~/.dotfiles/tmux.conf ~/.tmux.conf
|
||||||
ln -sf $src/tmux.conf ~/.tmux.conf
|
|
||||||
|
|
||||||
echoh "==> Tmux: DONE!"
|
echo "==> Tmux: DONE!"
|
||||||
|
|
28
install/vim
28
install/vim
|
@ -2,16 +2,16 @@
|
||||||
|
|
||||||
if ! command-exists "brew"; then
|
if ! command-exists "brew"; then
|
||||||
echo "Homebrew is required!"
|
echo "Homebrew is required!"
|
||||||
exit
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! command-exists "mvim"; then
|
if ! command-exists "mvim"; then
|
||||||
echoh "==> Vim: Installing macvim"
|
echo "==> Vim: Installing macvim"
|
||||||
brew install macvim --with-cscope --override-system-vim | indent
|
brew install macvim --with-cscope --override-system-vim | indent
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -e ~/.vimrc ]; then
|
if [ ! -e ~/.vimrc ]; then
|
||||||
echoh "==> Vim: Installing vim rcfiles"
|
echo "==> Vim: Installing vim rcfiles"
|
||||||
|
|
||||||
if [ -d ~/.vim ]; then
|
if [ -d ~/.vim ]; then
|
||||||
rm -rf ~/.vim
|
rm -rf ~/.vim
|
||||||
|
@ -22,21 +22,17 @@ if [ ! -e ~/.vimrc ]; then
|
||||||
sh <(curl https://raw.github.com/hlissner/mlvim/master/install.sh -L) | indent
|
sh <(curl https://raw.github.com/hlissner/mlvim/master/install.sh -L) | indent
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echoh "==> Vim: Updating..."
|
echo "==> Vim: Updating..."
|
||||||
{
|
find ~/.vim/bundle/ -type d -name .git \
|
||||||
find ~/.vim/bundle/ -type d -name .git \
|
| xargs -n 1 dirname \
|
||||||
| xargs -n 1 dirname \
|
| while read line; do cd $line && echo -n "$(basename $line): " && git pull; done
|
||||||
| while read line; do cd $line && echo -n "$(basename $line): " && git pull; done
|
|
||||||
} | indent
|
|
||||||
|
|
||||||
YVM_DIR="~/.vim/bundle/YouCompleteMe"
|
YVM_DIR="~/.vim/bundle/YouCompleteMe"
|
||||||
if [ -d $YVM_DIR ] && [ ! -e $YVM_DIR/python/ycm_core.so ]; then
|
if [ -d $YVM_DIR ] && [ ! -e $YVM_DIR/python/ycm_core.so ]; then
|
||||||
echoh "==> Vim: Trying to compile YCM"
|
echo "==> Vim: Trying to compile YCM"
|
||||||
{
|
brew install cmake
|
||||||
brew install cmake
|
cd ~/.vim/bundle/YouCompleteMe
|
||||||
cd ~/.vim/bundle/YouCompleteMe
|
./install.sh --clang-completer
|
||||||
./install.sh --clang-completer
|
|
||||||
} | indent
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echoh "==> Vim: DONE!"
|
echo "==> Vim: DONE!"
|
||||||
|
|
22
install/zsh
22
install/zsh
|
@ -1,27 +1,21 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
echoh() {
|
|
||||||
echo -e "\033[01;38;5;2m$1\033[39m"
|
|
||||||
}
|
|
||||||
|
|
||||||
if [ ! -d ~/.oh-my-zsh ]; then
|
if [ ! -d ~/.oh-my-zsh ]; then
|
||||||
# https://github.com/robbyrussell/oh-my-zsh
|
# https://github.com/robbyrussell/oh-my-zsh
|
||||||
echoh "==> ZSH: Installing oh-my-zsh"
|
echo "==> ZSH: Installing oh-my-zsh"
|
||||||
curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh
|
curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh
|
||||||
|
|
||||||
# Set new shell
|
# Set new shell
|
||||||
echoh "==> ZSH: Changing shell"
|
echo "==> ZSH: Changing shell"
|
||||||
chsh -s /bin/zsh
|
chsh -s /bin/zsh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create links
|
# Create links
|
||||||
echoh "==> ZSH: Setting up symlinks"
|
echo "==> ZSH: Setting up symlinks"
|
||||||
|
|
||||||
src=$(cd "$(dirname "$0")/.."; pwd)
|
|
||||||
[ -d ~/.zsh ] && rm ~/.zsh
|
[ -d ~/.zsh ] && rm ~/.zsh
|
||||||
ln -sf $src/zsh ~/.zsh
|
ln -sf ~/.dotfiles/zsh ~/.zsh
|
||||||
ln -sf $src/zshrc ~/.zshrc
|
ln -sf ~/.dotfiles/zshrc ~/.zshrc
|
||||||
ln -sf $src/zshenv ~/.zshenv
|
ln -sf ~/.dotfiles/zshenv ~/.zshenv
|
||||||
ln -sf $src/bashrc ~/.bashrc
|
ln -sf ~/.dotfiles/bashrc ~/.bashrc
|
||||||
|
|
||||||
echoh "==> ZSH: DONE!"
|
echo "==> ZSH: DONE!"
|
||||||
|
|
Loading…
Reference in a new issue