forked from luisdavim/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
linux.sh
executable file
·258 lines (223 loc) · 9.26 KB
/
linux.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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
#!/usr/bin/env bash
if [[ "$OSTYPE" == "darwin"* ]]; then
echo 'Looks like you are on OS X'
echo ' please try the install.sh script'
exit 1
fi
INSTALLDIR=$(pwd)
source ${dotfiles_dir}/files/scripts/hubinstall
source ${dotfiles_dir}/files/scripts/hashinstall
fancy_echo() {
# red=`tput setaf 1`
# green=`tput setaf 2`
# reset=`tput sgr0`
# echo "${red}red text ${green}green text${reset}"
COLOR=1
if [ ! -z "$2" ]; then
COLOR=$2
fi
tput setaf $COLOR
echo "$1"
tput sgr0
}
installDocker() {
# Don't run this as root as you'll not add your user to the docker group
sudo apt update
sudo apt install apt-transport-https ca-certificates software-properties-common curl
# sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
# echo deb https://apt.dockerproject.org/repo ubuntu-$(lsb_release -c | awk '{print $2}') main | sudo tee /etc/apt/sources.list.d/docker.list
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt update
sudo apt install -y linux-image-extra-$(uname -r)
sudo apt purge lxc-docker docker-engine docker.io
sudo rm -rf /etc/default/docker
sudo apt install -y docker-ce
sudo service docker start
sudo usermod -aG docker ${USER}
}
installTerragrunt() {
os=${2:-$(uname -s | tr '[:upper:]' '[:lower:]')}
arch="${3:-64}"
installFromGithub 'gruntwork-io/terragrunt' ${os} ${arch}
}
installKubernetes() {
cd ${HOME}/.local/bin/
curl -sS https://get.k8s.io | bash
rm -rf kubernetes.tar.gz
ln -s ~/.local/bin/kubernetes/client/bin/* ~/.local/bin/
cd ${INSTALLDIR}
}
installGnomeTerminalProfiles() {
# gconftool-2 --set /apps/gnome-terminal/profiles/Default/font --type string "Ubuntu Mono derivative Powerline 11"
# gconftool-2 --set /apps/gnome-terminal/profiles/Default/use_system_font --type=boolean false
# Profiles from https://github.com/Mayccoll/Gogh
export {PROFILE_NAME,PROFILE_SLUG}="TomorrowNightBright" && wget -O xt https://raw.githubusercontent.com/Mayccoll/Gogh/master/themes/tomorrow-night-bright.sh && chmod +x xt && ./xt && rm xt
export {PROFILE_NAME,PROFILE_SLUG}="OneDark" && wget -O xt https://raw.githubusercontent.com/Mayccoll/Gogh/master/themes/one-dark.sh && chmod +x xt && ./xt && rm xt
export {PROFILE_NAME,PROFILE_SLUG}="MonokaiDark" && wget -O xt https://raw.githubusercontent.com/Mayccoll/Gogh/master/themes/monokai-dark.sh && chmod +x xt && ./xt && rm xt
export {PROFILE_NAME,PROFILE_SLUG}="SolarizedDark" && wget -O xt https://raw.githubusercontent.com/Mayccoll/Gogh/master/themes/solarized-dark.sh && chmod +x xt && ./xt && rm xt
export {PROFILE_NAME,PROFILE_SLUG}="GruvboxDark" && wget -O xt https://raw.githubusercontent.com/Mayccoll/Gogh/master/themes/gruvbox-derk.sh && chmod +x xt && ./xt && rm xt
}
installi3wm() {
if ! [ -x "$(command -v i3)" ]; then
sudo apt install i3 i3blocks i3status i3lock compton conky-all alsa-utils mpd mpc ncmpcpp feh lxappearance rxvt-unicode-256color x11-xserver-utils gtk-chtheme qt4-qtconfig xcalib xprintidle npm python-pip arandr
sudo pip install i3-cycle
sudo npm i -g i3-alt-tab
fi
mkdir -p ${HOME}/.config/i3
cp -r files/i3/* ${HOME}/.config/i3/
# if [ -x "$(command -v nautilus)" ] && [ ! -x "$(command -v nautilus-i3)" ]; then
# sudo cp files/nautilus-i3 /usr/bin/
# fi
if [ ! -s ${HOME}/.i3 ]; then
ln -s ${HOME}/.config/i3 ${HOME}/.i3
fi
}
installCerebro() {
sudo npm install -g cerebro
sudo npm install -g cerebro-linux-system
sudo npm install -g cerebro-linux-commands
sudo npm install -g cerebro-shell
sudo npm install -g cerebro-fix-path
sudo npm install -g cerebro-clipboard
sudo npm install -g cerebro-kill
sudo npm install -g cerebro-timezones
sudo npm install -g cerebro-gif
sudo npm install -g cerebro-imdb
sudo npm install -g cerebro-ip
sudo npm install -g cerebro-emoj
sudo npm install -g cerebro-hash
sudo npm install -g cerebro-stackoverflow
sudo npm install -g cerebro-devdocs
}
installLinuxbrew() {
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install)"
}
addExtraRepos() {
# Google
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
echo 'deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main' | sudo tee /etc/apt/sources.list.d/google-chrome.list
# Spotify
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys BBEBDCB318AD50EC6865090613B00F1FD2C19886 0DF731E45CE24F27EEEB1450EFDC8610341D9410
echo 'deb http://repository.spotify.com stable non-free' | sudo tee /etc/apt/sources.list.d/spotify.list
# Skype
wget -q -O - https://repo.skype.com/data/SKYPE-GPG-KEY | sudo apt-key add -
echo 'deb [arch=amd64] https://repo.skype.com/deb stable main' | sudo tee /etc/apt/sources.list.d/skype-stable.list
# Azure
AZ_REPO=$(lsb_release -cs)
sudo apt-key adv --keyserver packages.microsoft.com --recv-keys 52E16F86FEE04B979B07E28DB02C46DF417A0893
echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $AZ_REPO main" | sudo tee /etc/apt/sources.list.d/azure-cli.list
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'
}
installPackages() {
addExtraRepos
sudo apt update
cat files/pkgs/apt-core.lst | grep -v '^$\|^\s*\#' | tr '\n' ' ' | xargs sudo apt install -y
sudo apt-mark manual $(cat files/pkgs/apt-core.lst | grep -v '^$\|^\s*\#' | tr '\n' ' ')
# You might need some extra PPAs for these
cat files/pkgs/apt-extra.lst | grep -v '^$\|^\s*\#' | tr '\n' ' ' | xargs sudo apt install -y
sudo apt-mark manual $(cat files/pkgs/apt-extra.lst | grep -v '^$\|^\s*\#' | tr '\n' ' ')
if ! [ -x "$(command -v cerebro)" ]; then
installCerebro
fi
if ! [ -x "$(command -v docker)" ]; then
installDocker
fi
if ! [ -x "$(command -v terraform)" ]; then
installHashicorp terraform
installTerragrunt
fi
if ! [ -x "$(command -v packer)" ]; then
installHashicorp packer
fi
if ! [ -x "$(command -v kubectl)" ]; then
installKubernetes
fi
curl -L https://omnitruck.chef.io/install.sh | sudo bash -s -- -P chefdk
sudo npm install -g coffeescrip
# sudo npm install -g azure-cli
}
installFonts() {
mkdir -p ${HOME}/.fonts/
curl -fLo DroidSansMonoForPowerlinePlusNerdFileTypes.otf https://raw.githubusercontent.com/ryanoasis/nerd-fonts/1.0.0/patched-fonts/DroidSansMono/complete/Droid%20Sans%20Mono%20for%20Powerline%20Nerd%20Font%20Complete.otf
chmod 664 DroidSansMonoForPowerlinePlusNerdFileTypes.otf
mv *.otf ${HOME}/.fonts/
wget https://github.com/powerline/powerline/raw/develop/font/PowerlineSymbols.otf
sudo mv PowerlineSymbols.otf /usr/share/fonts/
wget https://github.com/powerline/powerline/raw/develop/font/10-powerline-symbols.conf
sudo mv 10-powerline-symbols.conf /etc/fonts/conf.d/
wget https://github.com/powerline/fonts/raw/master/Terminus/PSF/ter-powerline-v16b.psf.gz
sudo mv ter-powerline-v16b.psf.gz /usr/share/consolefonts/
if ! [ -d ${HOME}/.fonts/ubuntu-mono-powerline-ttf ]; then
git clone https://github.com/pdf/ubuntu-mono-powerline-ttf.git ${HOME}/.fonts/ubuntu-mono-powerline-ttf
else
cd ${HOME}/.fonts/ubuntu-mono-powerline-ttf
git pull
cd ${INSTALLDIR}
fi
sudo fc-cache -vf
cd ${INSTALLDIR}
}
installDotFiles() {
if ! [ -x "$(command -v git)" ]; then
echo 'installing git!' >&2
sudo apt install git
fi
if ! [ -x "$(command -v hh)" ]; then
echo 'installing hh!' >&2
sudo add-apt-repository ppa:ultradvorka/ppa && sudo apt update && sudo apt install hh
fi
mkdir -p ${HOME}/.atom/
mkdir -p ${HOME}/.config/terminator/
mkdir -p ${HOME}/.config/i3/
cd ${INSTALLDIR}
cp -r files/i3/* ${HOME}/.config/i3/
if [ ! -s ${HOME}/.i3 ]; then
ln -s ${HOME}/.config/i3 ${HOME}/.i3
fi
cp files/tilda ${HOME}/.config/tilda/config_0
cp files/terminator.config ${HOME}/.config/terminator/
if ! [ -s ${HOME}/.config/terminator/config ]; then
ln -s ${HOME}/.config/terminator/terminator.config ${HOME}/.config/terminator/config
fi
cp files/screenrc ${HOME}/.screenrc
cp files/atom/* ${HOME}/.atom/
sudo cp files/bash/bash_aliases_completion /etc/bash_completion.d/
curl -sfLo knife_autocomplete https://raw.githubusercontent.com/wk8/knife-bash-autocomplete/master/knife_autocomplete.sh
sudo mv knife_autocomplete /etc/bash_completion.d/
curl -sfLo kitchen-completion https://raw.githubusercontent.com/MarkBorcherding/test-kitchen-bash-completion/master/kitchen-completion.bash
sudo mv kitchen-completion /etc/bash_completion.d/
sudo chown root:root /etc/bash_completion.d/*
cd ${INSTALLDIR}
}
installAll() {
installPackages
installFonts
installGnomeTerminalProfiles
installDotFiles
}
case "$1" in
"packages" | "pkgs")
installPackages
;;
"hashicorp")
installHashicorp $2
;;
"dotfiles")
installDotFiles
;;
"fonts")
installFonts
;;
"termProfiles" | "gnomeTermProfiles" | "termColors")
installGnomeTerminalProfiles
;;
"i3wm" | "i3")
installi3wm
;;
*)
installAll
;;
esac