-
Notifications
You must be signed in to change notification settings - Fork 0
/
gui.sh
executable file
·157 lines (137 loc) · 3.1 KB
/
gui.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
# !/bin/bash
# Changelog
# Versione 0.1a - 24/01/2017
# Initial Release - Basic functions
#############################################################
# Variabili iniziali
versione="0.1b"
data="24/01/2017"
titolo="newcentos7 $versione"
sottotitolo="newcentos7 version $versione of $data"
# ************ Core routine **************
echo "Loading....."
yum install dialog -y -q
pausa(){
read -p "$*"
}
uscita()
{
dialog --clear --backtitle "$sottotitolo" --msgbox "Exiting from the program!" 6 45
rm tmpscelta
clear
exit
}
scelta_operazione(){
dialog --clear --backtitle "$sottotitolo" --menu \
"Please, make your choice, or ESC to exit:" 0 0 0 \
I "Install basic functions" \
A "Install Apache httpd" \
M "Install MySQL database" 2>tmpscelta
if [ "$?" = "0" ]
then
_return=$(cat tmpscelta)
if [ "$_return" = "I" ]
then
basicfunctions
fi
if [ "$_return" = "A" ]
then
apachehttpd
fi
if [ "$_return" = "M" ]
then
mysqldatabase
fi
else
uscita
fi
}
postbasic(){
dialog --clear --backtitle "$sottotitolo" --menu \
"Please, make your choice, or ESC to exit:" 0 0 0 \
A "Install Apache httpd" \
M "Install MySQL database" 2>tmpscelta
if [ "$?" = "0" ]
then
_return=$(cat tmpscelta)
if [ "$_return" = "I" ]
then
basicfunctions
fi
if [ "$_return" = "A" ]
then
apachehttpd
fi
if [ "$_return" = "M" ]
then
mysqldatabase
fi
else
uscita
fi
}
installa_wget()
{
dialog --title "$titolo" --backtitle "$sottotitolo" --yesno "Install wget package?" 5 35
case $? in
0)
echo "Installing wget package"
yum install wget -y -q
scelta_operazione
;;
1)
dialog --clear --backtitle "$sottotitolo" --msgbox "wget package is a requisite for working this script" 6 70
uscita
;;
esac
# uscita
}
basicfunctions()
{
# Routine loading basic functions
yum clean all; yum install wget -y
cd /root
# wget https://raw.githubusercontent.com/technofab/newcentos7/master/installbase.sh
chmod 755 ./installbase.sh
./installbase.sh
postbasic
exit
}
apachehttpd()
{
# Routine loading and install Apache httpd
yum clean all; yum install wget -y
cd /root
# wget https://raw.githubusercontent.com/technofab/newcentos7/master/installhttpd.sh
chmod 755 ./installhttpd.sh
./installhttpd.sh
postbasic
exit
}
mysqldatabase()
{
# Routine loading and install MySQL
yum clean all; yum install wget -y
cd /root
# wget https://raw.githubusercontent.com/technofab/newcentos7/master/installmysql.sh
chmod 755 ./installmysql.sh
./installmysql.sh
postbasic
exit
}
# ************ Core routine **************
# Inizio script
dialog --title "$titolo" --backtitle "$sottotitolo" --msgbox "Welcome to $titolo" 5 33
# Verifying if the user is root and wget is installed
if [ $UID != 0 ]
then
dialog --clear --backtitle "$sottotitolo" --msgbox "This script must be ran as root user." 6 70
exit 1
fi
if which wget >/dev/null; then
dialog --clear --backtitle "$sottotitolo" --msgbox "OK wget package is installed!" 5 60
scelta_operazione
else
dialog --clear --backtitle "$sottotitolo" --msgbox "KO wget package is missing!" 5 60
installa_wget
fi