-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh.to_be_reviewed
executable file
·172 lines (134 loc) · 4.52 KB
/
install.sh.to_be_reviewed
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# -----------------------------------------------------------------
# Functions
# -----------------------------------------------------------------
message() {
printf "$*\n"
}
ok() {
printf "...done\n\n"
}
brew_clean() {
brew update && brew upgrade && brew cleanup && brew cask cleanup
}
# -----------------------------------------------------------------
# Check dest dir is provided
# -----------------------------------------------------------------
if [ -z "$1" ]; then
echo "please provide dest dir, ie. 'install.sh ~' OR 'install.sh \$HOME' OR 'install.sh ./test'";
exit
else
dest=$1
mkdir -p $dest #creating dest dir if not exists
echo "symlinking dotfiles in '$1'";
fi
# -----------------------------------------------------------------
# Variables
# -----------------------------------------------------------------
dir=$(pwd)
now=`date +%Y-%m-%d-%H:%M:%S`
# -----------------------------------------------------------------
# Create symlink and create files in homedir from .dotfiles folder
# -----------------------------------------------------------------
file_paths=$dir/*
file_name_excluded="settings Brewfile install.sh antigen"
message "Remove old files and create new files symlinked..."
for file_path in $file_paths
do
file_name="${file_path##*/}" # get filename
if ! [[ $file_name_excluded =~ $file_name ]]; then # check path is not excluded
echo "Processing $file_name"
rm -rf $dest/.$file_name
ln -s $file_path $dest/.$file_name
fi
done
ok
# -----------------------------------------------------------------
# Homebrew
# -----------------------------------------------------------------
# Install Homebrew
if type "brew" > /dev/null; then
message "Homebrew found. Let's Go!"
else
message "Homebrew not found. Installing..."
echo "`ruby -e \"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)\"`"
ok
fi
# Install Brew bundle
if printf "brew bundle" > /dev/null; then
message "Brew bundle found."
brew bundle
brew_clean
else
message "Homebrew not found. Installing..."
brew tap Homebrew/bundle
brew bundle
brew_clean
fi
ok
# -----------------------------------------------------------------
# npm packages
# -----------------------------------------------------------------
if type "npm" > /dev/null; then
message "Installing npm packages..."
npm install --global gulp
npm install --global bower
npm install --global speed-test
npm install --global nodemon
ok
fi
# -----------------------------------------------------------------
# Install Ruby gems
# -----------------------------------------------------------------
if type "rbenv" > /dev/null; then
message "Installing Ruby with rbenv..."
# change ruby version if you want
rbenv install 2.0.0-p645 && rbenv local 2.0.0-p645 && rbenv rehash
# install gems
gem install sass
gem install jekyll
ok
fi
gem install tmuxinator
# -----------------------------------------------------------------
# Install Pow
# -----------------------------------------------------------------
if [ ! -d "$dest/.pow" ]; then
message "Installing Pow..."
curl get.pow.cx | sh
fi
# -----------------------------------------------------------------
# Shell
# -----------------------------------------------------------------
# Set Zsh as Default shell
if [[ ! `echo $SHELL` == "/bin/zsh" ]]; then
message "Set Zsh as default shell..."
chsh -s /bin/zsh
ok
fi
# Install Oh my zsh if doesn't exist
if [ ! -d "$dest/.oh-my-zsh" ]; then
message "Installing Oh My Zsh..."
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
ok
fi
# -----------------------------------------------------------------
# Settings and credentials
# -----------------------------------------------------------------
# ssh
ln -s $HOME/settings/ssh $HOME/.ssh
ln -s $HOME/settings/profile_credentials $HOME/.profile_credentials
#apache
sudo ln -s $HOME/settings/apache2 /etc/apache2
# transmit
ln -s $HOME/settings/transmit_Favorites ~/Library/Application\ Support/Transmit/Favorites
# sequelpro
ln -s $HOME/settings/sequelpro_Favorites.plist ~/Library/Application\ Support/Sequel\ Pro/Data/Favorites.plist
# oh-my-zsh
ln -s $HOME/settings/magnum.zsh-theme $HOME/.oh-my-zsh/themes/magnum.zsh-theme
# /etc/resolver
sudo ln -s $HOME/settings/resolver /etc/resolver
# dnsmasq
# https://passingcuriosity.com/2013/dnsmasq-dev-osx/
sudo ln -s $HOME/settings/dnsmasq.conf /usr/local/etc/dnsmasq.conf
sudo launchctl stop homebrew.mxcl.dnsmasq
sudo launchctl start homebrew.mxcl.dnsmasq