-
Notifications
You must be signed in to change notification settings - Fork 0
/
ubuntu-post-install.sh
executable file
·400 lines (389 loc) · 10.5 KB
/
ubuntu-post-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
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
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
#!/bin/bash
#
# Authors:
# Francisco Suarez-Ruiz <www.romin.upm.es/fsuarez>
#
# Description:
# A post-installation bash script for Ubuntu 14.04 and later
echo ''
echo '#---------------------------------------------------#'
echo '# Ubuntu 14.04 and later Post-Installation Script #'
echo '#---------------------------------------------------#'
#----- FUNCTIONS -----#
# SYSTEM UPGRADE
function sysupgrade {
# Perform system upgrade
echo ''
read -p 'Proceed with system upgrade? (Y)es, (N)o : ' REPLY
case $REPLY in
# Positive action
[Yy]* )
# Update repository information
echo 'Updating repository information...'
echo 'Requires root privileges:'
sudo apt-get update
# Dist-Upgrade
echo 'Performing system upgrade...'
sudo apt-get dist-upgrade -y
echo 'Done.'
main
;;
# Negative action
[Nn]* )
clear && main
;;
# Error
* )
clear && echo 'Sorry, try again.'
sysupgrade
;;
esac
}
# INSTALL APPLICATIONS
function favourites {
# Install Favourite Applications
echo ''
echo 'Installing selected favourite applications...'
echo ''
echo 'Current package list:
arp-scan
couchdb
curl
filezilla
geany
geany-plugin-addons
geany-plugins
gimp
gimp-plugin-registry
git
gthumb
guake
icontool
imagemagick
inkscape
mercurial
openjdk-7-jdk | openjdk-8-jdk
openssh-server
python-pip
python3-distutils-extra
scons
synaptic
terminator
vlc
wxmaxima'
echo ''
read -p 'Proceed? (Y)es, (N)o : ' REPLY
case $REPLY in
# Positive action
[Yy]* )
echo 'Requires root privileges:'
# Add repositories
# Update
sudo apt-get update
# Install.
sudo apt-get install -y --no-install-recommends arp-scan couchdb curl filezilla geany geany-plugins geany-plugin-addons gimp gimp-plugin-registry git gthumb guake icontool imagemagick inkscape mercurial openssh-server python-pip python3-distutils-extra scons synaptic terminator vlc wxmaxima
if [ $(lsb_release -sr) = '12.04' ]; then
sudo apt-get install openjdk-7-jdk
elif [ $(lsb_release -sr) = '14.04' ]; then
sudo apt-get install openjdk-7-jdk
elif [ $(lsb_release -sr) = '16.04' ]; then
sudo apt-get install openjdk-8-jdk
fi
echo 'Setting terminator as default terminal'
gsettings set org.gnome.desktop.default-applications.terminal exec 'terminator'
echo 'Changing background'
if [ $(lsb_release -sr) = '12.04' ]; then
gsettings set org.gnome.desktop.background picture-uri file:///usr/share/backgrounds/Twilight_Frost_by_Phil_Jackson.jpg
elif [ $(lsb_release -sr) = '14.04' ]; then
gsettings set org.gnome.desktop.background picture-uri file:///usr/share/backgrounds/Forever_by_Shady_S.jpg
elif [ $(lsb_release -sr) = '16.04' ]; then
gsettings set org.gnome.desktop.background picture-uri file:///usr/share/backgrounds/Spring_by_Peter_Apas.jpg
fi
echo 'Defining git global for fsuarez6'
#~ git config --global user.email "[email protected]"
#~ git config --global user.name "fsuarez6"
git config --global push.default simple
echo 'Done.'
main
;;
# Negative action
[Nn]* )
clear && main
;;
# Error
* )
clear && echo 'Sorry, try again.'
favourites
;;
esac
}
# CUSTOMIZATION
function customize {
echo ''
echo '1. Configure system?'
echo '2. Install Third-Party themes?'
echo 'r. Return'
echo ''
read -p 'What would you like to do? (Enter your choice) : ' REPLY
case $REPLY in
1) clear && config;; # System Configuration
2) clear && themes;; # Install Third-Party Themes
[Rr]*) clear && main;; # Return
* ) clear && echo 'Not an option, try again.' && customize;; # Invalid choice
esac
}
# THIRD PARTY APPLICATIONS
function thirdparty {
echo 'What would you like to install? '
echo ''
echo '1. Google Chrome?'
echo '2. Smartgit 7.1.1'
echo '3. Dropbox'
echo '4. Phantom Omni'
echo '5. VirtualBox'
echo 'r. Return'
echo ''
read -p 'Enter your choice: ' REPLY
case $REPLY in
# Google Chrome
1)
echo 'Downloading Google Chrome...'
# Download Debian file that matches system architecture
if [ $(uname -i) = 'i386' ]; then
wget https://dl.google.com/linux/direct/google-chrome-stable_current_i386.deb
elif [ $(uname -i) = 'x86_64' ]; then
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
fi
# Install package(s)
echo 'Installing Google Chrome...'
echo 'Requires root privileges:'
sudo dpkg -i google-chrome*.deb
sudo apt-get install -fy
# Cleanup and finish
rm google-chrome*.deb
cd
echo 'Done.'
thirdparty
;;
# Smartgit
2)
echo 'Downloading Smartgit'
wget http://www.syntevo.com/static/smart/download/smartgit/smartgit-7_1_1.deb
# Install package(s)
echo 'Installing Smartgit'
echo 'Requires root privileges:'
sudo dpkg -i smartgit*.deb
sudo apt-get install -fy
# Cleanup and finish
rm smartgit*.deb
cd
echo 'Done.'
thirdparty
;;
# Dropbox
3)
echo 'Downloading Dropbox...'
# Download Debian file that matches system architecture
if [ $(uname -i) = 'i386' ]; then
wget https://linux.dropbox.com/packages/ubuntu/dropbox_1.6.0_i386.deb
elif [ $(uname -i) = 'x86_64' ]; then
wget https://linux.dropbox.com/packages/ubuntu/dropbox_1.6.0_amd64.deb
fi
# Install package(s)
echo 'Installing Dropbox...'
echo 'Requires root privileges:'
sudo dpkg -i dropbox_1.6.0_*.deb
sudo apt-get install -fy
# Cleanup and finish
rm dropbox_1.6.0_*.deb
cd
nautilus -q
echo 'Done.'
thirdparty
;;
# Phantom Omni
4)
echo 'Installing requirements:
freeglut3-dev
g++
libdrm-dev
libexpat1-dev
libglw1-mesa-dev
libmotif-dev
libncurses5-dev
libraw1394-dev
libx11-dev
libxdamage-dev
libxext-dev
libxt-dev
libxxf86vm-dev
tcsh
unzip
x11proto-dri2-dev
x11proto-gl-dev
x11proto-print-dev'
echo ''
read -p 'Proceed? (Y)es, (N)o : ' REPLY
case $REPLY in
# Positive action
[Yy]* )
echo 'Requires root privileges:'
# Install.
echo 'Requires root privileges:'
sudo apt-get install -y --no-install-recommends freeglut3-dev g++ libdrm-dev libexpat1-dev libglw1-mesa-devlibmotif-dev libncurses5-dev libraw1394-dev libx11-dev libxdamage-dev libxext-dev libxt-dev libxxf86vm-dev tcsh unzip x11proto-dri2-dev x11proto-gl-dev x11proto-print-dev
;;
# Negative action
[Nn]* )
clear && thirdparty
;;
# Error
* )
clear && echo 'Sorry, try again.'
thirdparty
;;
esac
echo 'Downloading PDD and OH...'
# Installing unzip (just in case it's not here)
# Download Debian file that matches system architecture
wget https://github.com/fsuarez6/phantom_omni/releases/download/0.2.0/OpenHapticsAE_Linux_v3_0.zip
unzip OpenHapticsAE_Linux_v3_0.zip
CURRENT_DIR="$(pwd)"
cd ./OpenHapticsAE_Linux_v3_0
# Install package(s)
echo 'Installing Dropbox...'
echo 'Requires root privileges:'
if [ $(uname -i) = 'i386' ]; then
cd ./OpenHaptics-AE\ 3.0/32-bit/
sudo dpkg -i openhaptics-ae*.deb
sudo apt-get install -fy
cd ../../PHANTOM\ Device\ Drivers/32-bit/
sudo dpkg -i phantomdevicedrivers*.deb
sudo apt-get install -fy
elif [ $(uname -i) = 'x86_64' ]; then
cd ./OpenHaptics-AE\ 3.0/64-bit/
sudo dpkg -i openhaptics-ae*.deb
sudo apt-get install -fy
cd ../../PHANTOM\ Device\ Drivers/64-bit/
sudo dpkg -i phantomdevicedrivers*.deb
sudo apt-get install -fy
fi
# Cleanup and finish
cd $CURRENT_DIR
rm -rf OpenHapticsAE_Linux_v3_0*
echo 'Done.'
thirdparty
;;
# VirtualBox
5)
echo 'Downloading VirtualBox 4.3.26...'
wget http://download.virtualbox.org/virtualbox/4.3.26/virtualbox-4.3_4.3.26-98988~Ubuntu~precise_amd64.deb
# Install package(s)
echo 'Installing VirtualBox...'
echo 'Requires root privileges:'
sudo dpkg -i virtualbox*.deb
sudo apt-get install -fy
# Cleanup and finish
rm virtualbox*.deb
cd
echo 'Done.'
thirdparty
;;
# Return
[Rr]*)
clear && main;;
# Invalid choice
* )
clear && echo 'Not an option, try again.' && thirdparty;;
esac
}
# CLEANUP SYSTEM
function cleanup {
echo ''
echo '1. Remove unused pre-installed packages?'
echo '2. Remove old kernel(s)?'
echo '3. Remove orphaned packages?'
echo '4. Remove leftover configuration files?'
echo '5. Clean package cache?'
echo 'r. Return?'
echo ''
read -p 'What would you like to do? (Enter your choice) : ' REPLY
case $REPLY in
# Remove Unused Pre-installed Packages
1)
echo 'Removing selected pre-installed applications...'
echo 'Requires root privileges:'
sudo apt-get purge landscape-client-ui-install ubuntuone-control-panel* overlay*
echo 'Done.'
cleanup
;;
# Remove Old Kernel
2)
echo 'Removing old Kernel(s)...'
echo 'Requires root privileges:'
sudo dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | grep -v linux-libc-dev | xargs sudo apt-get -y purge
echo 'Done.'
cleanup
;;
# Remove Orphaned Packages
3)
echo 'Removing orphaned packages...'
echo 'Requires root privileges:'
sudo apt-get autoremove -y
echo 'Done.'
cleanup
;;
# Remove residual config files?
4)
echo 'Removing leftover configuration files...'
echo 'Requires root privileges:'
sudo dpkg --purge $(COLUMNS=200 dpkg -l | grep '^rc' | tr -s ' ' | cut -d ' ' -f 2)
echo 'Done.'
cleanup
;;
# Clean Package Cache
5)
echo 'Cleaning package cache...'
echo 'Requires root privileges:'
sudo apt-get clean
echo 'Done.'
cleanup
;;
# Return
[Rr]*)
clear && main;;
# Invalid choice
* )
clear && echo 'Not an option, try again.' && cleanup;;
esac
}
# Quit
function quit {
read -p "Are you sure you want to quit? (Y)es, (N)o " REPLY
case $REPLY in
[Yy]* ) exit 99;;
[Nn]* ) clear && main;;
* ) clear && echo 'Sorry, try again.' && quit;;
esac
}
#----- MAIN FUNCTION -----#
function main {
echo ''
echo '1. Perform system update & upgrade?'
echo '2. Install favourite applications?'
echo '3. Install third-party applications?'
echo '4. Cleanup the system?'
echo 'q. Quit?'
echo ''
read -p 'What would you like to do? (Enter your choice) : ' REPLY
case $REPLY in
1) sysupgrade;; # System Upgrade
2) clear && favourites;; # Install Favourite Applications
3) clear && thirdparty;; # Install Third-Party Applications
4) clear && cleanup;; # Cleanup System
[Qq]* ) echo '' && quit;; # Quit
* ) clear && echo 'Not an option, try again.' && main;;
esac
}
#----- RUN MAIN FUNCTION -----#
main
#END OF SCRIPT