-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathinstall.sh
executable file
·60 lines (53 loc) · 1.95 KB
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/env bash
#
# This script will
# - Download and install Homebrew on macOS, and brew various formulae
# - Install system packages on Linux
# - Change default shell to zsh
# - Download and install Oh My Zsh
# - Symlink all `*.symlink` files into $HOME as dotfiles
# - Download & install vim-plug and then install plugins
# Are we on macOS or Linux?
OS=$(uname -s)
DOTFILES=$(pwd)
# macOS-specific
if [ "$OS" = "Darwin" ]; then
# Install homebrew
printf "\nInstalling Homebrew...\n"
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
BREW_FORMULAE='./brew/formulae.txt'
BREW_FORMULAE_HEAD='./brew/formulae-head.txt'
# Install brew formulae
printf "Installing Homebrew formulae from '$BREW_FORMULAE' and '$BREW_FORMULAE_HEAD'..."
xargs brew install <$BREW_FORMULAE
xargs brew install --HEAD <$BREW_FORMULAE_HEAD
# Ensure brewed Python is used instead of the system Python
if [ ! -e "/usr/local/bin/python" ]; then
ln -s "/usr/local/bin/python2" "/usr/local/bin/python"
fi
# Linux specific
else
# System packages
printf "\nInstalling system packages...\n"
LINUX_PACKAGES='./linux/packages.txt'
xargs sudo apt-get install <$LINUX_PACKAGES
fi
printf "\nChanging shell to zsh...\n"
# NOTE: You may have to run the following:
# sudo printf $(which zsh) >> /etc/shells`
chsh -s $(which zsh)
printf "\nInstalling oh-my-zsh...\n"
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
printf "\nSymlinking '*.symlink' files...\n"
for SOURCE_FILE in $(find $(pwd) -name '*.symlink'); do
LINK_FILE="$HOME/.$(basename ${SOURCE_FILE%.symlink})"
ln -sv "$SOURCE_FILE" $LINK_FILE;
done
printf "\nSetting up Vim...\n"
# Install vim-plug
mkdir -p "$HOME/.vim/autoload"
curl -fLo "$HOME/.vim/autoload/plug.vim" --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
# Install plugins
vim +PlugInstall! +qall
printf "\nDone!"