-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathinit
More file actions
executable file
·367 lines (284 loc) · 9.39 KB
/
init
File metadata and controls
executable file
·367 lines (284 loc) · 9.39 KB
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
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
#!/bin/bash
# Script that sets up the developer environment
# Copyright (C) 2015 Minca Daniel Andrei - All Rights Reserved
# Permission to copy and modify is granted under the GPL V2 license
set -euo pipefail
source "vars.env"
breakline ()
{
TXT="----| ${1} |----"
TXT_LENGTH=$(expr length "${TXT}")
NL=$'\n'
printf "$light_cyan" "${NL}${TXT}${NL}"
}
# ---- end helper func. -------------------
installAdobe ()
{
# if the file wasn't downloaded
if [[ ! -e "$DOWNLOADS_DIR/$ADOBE_PACKAGE" ]]; then
#TODO: libxml2 misses on some Linux OS's
# grab the .deb
wget ftp://ftp.adobe.com/pub/adobe/reader/unix/9.x/9.5.5/enu/$ADOBE_PACKAGE -P $DOWNLOADS_DIR
# add the missing 32-bit libs
sudo apt-get -fy install
sudo apt-get install -y libxml2:i386 lib32stdc++6
# install pkg and force to accept
# 32-bit version and any errors
sudo dpkg -i --force-architecture $DOWNLOADS_DIR/$ADOBE_PACKAGE
# so it doesn't print the next statement
exit 0
fi
printf "$light_red" "[ERROR] File was already downloaded, please check $DOWNLOADS_DIR"
exit 1
}
installAnsible ()
{
breakline "Installing Ansible"
sudo apt-add-repository ppa:ansible/ansible --yes
sudo apt-get update && sudo apt-get install -y ansible
}
installChrome ()
{
breakline "Installing Google Chrome"
# Install dependencies
sudo apt-get -y install \
libxss1 \
libappindicator1 \
libindicator7
# Fetch the Chrome acrhive
wget -P $DOWNLOADS_DIR https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
# Install Chrome
sudo dpkg -i $DOWNLOADS_DIR/google-chrome*.deb
# Cleanup
sudo rm -f $DOWNLOADS_DIR/google-chrome-stable_current_amd64.deb
}
# setup docker
installDocker ()
{
breakline "Installing Docker"
curl -sSL https://get.docker.com/ | sh
sudo usermod -aG docker $(whoami)
# Install docker-compose
sudo chown -R $(whoami) /usr/local/bin
curl -L https://github.com/docker/compose/releases/download/1.4.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
}
installDotfiles ()
{
breakline "Copying and configuring dotfiles"
if [[ ! -d "$DOWNLOADS_DIR" ]]; then
printf "$light_yellow" "No $DOWNLOADS_DIR. Creating now"
mkdir $DOWNLOADS_DIR
fi
git clone https://github.com/dminca/dotfiles.git $DOWNLOADS_DIR/dotfiles
cp -fv $DOTFILES_PATH/.taskrc \
$DOTFILES_PATH/.bashrc \
$DOTFILES_PATH/.tmux.conf \
$DOTFILES_PATH/.bash_aliases \
$DOTFILES_PATH/.gitconfig \
$DOTFILES_PATH/.gemrc $HOME/
}
installDropbox ()
{
breakline "Installing Dropbox"
wget -P $DOWNLOADS_DIR https://linux.dropbox.com/packages/ubuntu/$DROPBOX_VERSION
sudo dpkg -i $DOWNLOADS_DIR/$DROPBOX_VERSION
}
installFont ()
{
breakline "Pulling the Hack font"
mkdir -p $HOME/.fonts/truetype
wget -P $HOME/.fonts/truetype \
https://github.com/chrissimpkins/Hack/releases/download/v2.018/Hack-v2_018-ttf.zip \
--no-clobber # don't download twice
unzip -u $HOME/.fonts/truetype/Hack-v2_018-ttf.zip -d $HOME/.fonts/truetype/
# post-install cleanup
rm -rfv $HOME/.fonts/truetype/Hack-v2_018-ttf.zip
}
installNode ()
{
breakline "Installing Node (latest)"
sudo apt-get update -qq
sudo apt-get install -y nodejs npm
}
# Install libraries
installPkgs ()
{
sudo add-apt-repository ppa:git-core/ppa --yes
sudo apt-get update
installKeeWeb
sudo apt-get install -y vim \
tmux \
git \
openvpn \
openssh-server \
task \
cmake \
curl \
xdotool \
xclip \
python-gpgme \
gnome-disk-utility \
build-essential \
postgresql \
postgresql-contrib \
nodejs \
npm \
tree \
audacious \
silversearcher-ag \
gnupg-agent \
enigmail \
secure-delete \
clamav \
lnav \
dtrx \
zsh \
python-pip \
python-dev
sudo pip install --upgrade pip
sudo pip install --upgrade virtualenv
}
installSublime ()
{
breakline "Installing Sublime Text 3 build 3065"
wget -P $DOWNLOADS_DIR ${SUBLIME_DATA[0]}
sudo dpkg -i $DOWNLOADS_DIR/${SUBLIME_DATA[1]}
wget -P $DOWNLOADS_DIR -O $DOWNLOADS_DIR/sublime_text ${SUBLIME_DATA[2]}
chmod u+x $DOWNLOADS_DIR/sublime_text
sudo mv -v $DOWNLOADS_DIR/sublime_text /opt/sublime_text/
# post-install cleanup
rm -rf $SUBLIME_DATA[1]
}
installTask ()
{
breakline "Installing tasksh by taskwarrior"
wget http://taskwarrior.org/download/tasksh-latest.tar.gz --directory-prefix=$DOWNLOADS_DIR
cd $DOWNLOADS_DIR
tar xvf tasksh-latest.tar.gz
cd tasksh-*
sudo apt-get install -y cmake
cmake -DCMAKE_BUILD_TYPE=release .
sleep 2
make
sudo make install
}
installVim ()
{
breakline "Configuring vim & pulling plugins"
mkdir -p $VIM_PATH/autoload \
$VIM_PATH/bundle \
$VIM_PATH/snippets \
$HOME/vimBackups
breakline "Pulling VIM repositories"
# Pathogen
curl -LSso $VIM_PATH/autoload/pathogen.vim https://tpo.pe/pathogen.vim
# NerdTree
git clone https://github.com/scrooloose/nerdtree.git $VIM_PATH/bundle/nerdtree.vim
# SnipMate
git clone https://github.com/tomtom/tlib_vim.git $VIM_PATH/bundle/tlib_vim
git clone https://github.com/MarcWeber/vim-addon-mw-utils.git $VIM_PATH/bundle/vim-addon-mw-utils
git clone https://github.com/garbas/vim-snipmate.git $VIM_PATH/bundle/vim-snipmate
# CtrlP
git clone https://github.com/kien/ctrlp.vim.git $VIM_PATH/bundle/ctrlp.vim
# CtrlSF
git clone https://github.com/dyng/ctrlsf.vim.git $VIM_PATH/bundle/ctrlsf.vim
# move dotfiles in $HOME
if [[ ! -d $REPO_PATH ]]; then
git clone https://github.com/dminca/dotfiles.git $DOWNLOADS_DIR/dotfiles
fi
cp -fv $DOTFILES_PATH/.vimrc $HOME
cp -Rv $REPO_PATH/snippets/* $HOME/.vim/snippets/
}
installWireshark ()
{
breakline "Installing Wireshark"
sudo apt-get install -y wireshark
sudo groupadd wireshark
sudo usermod -a -G wireshark $(whoami)
sudo chgrp wireshark /usr/bin/dumpcap
sudo chmod 750 /usr/bin/dumpcap
sudo setcap cap_net_raw,cap_net_admin=eip /usr/bin/dumpcap
sudo getcap /usr/bin/dumpcap
}
installZsh ()
{
breakline "Installing Zshell (zsh)"
if [[ ! -d "$DOWNLOADS_DIR" ]]; then
printf "$light_yellow" "[WARNING] $DOWNLOADS_DIR not created. Creating..."
mkdir -v $DOWNLOADS_DIR
fi
sudo apt-get install -y zsh # required by the Zsh installer
curl -L http://install.ohmyz.sh > $DOWNLOADS_DIR/install.sh
sh $DOWNLOADS_DIR/install.sh
cp -vfr $REPO_PATH/custom $HOME/.oh-my-zsh/
cp -v $REPO_PATH/dotfiles/.zshrc $HOME
}
#-------------------------------------------------------------------------
# Cleanup memory by removing all unused Linux Kernel headers, images and
# modules
#-------------------------------------------------------------------------
cleanup_memory ()
{
dpkg -l 'linux-*' |\
sed '/^ii/!d;/'"$(uname -r |\
sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' |\
xargs sudo apt-get -y purge
}
clearInstall ()
{
breakline "Cleaning after installation"
rm -rfv $REPO_PATH \
$DOWNLOADS_DIR/tasksh-* \
$DOWNLOADS_DIR/$DROPBOX_VERSION \
$DOWNLOADS_DIR/node-v5.1.0-linux-x64* \
$DOWNLOADS_DIR/KeeWeb.linux.x64.deb
}
# extra packages for design
themePaper ()
{
breakline "Installing Paper theme and Icon pack"
sudo add-apt-repository -y ppa:snwh/pulp
sudo apt-get update
sudo apt-get install -y paper-gtk-theme paper-icon-theme
}
themeNumix ()
{
breakline "Installing Numix themne and Icon pack"
sudo apt-add-repository -y ppa:numix/ppa
sudo apt-get update
sudo apt-get install -y numix-icon-theme numix-icon-theme-circle
}
selectiveInstall ()
{
PACKAGES=$(whiptail --title "Package chooser" --checklist --separate-output \
"What packages do you wish to install?" 20 78 15 \
"installAdobe" "Install Adobe Reader" off \
"installAnsible" "Install Ansible for DevOps" off \
"installChrome" "Just install the Chrome browser" off \
"installDocker" "Install Docker tools" off \
"installDotfiles" "Pull the dotfiles and set them up" off \
"installDropbox" "Install Dropbox file sync" off \
"installFont" "Install the Hack font for terminal" off \
"installPkgs" "Install binaries" off \
"themeNumix" "Material Design icon theme for Unix" off \
"themePaper" "Paper Material Design theme for Unix" off \
"installSublime" "Install Sublime Text 3 Full" off \
"installTask" "Install tasksh by TaskWarrior" off \
"cleanup_memory" "Issue a cleanup memory operation" off \
"installVim" "Pull vim plugins and .vimrc" off \
"installWireshark" "Install Wireshark packet analyser" off \
"installNode" "Fetch & install NodeJS" off \
"installZsh" "Another Bash for your terminal" off 3>&1 1>&2 2>&3)
if [[ $? = 0 ]]; then
for p in $PACKAGES; do
$p
done
fi
}
if [ "$#" -lt 1 ]
then
selectiveInstall
exit 0
fi
"$@"