Skip to content

Commit 7d956ab

Browse files
author
Serghey Rodin
committed
Softaculous enable/disable scripts
1 parent 8dd1d4d commit 7d956ab

File tree

6 files changed

+219
-66
lines changed

6 files changed

+219
-66
lines changed

bin/v-add-vesta-softaculous

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
#!/bin/bash
2+
# info: add vesta softaculous
3+
# options: [TYPE]
4+
#
5+
# The script enables softaculous plugin
6+
7+
8+
#----------------------------------------------------------#
9+
# Variable&Function #
10+
#----------------------------------------------------------#
11+
12+
TYPE=$1
13+
14+
# Includes
15+
source /etc/profile
16+
source $VESTA/func/main.sh
17+
source $VESTA/conf/vesta.conf
18+
19+
20+
#----------------------------------------------------------#
21+
# Verifications #
22+
#----------------------------------------------------------#
23+
24+
if [ "$TYPE" = 'WEB' ]; then
25+
$BIN/v-schedule-vesta-softaculous
26+
exit
27+
else
28+
cmd="v-add-vesta-softaculous"
29+
check_cron=$(grep "$cmd" $VESTA/data/users/admin/cron.conf 2> /dev/null)
30+
if [ ! -z "$check_cron" ]; then
31+
eval $check_cron
32+
$BIN/v-delete-cron-job admin $JOB
33+
fi
34+
fi
35+
36+
if [ "$SOFTACULOUS" = 'yes' ]; then
37+
exit
38+
fi
39+
40+
41+
42+
#----------------------------------------------------------#
43+
# Action #
44+
#----------------------------------------------------------#
45+
46+
# Cleaning yum cache
47+
if [ -e "/etc/redhat-release" ]; then
48+
yum -q clean all
49+
yum="yum -q -y --noplugins --disablerepo=* --enablerepo=vesta"
50+
else
51+
export DEBIAN_FRONTEND=noninteractive
52+
apt-get update -o Dir::Etc::sourcelist="sources.list.d/vesta.list" \
53+
-o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0" -qq
54+
fi
55+
56+
# Updating php pacakge
57+
if [ -z "$($VESTA/php/bin/php -v|grep 'PHP 5.6')" ]; then
58+
if [ -e "/etc/redhat-release" ]; then
59+
$yum -y update vesta-php
60+
check_result $? "vesta-php package upgrade failed" $E_UPDATE
61+
else
62+
apt-get -y install vesta-php
63+
check_result $? "vesta-php package upgrade failed" $E_UPDATE
64+
fi
65+
fi
66+
67+
# Adding vesta-ioncube package
68+
if [ -e "/etc/redhat-release" ]; then
69+
rpm -q vesta-ioncube >/dev/null 2>&1
70+
if [ $? -ne 0 ]; then
71+
$yum -y install vesta-ioncube >/dev/null 2>&1
72+
check_result $? "vesta-ioncube package installation failed" $E_UPDATE
73+
fi
74+
else
75+
dpkg -l vesta-ioncube |grep ^ii >/dev/null 2>&1
76+
if [ $? -ne 0 ]; then
77+
apt-get -y install vesta-ioncube >/dev/null 2>&1
78+
check_result $? "vesta-ioncube package installation failed" $E_UPDATE
79+
fi
80+
fi
81+
82+
# Adding vesta-softaculous package
83+
if [ -e "/etc/redhat-release" ]; then
84+
rpm -q vesta-softaculous >/dev/null 2>&1
85+
if [ $? -ne 0 ]; then
86+
$yum -y install vesta-softaculous >/dev/null 2>&1
87+
check_result $? "vesta-softaculous package installation failed" $E_UPDATE
88+
fi
89+
else
90+
dpkg -l vesta-softaculous |grep ^ii >/dev/null 2>&1
91+
if [ $? -ne 0 ]; then
92+
apt-get -y install vesta-softaculous >/dev/null 2>&1
93+
check_result $? "vesta-softaculous package installation failed" $E_UPDATE
94+
fi
95+
fi
96+
97+
# Installing softaculous
98+
if [ ! -e "$VESTA/softaculous/vst_installed" ]; then
99+
cd $VESTA/softaculous
100+
wget -q http://c.vestacp.com/3rdparty/softaculous_install.inc
101+
$VESTA/php/bin/php softaculous_install.inc
102+
check_result $? "vesta-softaculous package installation failed" $E_UPDATE
103+
touch $VESTA/softaculous/vst_installed
104+
fi
105+
106+
# Updating SOFTACULOUS value
107+
if [ -z "$(grep SOFTACULOUS $VESTA/conf/vesta.conf)" ]; then
108+
echo "SOFTACULOUS='yes'" >> $VESTA/conf/vesta.conf
109+
else
110+
sed -i "s/SOFTACULOUS.*/SOFTACULOUS='yes'/g" \
111+
$VESTA/conf/vesta.conf
112+
fi
113+
114+
115+
#----------------------------------------------------------#
116+
# Vesta #
117+
#----------------------------------------------------------#
118+
119+
# Logging
120+
log_event "$OK" "$ARGUMENTS"
121+
122+
exit

bin/v-delete-vesta-softaculous

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/bin/bash
2+
# info: delete vesta softaculous
3+
# options: NONE
4+
#
5+
# The script disables softaculous plugin
6+
7+
8+
#----------------------------------------------------------#
9+
# Variable&Function #
10+
#----------------------------------------------------------#
11+
12+
# Includes
13+
source $VESTA/func/main.sh
14+
source $VESTA/conf/vesta.conf
15+
16+
17+
#----------------------------------------------------------#
18+
# Verifications #
19+
#----------------------------------------------------------#
20+
21+
if [ "$SOFTACULOUS" = 'no' ] || [ -z "$SOFTACULOUS" ]; then
22+
exit
23+
fi
24+
25+
26+
#----------------------------------------------------------#
27+
# Action #
28+
#----------------------------------------------------------#
29+
30+
# Updating SOFTACULOUS value
31+
sed -i "s/SOFTACULOUS.*/SOFTACULOUS='no'/g" \
32+
$VESTA/conf/vesta.conf
33+
34+
35+
#----------------------------------------------------------#
36+
# Vesta #
37+
#----------------------------------------------------------#
38+
39+
# Logging
40+
log_event "$OK" "$ARGUMENTS"
41+
42+
exit

bin/v-list-sys-config

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ json_list() {
5050
"BACKUP": "'$BACKUP'",
5151
"MAIL_URL": "'$MAIL_URL'",
5252
"DB_PMA_URL": "'$DB_PMA_URL'",
53-
"DB_PGA_URL": "'$DB_PGA_URL'"
53+
"DB_PGA_URL": "'$DB_PGA_URL'",
54+
"SOFTACULOUS": "'$SOFTACULOUS'"
5455
}
5556
}'
5657
}
@@ -131,6 +132,9 @@ shell_list() {
131132
if [ ! -z "$SFTPJAIL_KEY" ]; then
132133
echo "SFTP Chroot: $SFTPJAIL_KEY"
133134
fi
135+
if [ ! -z "$SOFTACULOUS" ]; then
136+
echo "Softaculous: $SOFTACULOUS"
137+
fi
134138
if [ ! -z "$LANGUAGE" ] && [ "$LANGUAGE" != 'en' ]; then
135139
echo "Language: $LANGUAGE"
136140
fi
@@ -171,7 +175,7 @@ csv_list() {
171175
echo -n "'$CRON_SYSTEM','$DISK_QUOTA','$FIREWALL_SYSTEM',"
172176
echo -n "'$FIREWALL_EXTENSION','$FILEMANAGER_KEY','$SFTPJAIL_KEY',"
173177
echo -n "'$REPOSITORY','$VERSION','$LANGUAGE','$BACKUP_GZIP','$BACKUP',"
174-
echo -n "'$MAIL_URL','$DB_PMA_URL','$DB_PGA_URL'"
178+
echo -n "'$MAIL_URL','$DB_PMA_URL','$DB_PGA_URL', '$SOFTACULOUS'"
175179
echo
176180
}
177181

bin/v-schedule-vesta-softaculous

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/bin/bash
2+
# info: adding cronjob for vesta-softaculous installation
3+
# options: NONE
4+
#
5+
# The function adds cronjob for letsencrypt ssl certificate installation
6+
7+
8+
#----------------------------------------------------------#
9+
# Variable&Function #
10+
#----------------------------------------------------------#
11+
12+
# Includes
13+
source $VESTA/func/main.sh
14+
source $VESTA/func/domain.sh
15+
source $VESTA/conf/vesta.conf
16+
17+
18+
#----------------------------------------------------------#
19+
# Verifications #
20+
#----------------------------------------------------------#
21+
22+
is_system_enabled "$CRON_SYSTEM" 'CRON_SYSTEM'
23+
24+
25+
#----------------------------------------------------------#
26+
# Action #
27+
#----------------------------------------------------------#
28+
29+
30+
# Adding cronjob for vesta-softaculous
31+
cmd="sudo /usr/local/vesta/bin/v-add-vesta-softaculous"
32+
check_cron=$(grep "$cmd" $VESTA/data/users/admin/cron.conf 2> /dev/null)
33+
if [ -z "$check_cron" ] && [ ! -z "$CRON_SYSTEM" ]; then
34+
$BIN/v-add-cron-job admin '*/1' '*' '*' '*' '*' "$cmd"
35+
fi
36+
37+
38+
39+
#----------------------------------------------------------#
40+
# Vesta #
41+
#----------------------------------------------------------#
42+
43+
# Logging
44+
log_event "$OK" "$ARGUMENTS"
45+
46+
exit

web/edit/server/index.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@
463463
// activating softaculous
464464
if (empty($_SESSION['error_msg'])) {
465465
if($_SESSION['SOFTACULOUS'] != $_POST['v_softaculous'] && $_POST['v_softaculous'] == 'yes'){
466-
exec (VESTA_CMD."v-add-sys-softaculous", $output, $return_var);
466+
exec (VESTA_CMD."v-add-vesta-softaculous WEB", $output, $return_var);
467467
check_return_code($return_var,$output);
468468
unset($output);
469469
if (empty($_SESSION['error_msg'])) {
@@ -476,7 +476,7 @@
476476
// disable softaculous
477477
if (empty($_SESSION['error_msg'])) {
478478
if($_SESSION['SOFTACULOUS'] != $_POST['v_softaculous'] && $_POST['v_softaculous'] == 'no'){
479-
exec (VESTA_CMD."v-delete-sys-softaculous", $output, $return_var);
479+
exec (VESTA_CMD."v-delete-vesta-softaculous", $output, $return_var);
480480
check_return_code($return_var,$output);
481481
unset($output);
482482
if (empty($_SESSION['error_msg'])) {

web/templates/admin/edit_server.html

Lines changed: 1 addition & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -280,67 +280,6 @@
280280
<br><br>
281281
</td>
282282
</tr>
283-
<tr>
284-
<td class="vst-text step-top">
285-
<label>
286-
<input type="checkbox" class="vst-checkbox use_relay" name="v_mail_relay"">
287-
<?=__('Use relay')?>
288-
</label>
289-
</td>
290-
</tr>
291-
292-
293-
<tr class="mail-relay" style="display: none;">
294-
<td>
295-
<table>
296-
<tr>
297-
<td class="vst-text step-left input-label">
298-
<?php print __('Hostname');?><br>
299-
<span style="font-size: 10pt; color:#777;"><?=__('enter hostname or IP address');?></span>
300-
</td>
301-
</tr>
302-
<tr>
303-
<td class="step-left">
304-
<input type="text" size="20" class="vst-input v-ftp-user" name="v_relay_hostname" value="<?=htmlentities(trim($v_relay_hostname, "'"))?>">
305-
</td>
306-
</tr>
307-
308-
309-
<tr>
310-
<td class="vst-text step-left input-label">
311-
<?php print __('Port');?><br>
312-
</td>
313-
</tr>
314-
<tr>
315-
<td class="step-left">
316-
<input type="text" size="20" class="vst-input v-ftp-user" name="v_relay_port" value="<?=htmlentities(trim($v_relay_port, "'"))?>">
317-
</td>
318-
</tr>
319-
320-
<tr>
321-
<td class="vst-text step-left input-label">
322-
<?php print __('Username');?><br>
323-
</td>
324-
</tr>
325-
<tr>
326-
<td class="step-left">
327-
<input type="text" size="20" class="vst-input v-ftp-user" name="v_relay_username" value="<?=htmlentities(trim($v_relay_username, "'"))?>">
328-
</td>
329-
</tr>
330-
331-
<tr>
332-
<td class="vst-text step-left input-label">
333-
<?php print __('Password');?><br>
334-
</td>
335-
</tr>
336-
<tr>
337-
<td class="step-left">
338-
<input type="text" size="20" class="vst-input v-ftp-user" name="v_relay_password" value="<?=htmlentities(trim($v_relay_password, "'"))?>">
339-
</td>
340-
</tr>
341-
</table>
342-
</td>
343-
</tr>
344283

345284
</table>
346285
</td>
@@ -925,7 +864,7 @@
925864
</select>
926865
<br><br>
927866
<div class="softaculous description" <? if ($_SESSION['SOFTACULOUS'] != 'yes') { ?>style="display:none" <? } ?>>
928-
<h5>Web Application Installations Made Easy</h5>
867+
<h5>* plugin installation will run in background</h5>
929868
Softaculous is a great Auto Installer having 426 great scripts, 1115 PHP Classes
930869
and we are still adding more. Softaculous is ideal for Web Hosting companies and
931870
it could give a significant boost to your sales. These scripts cover most of the

0 commit comments

Comments
 (0)