-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathstart.sh
executable file
·127 lines (116 loc) · 2.75 KB
/
start.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
#!/bin/bash
# -*- Mode: sh; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
#
# Authors:
# Sam Hewitt <[email protected]>
#
# Authors:
# Igor Dyatlov <[email protected]>
#
# Description:
# A set of post-installation script for Ubuntu and Ubuntu-based distributions
#
# Legal Preamble:
#
# This project 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 project 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/configure
. $dir/functions/kernel
. $dir/functions/password
. $dir/functions/speedup
. $dir/functions/thirdparty
. $dir/functions/thirdparty-theme
. $dir/functions/update
# Fancy colorful echo messages
function echo_message(){
local color=$1;
local exp=$2;
if ! [[ $color =~ '^[0-9]$' ]] ; then
case $(echo -e $color | tr '[:upper:]' '[:lower:]') in
# 0 = black
title) color=0 ;;
# 1 = red
error) color=1 ;;
# 2 = green
info) color=2 ;;
# 3 = yellow
warning) color=3 ;;
# 4 = blue
question) color=4 ;;
# 5 = magenta
success) color=5 ;;
# 6 = cyan
header) color=6 ;;
# 7 = white
*) color=7 ;;
esac
fi
tput bold;
tput setaf $color;
echo $exp;
tput sgr0;
}
# Main
function main {
echo_message title "Starting 'main' function..."
# Draw window
MAIN=$(eval `resize` && whiptail \
--notags \
--title 'Ubuntu Post-Install Script' \
--menu '\nWhat would you like to do?' \
--ok-button 'Run' \
--cancel-button 'Quit' \
$LINES $COLUMNS $(( $LINES - 12 )) \
update 'Perform system update' \
thirdparty 'Install third-party applications' \
thirdparty-theme 'Install third-party theme' \
configure 'Configure system' \
kernel 'Update system kernel' \
cleanup 'Cleanup the system' \
speedup 'Speed up system' \
3>&1 1>&2 2>&3)
# check exit status
EXITSTATUS=$?
if [ $EXITSTATUS = 0 ]; then
$MAIN
else
quit
fi
}
# Quit
function quit {
echo_message title "Starting 'quit' function..."
if (whiptail --title "Quit" --yesno "Are you sure you want quit?" 8 64) then
echo "Exiting..."
echo_message success 'Thanks for using!'
exit 99
else
main
fi
}
# Welcome message
echo_message header "Ubuntu Post-Install Script"
# Run check
check
# Main
while :
do
main
done
#END OF SCRIPT