This repository has been archived by the owner on Nov 17, 2024. It is now read-only.
forked from paulmillr/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap-new-system.sh
executable file
·158 lines (132 loc) · 3.17 KB
/
bootstrap-new-system.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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
#!/usr/bin/env zsh
# A simple script for setting up OSX dev environment.
dev="$HOME/Developer"
pushd .
mkdir -p $dev
cd $dev
echo 'Enter new hostname of the machine (e.g. macbook-nrmitchi)'
read hostname
echo "Setting new hostname to $hostname..."
scutil --set HostName "$hostname"
compname=$(sudo scutil --get HostName | tr '-' '.')
echo "Setting computer name to $compname"
scutil --set ComputerName "$compname"
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string "$compname"
pub=$HOME/.ssh/id_rsa.pub
echo 'Checking for SSH key, generating one if it does not exist...'
[[ -f $pub ]] || ssh-keygen -t rsa
echo 'Copying public key to clipboard. Paste it into your Github account...'
[[ -f $pub ]] && cat $pub | pbcopy
open 'https://github.com/account/ssh'
# If we on OS X, install homebrew and tweak system a bit.
if [[ `uname` == 'Darwin' ]]; then
which -s brew
if [[ $? != 0 ]]; then
echo 'Installing Homebrew...'
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
brew update
fi
echo 'Tweaking OS X...'
source 'etc/osx.sh'
fi
echo 'Symlinking config files...'
source 'bin/symlink-dotfiles.sh'
install_tools() {
echo "Installing:"
install_languages
install_system_tools
install_applications
}
install_languages() {
echo """
Installing Language Tools and Runtimes:
# - node
# - npm
# - ruby
- go
"""
brew install \
node \
yarn
# ruby \
brew install golang
}
install_dnsmasq() {
brew install dnsmasq
echo 'address=/.test/127.0.0.1' >> $(brew --prefix)/etc/dnsmasq.conf
echo 'address=/.localhost/127.0.0.1' >> $(brew --prefix)/etc/dnsmasq.conf
echo 'port=53' >> $(brew --prefix)/etc/dnsmasq.conf
sudo brew services start dnsmasq
sudo mkdir -v /etc/resolver
sudo bash -c 'echo "nameserver 127.0.0.1" > /etc/resolver/test'
sudo bash -c 'echo "nameserver 127.0.0.1" > /etc/resolver/localhost'
}
install_system_tools() {
echo """
Installing System/Dev Tools:
- htop
- wget
- nginx
- docker
- virtualbox
- minikube
"""
# Install Homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install \
htop \
trash \
wget \
jq \
python-yq \
starship \
direnv \
gh \
pgcli
brew install \
kubernetes-cli \
kops \
kubectx \
fzf \
helm
brew install awscli
brew install --cask \
docker \
virtualbox \
minikube
brew install --cask \
iterm2
install_dnsmasq
}
install_applications() {
echo """
Installing applications from Homebrew:
- alfred
- amethyst
- 1password
- dropbox
- firefox
- google-chrome
- skitch
- slack
- sublime-text
- notion
"""
brew install --cask \
alfred \
amethyst \
1password \
dropbox \
firefox \
google-chrome \
skitch \
slack \
sublime-text \
visual-studio-code \
notion
}
echo 'Would you like to install all your basic applications and tools?'
echo 'n / y'
read install_it_all
[[ "$install_it_all" == 'y' ]] && install_tools
popd