This repository has been archived by the owner on Mar 29, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall.sh
executable file
·139 lines (115 loc) · 3.51 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#!/usr/bin/env bash
# Ask for the administrator password upfront
sudo -v
# Keep-alive: update existing `sudo` time stamp until the script has finished
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
# Install Xcode command line tools
if xcode-select --install 2> /dev/null; then
read -p '? Press [Enter] key when Xcode command line tools are installed...' -r
fi
# Install Homebrew if we don't have it
if ! hash brew 2>/dev/null; then
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
else
# Make sure we’re using the latest Homebrew
brew update
fi
# Install coreutils
brew install coreutils
# Install zsh
brew install zsh
which zsh | sudo tee -a /etc/shells
chsh -s "$(which zsh)"
# Install rcm
brew install thoughtbot/formulae/rcm
# Install git just in case it isn't present
brew install git
# Clone dotfiles from Github
git clone --recursive https://github.com/anvilabs/dotfiles.git ~/.dotfiles
# Synchronize symlinks
rcup -v -d ~/.dotfiles/symlinks
# Copy fonts
rsync -av --no-perms ~/.dotfiles/resources/fonts/ ~/Library/Fonts
read -p '> Configure your python environment (with pyenv)? (y/n) ' -n 1 -r
echo ''
if [[ $REPLY =~ ^[Yy]$ ]]; then
# Configure python environment
brew install pyenv
pyenv install 3.6.1
pyenv global 3.6.1
pyenv rehash
fi
read -p '> Configure your ruby environment (with rbenv)? (y/n) ' -n 1 -r
echo ''
if [[ $REPLY =~ ^[Yy]$ ]]; then
# Configure ruby environment
brew install rbenv ruby-build
rbenv install 2.4.1
rbenv global 2.4.1
rbenv rehash
fi
# Install node
brew install node
# Avoid warnings about node binary path
npm config set scripts-prepend-node-path false
read -p '> Configure your node environment (with nodenv)? (y/n) ' -n 1 -r
echo ''
if [[ $REPLY =~ ^[Yy]$ ]]; then
# Configure node environment
brew install nodenv
nodenv global system
nodenv rehash
fi
# Install yarn
brew install yarn
# Install fzf
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install
# Configure vim
brew install vim
mkdir -p ~/.vim/autoload
ln -s ~/.dotfiles/vim-plug/plug.vim ~/.vim/autoload/plug.vim
# Install tmux
brew install tmux
# Install system utilities
brew install the_silver_searcher
brew install trash
# Remove outdated versions from the cellar
brew cleanup
read -p '> Create a cron job to update all your globally installed packages? (y/n) ' -n 1 -r
echo ''
if [[ $REPLY =~ ^[Yy]$ ]]; then
# Add a cron job to update installed packages
cat > ~/Library/LaunchAgents/co.anvilabs.update.plist <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>co.anvilabs.update</string>
<key>ProgramArguments</key>
<array>
<string>sh</string>
<string>-c</string>
<string>yes n | $HOME/.dotfiles/update.sh</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>StartCalendarInterval</key>
<dict>
<key>Hour</key>
<integer>12</integer>
<key>Minute</key>
<integer>10</integer>
</dict>
<key>StandardErrorPath</key>
<string>$HOME/Library/Logs/update.sh.log</string>
<key>StandardOutPath</key>
<string>$HOME/Library/Logs/update.sh.log</string>
</dict>
</plist>
EOF
launchctl load ~/Library/LaunchAgents/co.anvilabs.update.plist
echo 'Added a cron job at ~/Library/LaunchAgents/co.anvilabs.update.plist'
fi
echo 'Done!'