forked from snwh/ubuntu-post-install
-
Notifications
You must be signed in to change notification settings - Fork 1
/
ubuntu-post-install-script.sh
executable file
·104 lines (94 loc) · 2.44 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
#!/bin/bash
# -*- Mode: sh; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
#
# Authors:
# Sam Hewitt <[email protected]>
#
# Description:
# A post-installation bash script for Ubuntu
#
# Legal Preamble:
#
# This script is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; version 3.
#
# This script is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <https://www.gnu.org/licenses/gpl-3.0.txt>
# tab width
tabs 4
clear
#----- Import Functions -----#
dir="$(dirname "$0")"
. $dir/functions/check
. $dir/functions/cleanup
. $dir/functions/codecs
. $dir/functions/configure
. $dir/functions/development
. $dir/functions/favourites
. $dir/functions/thirdparty
. $dir/functions/update
. $dir/functions/utilities
#----- Fancy Messages -----#
show_error(){
echo -e "\033[1;31m$@\033[m" 1>&2
}
show_info(){
echo -e "\033[1;32m$@\033[0m"
}
show_warning(){
echo -e "\033[1;33m$@\033[0m"
}
show_question(){
echo -e "\033[1;34m$@\033[0m"
}
show_success(){
echo -e "\033[1;35m$@\033[0m"
}
show_header(){
echo -e "\033[1;36m$@\033[0m"
}
show_listitem(){
echo -e "\033[0;37m$@\033[0m"
}
# Main
function main {
eval `resize`
MAIN=$(whiptail \
--notags \
--title "Ubuntu Post-Install Script" \
--menu "\nWhat would you like to do?" \
--cancel-button "Quit" \
$LINES $COLUMNS $(( $LINES - 12 )) \
update 'Perform system update' \
favourites 'Install favourite applications' \
utilities 'Install favourite system utilities' \
development 'Install favourite development tools' \
codecs 'Install Ubuntu Restricted Extras' \
thirdparty 'Install third-party applications' \
configure 'Configure system' \
cleanup 'Cleanup the system' \
3>&1 1>&2 2>&3)
exitstatus=$?
if [ $exitstatus = 0 ]; then
clear && $MAIN
else
clear && quit
fi
}
# Quit
function quit {
if (whiptail --title "Quit" --yesno "Are you sure you want quit?" 10 60) then
exit 99
else
clear && main
fi
}
#RUN
check && main
#END OF SCRIPT