forked from snwh/ubuntu-post-install
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathubuntu-post-install-script.sh
472 lines (456 loc) · 14 KB
/
ubuntu-post-install-script.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
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
#!/bin/bash
#----------------------------#
# UBUNTU POST-INSTALL SCRIPT #
#----------------------------#
echo ''
echo '#-------------------------------------------#'
echo '# Ubuntu 13.04 Post-Install Script #'
echo '#-------------------------------------------#'
# SYSTEM UPGRADE
function sysupgrade {
# Update Repository Information
echo 'Updating repository information...'
echo 'Requires root privileges:'
sudo apt-get update -qq
# Dist-Upgrade
echo 'Performing system upgrade...'
sudo apt-get dist-upgrade -y
echo 'Done.'
main
}
# INSTALL FAVOURITE APPLICATIONS
function appinstall {
# Install Favourite Applications
echo 'Installing selected favourite applications...'
echo 'Requires root privileges:'
sudo apt-get install -y --no-install-recommends filezilla gimp gimp-plugin-registry grsync inkscape nautilus-dropbox nautilus-open-terminal hamster-indicator -gtk-redshift zim synapse
echo 'Done.'
main
}
# INSTALL FAVOURITE SYSTEM TOOLS
function toolinstall {
echo 'Installing system tools...'
echo 'Requires root privileges:'
sudo apt-get install -y --no-install-recommends dconf-tools openjdk-7-jdk openssh-server p7zip-full ppa-purge samba ssh synaptic zsync
echo 'Done.'
main
}
# INSTALL GNOME SHELL
function gnomeextra {
INPUT=0
echo ''
echo 'What would you like to do? (Enter the number of your choice)'
echo ''
while [ $INPUT != 1 ] && [ $INPUT != 2 ] && [ $INPUT != 3 ]
do
echo '1. Add GNOME3 PPA?'
echo '2. Add GNOME3 Staging PPA?'
echo '3. Install GNOME Shell?'
echo '4. Install extra GNOME applications?'
echo '5. Configure GNOME Shell Specific Settings?'
echo '6. Return.'
echo ''
read INPUT
# Add GNOME3 PPA
if [ $INPUT -eq 1 ]; then
echo 'Adding GNOME3 PPA to software sources...'
echo 'Requires root privileges:'
sudo add-apt-repository -y ppa:gnome3-team/gnome3
echo 'Updating repository information...'
sudo apt-get update -qq
echo 'Performing system upgrade...'
sudo apt-get dist-upgrade -y
echo 'Done.'
gnomeextra
# Add GNOME3 Staging PPA
elif [ $INPUT -eq 2 ]; then
echo 'Adding GNOME3 Staging PPA to software sources...'
echo 'Requires root privileges:'
sudo add-apt-repository -y ppa:gnome3-team/gnome3-staging
echo 'Updating repository information...'
sudo apt-get update -qq
echo 'Performing system upgrade...'
sudo apt-get dist-upgrade -y
echo 'Done.'
gnomeextra
# Install GNOME Shell
elif [ $INPUT -eq 3 ]; then
echo 'Installing GNOME Shell...'
echo 'Requires root privileges:'
sudo apt-get install -y fonts-cantarell gnome-shell
echo 'Done.'
gnomeextra
# Install Extra GNOME Apps
elif [ $INPUT -eq 4 ]; then
echo 'Installing extra GNOME applications...'
echo 'Requires root privileges:'
sudo apt-get install -y bijiben gnome-clocks gnome-contacts gnome-documents gnome-sushi gnome-tweak-tool gnome-weather
echo 'Done.'
gnomeextra
# Configure Shell Specific Settings
elif [ $INPUT -eq 5 ]; then
# Font Sizes
echo 'Setting font preferences...'
gsettings set org.gnome.desktop.interface text-scaling-factor '1.0'
gsettings set org.gnome.desktop.interface document-font-name 'Cantarell 10'
gsettings set org.gnome.desktop.interface font-name 'Cantarell 10'
gsettings set org.gnome.nautilus.desktop font 'Cantarell 10'
gsettings set org.gnome.desktop.wm.preferences titlebar-font 'Cantarell Bold 10'
gsettings set org.gnome.settings-daemon.plugins.xsettings antialiasing 'rgba'
gsettings set org.gnome.settings-daemon.plugins.xsettings hinting 'slight'
# GNOME Shell Settings
echo 'Setting GNOME Shell preferences...'
gsettings set org.gnome.shell.overrides button-layout 'close:'
# Return
elif [ $INPUT -eq 6 ]; then
clear && main
else
# Invalid Choice
echo 'Not an option, choose again.'
gnomeextra
fi
done
}
# INSTALL MULTIMEDIA CODECS
function codecinstall {
# Install Ubuntu Restricted Extras Applications
echo 'Installing Ubuntu Restricted Extras...'
echo 'Requires root privileges:'
sudo apt-get install -y ubuntu-restricted-extras
echo 'Done.'
main
}
# INSTALL DEV TOOLS
function devinstall {
# Install Development Tools
echo 'Installing development tools...'
echo 'Requires root privileges:'
sudo apt-get install -y bzr git ruby zsh
echo 'Done.'
main
}
# EXTRA INSTALLATION
function thirdparty {
INPUT=0
echo ''
echo 'What would you like to do? (Enter the number of your choice)'
echo ''
while [ $INPUT != 1 ] && [ $INPUT != 2 ] && [ $INPUT != 3 ]
do
echo '1. Install Google Chrome (Unstable)?'
echo '2. Install Google Talk Plugin?'
echo '3. Install Steam?'
echo '4. Install Unity Tweak Tool?'
echo '5. Install DVD playback tools?'
echo '6. Return'
echo ''
read INPUT
# Google Chrome
if [ $INPUT -eq 1 ]; then
echo 'Downloading Google Chrome (Unstable)...'
# Make tmp directory
if [ -e $HOME/tmp ]; then
mkdir -p $HOME/tmp
else
continue
fi
cd $HOME/tmp
# Download Debian file that matches system architecture
if [ $(uname -i) = 'i386' ]; then
wget https://dl.google.com/linux/direct/google-chrome-unstable_current_i386.deb
elif [ $(uname -i) = 'x86_64' ]; then
wget https://dl.google.com/linux/direct/google-chrome-unstable_current_amd64.deb
fi
# Install the package
echo 'Installing Google Chrome...'
sudo dpkg -i google*.deb
sudo apt-get install -fy
# Cleanup and finish
rm *.deb
cd
echo 'Done.'
thirdparty
# Google Talk Plugin
elif [ $INPUT -eq 2 ]; then
echo 'Downloading Google Talk Plugin...'
# Make tmp directory
if [ -e $HOME/tmp ]; then
mkdir -p $HOME/tmp
else
continue
fi
cd $HOME/tmp
# Download Debian file that matches system architecture
if [ $(uname -i) = 'i386' ]; then
wget https://dl.google.com/linux/direct/google-talkplugin_current_i386.deb
elif [ $(uname -i) = 'x86_64' ]; then
wget https://dl.google.com/linux/direct/google-talkplugin_current_amd64.deb
fi
# Install the package
echo 'Installing Google Talk Plugin...'
sudo dpkg -i google*.deb
sudo apt-get install -fy
# Cleanup and finish
rm *.deb
cd
echo 'Done.'
thirdparty
# Steam
elif [ $INPUT -eq 3 ]; then
echo 'Downloading Steam...'
# Make tmp directory
if [ -e $HOME/tmp ]; then
mkdir -p $HOME/tmp
else
continue
fi
cd $HOME/tmp
# Download Debian file that matches system architecture
if [ $(uname -i) = 'i386' ]; then
wget http://repo.steampowered.com/steam/archive/precise/steam_latest.deb
elif [ $(uname -i) = 'x86_64' ]; then
wget http://repo.steampowered.com/steam/archive/precise/steam_latest.deb
fi
# Install the package
echo 'Installing Steam...'
sudo dpkg -i steam*.deb
sudo apt-get install -fy
# Cleanup and finish
rm *.deb
cd
echo 'Done.'
thirdparty
# Unity Tweak Tool
elif [ $INPUT -eq 4 ]; then
# Add repository
echo 'Adding Unity Tweak Tool repository to sources...'
echo 'Requires root privileges:'
sudo add-apt-repository ppa:freyja-dev/unity-tweak-tool-daily
# Update Repository Information
echo 'Updating repository information...'
sudo apt-get update -qq
# Install the package
echo 'Installing Unity Tweak Tool...'
sudo apt-get install -y unity-tweak-tool
echo 'Done.'
thirdparty
# Medibuntu
elif [ $INPUT -eq 5 ]; then
echo 'Adding Medibuntu repository to sources...'
echo 'Requires root privileges:'
sudo -E wget --output-document=/etc/apt/sources.list.d/medibuntu.list http://www.medibuntu.org/sources.list.d/$(lsb_release -cs).list && sudo apt-get update -qq && sudo apt-get --yes --quiet --allow-unauthenticated install medibuntu-keyring && sudo apt-get update -qq
echo 'Done.'
echo 'Installing libdvdcss2...'
sudo apt-get install -y libdvdcss2
echo 'Done.'
# Return
elif [ $INPUT -eq 6 ]; then
clear && main
else
# Invalid Choice
echo 'Not an option, choose again.'
thirdparty
fi
done
}
# CONFIG
function config {
INPUT=0
echo ''
echo 'What would you like to do? (Enter the number of your choice)'
echo ''
while [ $INPUT != 1 ] && [ $INPUT != 2 ] && [ $INPUT != 3 ]
do
echo '1. Set preferred application-specific settings?'
echo '2. Show all startup applications?'
echo '3. Return'
echo ''
read INPUT
# GSettings
if [ $INPUT -eq 1 ]; then
# Font Sizes
echo 'Setting font preferences...'
gsettings set org.gnome.desktop.interface text-scaling-factor '1.0'
gsettings set org.gnome.desktop.interface document-font-name 'Ubuntu 9'
gsettings set org.gnome.desktop.interface font-name 'Ubuntu 9'
gsettings set org.gnome.desktop.interface monospace-font-name 'Ubuntu Mono 11'
gsettings set org.gnome.nautilus.desktop font 'Ubuntu 9'
gsettings set org.gnome.desktop.wm.preferences titlebar-font 'Ubuntu Bold 9'
gsettings set org.gnome.settings-daemon.plugins.xsettings antialiasing 'rgba'
gsettings set org.gnome.settings-daemon.plugins.xsettings hinting 'slight'
# Unity Settings
echo 'Setting Unity preferences...'
gsettings set com.canonical.Unity.ApplicationsLens display-available-apps false
gsettings set com.canonical.unity-greeter draw-user-backgrounds true
gsettings set com.canonical.indicator.power icon-policy 'charge'
gsettings set com.canonical.Unity.Lenses remote-content-search 'none'
# Nautilus Preferences
echo 'Setting Nautilus preferences...'
gsettings set org.gnome.nautilus.preferences sort-directories-first true
# Gedit Preferences
echo 'Setting Gedit preferences...'
gsettings set org.gnome.gedit.preferences.editor display-line-numbers true
gsettings set org.gnome.gedit.preferences.editor create-backup-copy false
gsettings set org.gnome.gedit.preferences.editor auto-save true
gsettings set org.gnome.gedit.preferences.editor insert-spaces true
gsettings set org.gnome.gedit.preferences.editor tabs-size 4
# Rhythmbox Preferences
echo 'Setting Rhythmbox preferences...'
gsettings set org.gnome.rhythmbox.rhythmdb monitor-library true
gsettings set org.gnome.rhythmbox.sources browser-views 'artists-albums'
gsettings set org.gnome.rhythmbox.sources visible-columns '['post-time', 'artist', 'duration', 'genre', 'album']'
# Totem Preferences
echo 'Setting Totem preferences...'
gsettings set org.gnome.totem active-plugins '['save-file', 'media_player_keys', 'screenshot', 'chapters', 'ontop', 'screensaver', 'movie-properties', 'skipto']'
config
# Startup Applications
elif [ $INPUT -eq 2 ]; then
echo 'Changing display of startup applications.'
echo 'Requires root privileges:'
cd /etc/xdg/autostart/ && sudo sed --in-place 's/NoDisplay=true/NoDisplay=false/g' *.desktop
cd
echo 'Done.'
config
# Return
elif [ $INPUT -eq 3 ]; then
clear && main
else
# Invalid Choice
echo 'Not an option, choose again.'
config
fi
done
}
# CLEANUP SYSTEM
function cleanup {
INPUT=0
echo ''
echo 'What would you like to do? (Enter the number of your choice)'
echo ''
while [ $INPUT != 1 ] && [ $INPUT != 2 ] && [ $INPUT != 3 ]
do
echo ''
echo '1. Remove unused pre-installed packages?'
echo '2. Remove old kernel(s)?'
echo '3. Remove orphaned packages?'
echo '4. Remove residual config files?'
echo '5. Clean package cache?'
echo '6. Return?'
echo ''
read INPUT
# Remove Unused Pre-installed Packages
if [ $INPUT -eq 1 ]; then
echo 'Removing selected pre-installed applications...'
echo 'Requires root privileges:'
sudo apt-get purge
echo 'Done.'
cleanup
# Remove Old Kernel
elif [ $INPUT -eq 2 ]; then
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' | xargs sudo apt-get -y purge
echo 'Done.'
cleanup
# Remove Orphaned Packages
elif [ $INPUT -eq 3 ]; then
echo 'Removing orphaned packages...'
echo 'Requires root privileges:'
sudo apt-get autoremove -y
echo 'Done.'
cleanup
# Remove residual config files?
elif [ $INPUT -eq 4 ]; then
echo 'Removing residual config files...'
echo 'Requires root privileges:'
sudo dpkg --purge $(COLUMNS=200 dpkg -l | grep '^rc' | tr -s ' ' | cut -d ' ' -f 2)
echo 'Done.'
# Clean Package Cache
elif [ $INPUT -eq 5 ]; then
echo 'Cleaning package cache...'
echo 'Requires root privileges:'
sudo apt-get clean
echo 'Done.'
cleanup
# Return
elif [ $INPUT -eq 6 ]; then
clear && main
else
# Invalid Choice
echo 'Not an option, choose again.'
cleanup
fi
done
}
# END
function end {
echo ''
read -p 'Are you sure you want to quit? (Y/n) '
if [ '$REPLY' == 'n' ]; then
clear && main
else
exit
fi
}
# MAIN FUNCTION
function main {
INPUT=0
echo ''
echo 'What would you like to do? (Enter the number of your choice)'
echo ''
while [ $INPUT != 1 ] && [ $INPUT != 2 ] && [ $INPUT != 3 ]
do
echo '1. Perform system update & upgrade?'
echo '2. Install favourite applications?'
echo '3. Install favourite system tools?'
echo '4. Install extra GNOME components?'
echo '5. Install development tools?'
echo '6. Install Ubuntu Restricted Extras?'
echo '7. Install third-party applications?'
echo '8. Configure system?'
echo '9. Cleanup the system?'
echo '10. Quit?'
echo ''
read INPUT
# System Upgrade
if [ $INPUT -eq 1 ]; then
clear && sysupgrade
# Install Favourite Applications
elif [ $INPUT -eq 2 ]; then
clear && appinstall
# Install Favourite Tools
elif [ $INPUT -eq 3 ]; then
clear && toolinstall
# Install GNOME components
elif [ $INPUT -eq 4 ]; then
clear && gnomeextra
# Install Dev Tools
elif [ $INPUT -eq 5 ]; then
clear && devinstall
# Install Ubuntu Restricted Extras
elif [ $INPUT -eq 6 ]; then
clear && codecinstall
# Install Third-Party Applications
elif [ $INPUT -eq 7 ]; then
clear && thirdparty
# Configure System
elif [ $INPUT -eq 8 ]; then
clear && config
# Cleanup System
elif [ $INPUT -eq 9 ]; then
clear && cleanup
# End
elif [ $INPUT -eq 10 ]; then
end
else
# Invalid Choice
echo 'Not an option, choose again.'
main
fi
done
}
# CALL MAIN FUNCTION
main
#-----------------------------------#
# END OF UBUNTU POST-INSTALL SCRIPT #
#-----------------------------------#