-
Notifications
You must be signed in to change notification settings - Fork 2
/
install.sh
executable file
·188 lines (163 loc) · 3.76 KB
/
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
#!/bin/bash
# Is Root?
if [ $(id -u) != "0" ]; then
echo "Error: You must be root to run this installer. You can try again using 'sudo'."
exit 1
fi
# Variables
directory=`dirname $(readlink -f $0)`
formulas="${directory}/modules/*/install.sh"
modules="${directory}/modules"
sources="${directory}/sources"
title="Katchum"
# Update System
apt-get update
apt-get -y upgrade
# Essentials Instalation
apt-get -y install autoconf curl openssl git-core python-software-properties build-essential
# Source Directory
if [ ! -d "${sources}" ]; then
mkdir ${sources}
fi
# Load Formulas
for file in ${formulas} ; do
. ${file}
done
# Dialog
command -v dialog > /dev/null 2>&1 || { install_dialog; }
# Katchum
dialog \
--backtitle ${title} \
--title 'License Information' \
--textbox LICENSE \
0 0
action=1
selected_modules=()
while true ; do
action=$( dialog --stdout \
--backtitle ${title} \
--title 'Step-By-Step' \
--default-item ${action} \
--no-cancel \
--menu '' \
0 0 0 \
1 'Basic setup' \
2 'DNS' \
3 'Webserver' \
4 'FTP' \
5 'Mail' \
6 'Database' \
7 'Others' \
8 'Install' \
9 'Exit' )
case ${action} in
1)
hostname=$( dialog --stdout --backtitle ${title} --inputbox 'Set a hostname:' 0 0 ${hostname} )
echo "${hostname}" > /etc/hostname
;;
2)
dialog \
--backtitle ${title} \
--msgbox 'No options available.' \
7 25
;;
3)
selected_modules+=($( dialog --stdout \
--separate-output \
--backtitle ${title} \
--title 'Webserver' \
--no-cancel \
--checklist '' \
0 0 0 \
Nginx '' on ))
# Nginx
case "${selected_modules[@]}" in
*"Nginx"*)
selected_modules+=($( dialog --stdout \
--separate-output \
--backtitle ${title} \
--title 'Nginx' \
--no-cancel \
--checklist 'The Nginx server works with the following programming languages:' \
0 0 0 \
PHP5 '' on \
Rbenv '' off ))
;;
esac
# PHP
case "${selected_modules[@]}" in
*"PHP"*)
selected_modules+=($( dialog --stdout \
--separate-output \
--backtitle ${title} \
--title 'PHP' \
--no-cancel \
--checklist 'Select the PHP add-ons:' \
0 0 0 \
APC '' on ))
;;
esac
;;
4)
selected_modules+=($( dialog --stdout \
--separate-output \
--backtitle ${title} \
--title 'FTP' \
--no-cancel \
--checklist '' \
0 0 0 \
VSFTPd '' on ))
;;
5)
selected_modules+=($( dialog --stdout \
--separate-output \
--backtitle ${title} \
--title 'Mail' \
--no-cancel \
--checklist '' \
0 0 0 \
Postfix '' on ))
;;
6)
selected_modules+=($( dialog --stdout \
--separate-output \
--backtitle ${title} \
--title 'Database' \
--no-cancel \
--checklist '' \
0 0 0 \
MySQL '' on ))
;;
7)
selected_modules+=($( dialog --stdout \
--separate-output \
--title 'Others' \
--no-cancel \
--checklist '' \
0 0 0 \
ImageMagick '' on ))
;;
8)
for module in ${selected_modules[@]} ; do
install_${module,,}
done
dialog \
--backtitle ${title} \
--msgbox 'The installation was finished.' \
7 35
break
;;
*)
dialog \
--backtitle ${title} \
--title 'Exit' \
--yesno 'Are you sure?' \
0 0
if [ $? = 0 ]; then
break
fi
;;
esac
action=$((action+1))
done
clear