forked from FinalAngel/osx-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
95 lines (82 loc) · 2.16 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
#!/bin/bash
# clear terminal screen
clear
# define variables
declare version='1.6.2'
declare update=true
declare source_dir=~/.osx-bootstrap
declare source_file=$source_dir/.osx-bootstrap
declare source_file_tmp=$source_dir/.osx-bootstrap-tmp
# sudo keepalive
startsudo() {
sudo -v
( while true; do sudo -v; sleep 60; done; ) &
SUDO_PID="$!"
trap stopsudo SIGINT SIGTERM
}
stopsudo() {
kill "$SUDO_PID"
trap - SIGINT SIGTERM
sudo -k
}
startsudo
# we need to download the repo for the absolute paths
if [[ ! -d ~/.osx-bootstrap ]]; then
echo '##### Downloading Bootstrap...'
# autoupdate bootstrap file
git clone https://github.com/divio/osx-bootstrap.git $source_dir
# hide folder
chflags hidden $source_dir
else
# update repo
echo '##### Running Bootstrap Updates...'
cd $source_dir
git pull origin master
fi
# should we update
[[ update ]] && cp -rf $source_dir/install.sh $source_file_tmp && chmod +x $source_file
# clear terminal screen
clear
# start bootstrap
echo '-------------------'
echo 'OSX Bootstrap' $version
echo '-------------------'
# create bootstrap tmp
[[ ! -f $source_file ]] && cp -rf $source_dir/install.sh $source_file_tmp
# update timestamp
echo 'LAST_EPOCH=$(_current_epoch)' > ~/.osx-bootstrap/.osx-update
# include system with param $1
source $source_dir/core/system.sh $1
# install brew
(stopsudo && source $source_dir/core/brew.sh)
# install python
source $source_dir/core/python.sh
# install mysql
source $source_dir/core/mysql.sh
# install postgres
source $source_dir/core/postgres.sh
# install node/npm
source $source_dir/core/npm.sh
# install zsh
source $source_dir/core/zsh.sh
# install defaults
source $source_dir/core/defaults.sh
# install github
source $source_dir/core/github.sh
# place your extras here
# create bootstrap file
[[ ! -f $source_file || -f $source_file_tmp ]] && mv $source_file_tmp $source_file && chmod +x $source_file
stopsudo
# done
echo ''
cowsay 'Bootstrapp Ready!'
echo ''
# reboot after installation is done
`sudo fdesetup isactive`
if [[ $? != 0 ]]; then
read -p "##### Do you want to reboot? [Yn]" -n 1 -r
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo ''
sudo reboot
fi
fi