Skip to content

Commit 40a5604

Browse files
committed
Add disable API function to installer script.
1 parent 68a7c3e commit 40a5604

File tree

2 files changed

+50
-15
lines changed

2 files changed

+50
-15
lines changed

install/hst-install-debian.sh

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,14 @@ help() {
7070
-k, --named Install Bind [yes|no] default: yes
7171
-m, --mysql Install MySQL [yes|no] default: yes
7272
-g, --postgresql Install PostgreSQL [yes|no] default: no
73-
-d, --mongodb Install MongoDB [yes|no] unsupported
7473
-x, --exim Install Exim [yes|no] default: yes
7574
-z, --dovecot Install Dovecot [yes|no] default: yes
7675
-c, --clamav Install ClamAV [yes|no] default: yes
7776
-t, --spamassassin Install SpamAssassin [yes|no] default: yes
7877
-i, --iptables Install Iptables [yes|no] default: yes
7978
-b, --fail2ban Install Fail2ban [yes|no] default: yes
8079
-q, --quota Filesystem Quota [yes|no] default: no
80+
-d, --api Activate API [yes|no] default: yes
8181
-l, --lang Default language default: en
8282
-y, --interactive Interactive install [yes|no] default: yes
8383
-s, --hostname Set hostname
@@ -156,7 +156,6 @@ for arg; do
156156
--named) args="${args}-k " ;;
157157
--mysql) args="${args}-m " ;;
158158
--postgresql) args="${args}-g " ;;
159-
--mongodb) args="${args}-d " ;;
160159
--exim) args="${args}-x " ;;
161160
--dovecot) args="${args}-z " ;;
162161
--clamav) args="${args}-c " ;;
@@ -168,6 +167,7 @@ for arg; do
168167
--quota) args="${args}-q " ;;
169168
--lang) args="${args}-l " ;;
170169
--interactive) args="${args}-y " ;;
170+
--api) args="${args}-d " ;;
171171
--hostname) args="${args}-s " ;;
172172
--email) args="${args}-e " ;;
173173
--password) args="${args}-p " ;;
@@ -191,7 +191,6 @@ while getopts "a:n:w:v:j:k:m:g:d:x:z:c:t:i:b:r:o:q:l:y:s:e:p:fh" Option; do
191191
k) named=$OPTARG ;; # Named
192192
m) mysql=$OPTARG ;; # MySQL
193193
g) postgresql=$OPTARG ;; # PostgreSQL
194-
d) mongodb=$OPTARG ;; # MongoDB (unsupported)
195194
x) exim=$OPTARG ;; # Exim
196195
z) dovecot=$OPTARG ;; # Dovecot
197196
c) clamd=$OPTARG ;; # ClamAV
@@ -201,6 +200,7 @@ while getopts "a:n:w:v:j:k:m:g:d:x:z:c:t:i:b:r:o:q:l:y:s:e:p:fh" Option; do
201200
r) remi=$OPTARG ;; # Remi repo
202201
q) quota=$OPTARG ;; # FS Quota
203202
l) lang=$OPTARG ;; # Language
203+
d) api=$OPTARG ;; # Activate API
204204
y) interactive=$OPTARG ;; # Interactive install
205205
s) servername=$OPTARG ;; # Hostname
206206
e) email=$OPTARG ;; # Admin email
@@ -221,7 +221,6 @@ set_default_value 'proftpd' 'no'
221221
set_default_value 'named' 'yes'
222222
set_default_value 'mysql' 'yes'
223223
set_default_value 'postgresql' 'no'
224-
set_default_value 'mongodb' 'no'
225224
set_default_value 'exim' 'yes'
226225
set_default_value 'dovecot' 'yes'
227226
if [ $memory -lt 1500000 ]; then
@@ -234,6 +233,7 @@ fi
234233
set_default_value 'iptables' 'yes'
235234
set_default_value 'fail2ban' 'yes'
236235
set_default_value 'quota' 'no'
236+
set_default_value 'api' 'yes'
237237
set_default_value 'interactive' 'yes'
238238
set_default_lang 'en'
239239

@@ -367,10 +367,6 @@ fi
367367
if [ "$postgresql" = 'yes' ]; then
368368
echo ' - PostgreSQL Database Server'
369369
fi
370-
if [ "$mongodb" = 'yes' ]; then
371-
echo ' - MongoDB Database Server'
372-
fi
373-
374370
# FTP stack
375371
if [ "$vsftpd" = 'yes' ]; then
376372
echo ' - Vsftpd FTP Server'
@@ -405,6 +401,17 @@ if [ "$interactive" = 'yes' ]; then
405401
if [ -z "$servername" ]; then
406402
read -p "Please enter FQDN hostname [$(hostname)]: " servername
407403
fi
404+
405+
# Asking to deactivate the API
406+
loop=1
407+
while [ "$loop" -eq 1 ]; do
408+
read -p "Would you like to enable the API [yes/no]: " api
409+
if [ $api == 'yes' ] || [ $api == 'no' ]; then
410+
loop=0
411+
else
412+
echo "Please enter yes or no!"
413+
fi
414+
done
408415
fi
409416

410417
# Generating admin password if it wasn't set
@@ -1296,6 +1303,16 @@ if [ "$fail2ban" = 'yes' ]; then
12961303
fi
12971304

12981305

1306+
#----------------------------------------------------------#
1307+
# Configure API #
1308+
#----------------------------------------------------------#
1309+
1310+
if [ "$api" = 'no' ]; then
1311+
rm -r $HESTIA/web/api
1312+
echo "API='no'" >> $HESTIA/conf/hestia.conf
1313+
fi
1314+
1315+
12991316
#----------------------------------------------------------#
13001317
# Configure Admin User #
13011318
#----------------------------------------------------------#

install/hst-install-ubuntu.sh

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,14 @@ help() {
4949
-k, --named Install Bind [yes|no] default: yes
5050
-m, --mysql Install MySQL [yes|no] default: yes
5151
-g, --postgresql Install PostgreSQL [yes|no] default: no
52-
-d, --mongodb Install MongoDB [yes|no] unsupported
5352
-x, --exim Install Exim [yes|no] default: yes
5453
-z, --dovecot Install Dovecot [yes|no] default: yes
5554
-c, --clamav Install ClamAV [yes|no] default: yes
5655
-t, --spamassassin Install SpamAssassin [yes|no] default: yes
5756
-i, --iptables Install Iptables [yes|no] default: yes
5857
-b, --fail2ban Install Fail2ban [yes|no] default: yes
5958
-q, --quota Filesystem Quota [yes|no] default: no
59+
-d, --api Activate API [yes|no] default: yes
6060
-l, --lang Default language default: en
6161
-y, --interactive Interactive install [yes|no] default: yes
6262
-s, --hostname Set hostname
@@ -135,7 +135,6 @@ for arg; do
135135
--named) args="${args}-k " ;;
136136
--mysql) args="${args}-m " ;;
137137
--postgresql) args="${args}-g " ;;
138-
--mongodb) args="${args}-d " ;;
139138
--exim) args="${args}-x " ;;
140139
--dovecot) args="${args}-z " ;;
141140
--clamav) args="${args}-c " ;;
@@ -147,6 +146,7 @@ for arg; do
147146
--quota) args="${args}-q " ;;
148147
--lang) args="${args}-l " ;;
149148
--interactive) args="${args}-y " ;;
149+
--api) args="${args}-d " ;;
150150
--hostname) args="${args}-s " ;;
151151
--email) args="${args}-e " ;;
152152
--password) args="${args}-p " ;;
@@ -170,7 +170,6 @@ while getopts "a:n:w:v:j:k:m:g:d:x:z:c:t:i:b:r:o:q:l:y:s:e:p:fh" Option; do
170170
k) named=$OPTARG ;; # Named
171171
m) mysql=$OPTARG ;; # MySQL
172172
g) postgresql=$OPTARG ;; # PostgreSQL
173-
d) mongodb=$OPTARG ;; # MongoDB (unsupported)
174173
x) exim=$OPTARG ;; # Exim
175174
z) dovecot=$OPTARG ;; # Dovecot
176175
c) clamd=$OPTARG ;; # ClamAV
@@ -180,6 +179,7 @@ while getopts "a:n:w:v:j:k:m:g:d:x:z:c:t:i:b:r:o:q:l:y:s:e:p:fh" Option; do
180179
r) remi=$OPTARG ;; # Remi repo
181180
q) quota=$OPTARG ;; # FS Quota
182181
l) lang=$OPTARG ;; # Language
182+
d) api=$OPTARG ;; # Activate API
183183
y) interactive=$OPTARG ;; # Interactive install
184184
s) servername=$OPTARG ;; # Hostname
185185
e) email=$OPTARG ;; # Admin email
@@ -200,7 +200,6 @@ set_default_value 'proftpd' 'no'
200200
set_default_value 'named' 'yes'
201201
set_default_value 'mysql' 'yes'
202202
set_default_value 'postgresql' 'no'
203-
set_default_value 'mongodb' 'no'
204203
set_default_value 'exim' 'yes'
205204
set_default_value 'dovecot' 'yes'
206205
if [ $memory -lt 1500000 ]; then
@@ -214,6 +213,7 @@ set_default_value 'iptables' 'yes'
214213
set_default_value 'fail2ban' 'yes'
215214
set_default_value 'quota' 'no'
216215
set_default_value 'interactive' 'yes'
216+
set_default_value 'api' 'yes'
217217
set_default_lang 'en'
218218

219219
# Checking software conflicts
@@ -346,9 +346,6 @@ fi
346346
if [ "$postgresql" = 'yes' ]; then
347347
echo ' - PostgreSQL Database Server'
348348
fi
349-
if [ "$mongodb" = 'yes' ]; then
350-
echo ' - MongoDB Database Server'
351-
fi
352349

353350
# FTP stack
354351
if [ "$vsftpd" = 'yes' ]; then
@@ -384,6 +381,17 @@ if [ "$interactive" = 'yes' ]; then
384381
if [ -z "$servername" ]; then
385382
read -p "Please enter FQDN hostname [$(hostname -f)]: " servername
386383
fi
384+
385+
# Asking to deactivate the API
386+
loop=1
387+
while [ "$loop" -eq 1 ]; do
388+
read -p "Would you like to enable the API [yes/no]: " api
389+
if [ $api == 'yes' ] || [ $api == 'no' ]; then
390+
loop=0
391+
else
392+
echo "Please enter yes or no!"
393+
fi
394+
done
387395
fi
388396

389397
# Generating admin password if it wasn't set
@@ -1264,6 +1272,16 @@ if [ "$fail2ban" = 'yes' ]; then
12641272
fi
12651273

12661274

1275+
#----------------------------------------------------------#
1276+
# Configure API #
1277+
#----------------------------------------------------------#
1278+
1279+
if [ "$api" = 'no' ]; then
1280+
rm -r $HESTIA/web/api
1281+
echo "API='no'" >> $HESTIA/conf/hestia.conf
1282+
fi
1283+
1284+
12671285
#----------------------------------------------------------#
12681286
# Configure Admin User #
12691287
#----------------------------------------------------------#

0 commit comments

Comments
 (0)