Softaculous enable/disable scripts

This commit is contained in:
Serghey Rodin 2017-12-21 19:18:00 +02:00
parent 8dd1d4d581
commit 7d956abd59
6 changed files with 219 additions and 66 deletions

122
bin/v-add-vesta-softaculous Executable file
View file

@ -0,0 +1,122 @@
#!/bin/bash
# info: add vesta softaculous
# options: [TYPE]
#
# The script enables softaculous plugin
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
TYPE=$1
# Includes
source /etc/profile
source $VESTA/func/main.sh
source $VESTA/conf/vesta.conf
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
if [ "$TYPE" = 'WEB' ]; then
$BIN/v-schedule-vesta-softaculous
exit
else
cmd="v-add-vesta-softaculous"
check_cron=$(grep "$cmd" $VESTA/data/users/admin/cron.conf 2> /dev/null)
if [ ! -z "$check_cron" ]; then
eval $check_cron
$BIN/v-delete-cron-job admin $JOB
fi
fi
if [ "$SOFTACULOUS" = 'yes' ]; then
exit
fi
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Cleaning yum cache
if [ -e "/etc/redhat-release" ]; then
yum -q clean all
yum="yum -q -y --noplugins --disablerepo=* --enablerepo=vesta"
else
export DEBIAN_FRONTEND=noninteractive
apt-get update -o Dir::Etc::sourcelist="sources.list.d/vesta.list" \
-o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0" -qq
fi
# Updating php pacakge
if [ -z "$($VESTA/php/bin/php -v|grep 'PHP 5.6')" ]; then
if [ -e "/etc/redhat-release" ]; then
$yum -y update vesta-php
check_result $? "vesta-php package upgrade failed" $E_UPDATE
else
apt-get -y install vesta-php
check_result $? "vesta-php package upgrade failed" $E_UPDATE
fi
fi
# Adding vesta-ioncube package
if [ -e "/etc/redhat-release" ]; then
rpm -q vesta-ioncube >/dev/null 2>&1
if [ $? -ne 0 ]; then
$yum -y install vesta-ioncube >/dev/null 2>&1
check_result $? "vesta-ioncube package installation failed" $E_UPDATE
fi
else
dpkg -l vesta-ioncube |grep ^ii >/dev/null 2>&1
if [ $? -ne 0 ]; then
apt-get -y install vesta-ioncube >/dev/null 2>&1
check_result $? "vesta-ioncube package installation failed" $E_UPDATE
fi
fi
# Adding vesta-softaculous package
if [ -e "/etc/redhat-release" ]; then
rpm -q vesta-softaculous >/dev/null 2>&1
if [ $? -ne 0 ]; then
$yum -y install vesta-softaculous >/dev/null 2>&1
check_result $? "vesta-softaculous package installation failed" $E_UPDATE
fi
else
dpkg -l vesta-softaculous |grep ^ii >/dev/null 2>&1
if [ $? -ne 0 ]; then
apt-get -y install vesta-softaculous >/dev/null 2>&1
check_result $? "vesta-softaculous package installation failed" $E_UPDATE
fi
fi
# Installing softaculous
if [ ! -e "$VESTA/softaculous/vst_installed" ]; then
cd $VESTA/softaculous
wget -q http://c.vestacp.com/3rdparty/softaculous_install.inc
$VESTA/php/bin/php softaculous_install.inc
check_result $? "vesta-softaculous package installation failed" $E_UPDATE
touch $VESTA/softaculous/vst_installed
fi
# Updating SOFTACULOUS value
if [ -z "$(grep SOFTACULOUS $VESTA/conf/vesta.conf)" ]; then
echo "SOFTACULOUS='yes'" >> $VESTA/conf/vesta.conf
else
sed -i "s/SOFTACULOUS.*/SOFTACULOUS='yes'/g" \
$VESTA/conf/vesta.conf
fi
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
# Logging
log_event "$OK" "$ARGUMENTS"
exit

42
bin/v-delete-vesta-softaculous Executable file
View file

@ -0,0 +1,42 @@
#!/bin/bash
# info: delete vesta softaculous
# options: NONE
#
# The script disables softaculous plugin
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Includes
source $VESTA/func/main.sh
source $VESTA/conf/vesta.conf
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
if [ "$SOFTACULOUS" = 'no' ] || [ -z "$SOFTACULOUS" ]; then
exit
fi
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Updating SOFTACULOUS value
sed -i "s/SOFTACULOUS.*/SOFTACULOUS='no'/g" \
$VESTA/conf/vesta.conf
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
# Logging
log_event "$OK" "$ARGUMENTS"
exit

View file

@ -50,7 +50,8 @@ json_list() {
"BACKUP": "'$BACKUP'", "BACKUP": "'$BACKUP'",
"MAIL_URL": "'$MAIL_URL'", "MAIL_URL": "'$MAIL_URL'",
"DB_PMA_URL": "'$DB_PMA_URL'", "DB_PMA_URL": "'$DB_PMA_URL'",
"DB_PGA_URL": "'$DB_PGA_URL'" "DB_PGA_URL": "'$DB_PGA_URL'",
"SOFTACULOUS": "'$SOFTACULOUS'"
} }
}' }'
} }
@ -131,6 +132,9 @@ shell_list() {
if [ ! -z "$SFTPJAIL_KEY" ]; then if [ ! -z "$SFTPJAIL_KEY" ]; then
echo "SFTP Chroot: $SFTPJAIL_KEY" echo "SFTP Chroot: $SFTPJAIL_KEY"
fi fi
if [ ! -z "$SOFTACULOUS" ]; then
echo "Softaculous: $SOFTACULOUS"
fi
if [ ! -z "$LANGUAGE" ] && [ "$LANGUAGE" != 'en' ]; then if [ ! -z "$LANGUAGE" ] && [ "$LANGUAGE" != 'en' ]; then
echo "Language: $LANGUAGE" echo "Language: $LANGUAGE"
fi fi
@ -171,7 +175,7 @@ csv_list() {
echo -n "'$CRON_SYSTEM','$DISK_QUOTA','$FIREWALL_SYSTEM'," echo -n "'$CRON_SYSTEM','$DISK_QUOTA','$FIREWALL_SYSTEM',"
echo -n "'$FIREWALL_EXTENSION','$FILEMANAGER_KEY','$SFTPJAIL_KEY'," echo -n "'$FIREWALL_EXTENSION','$FILEMANAGER_KEY','$SFTPJAIL_KEY',"
echo -n "'$REPOSITORY','$VERSION','$LANGUAGE','$BACKUP_GZIP','$BACKUP'," echo -n "'$REPOSITORY','$VERSION','$LANGUAGE','$BACKUP_GZIP','$BACKUP',"
echo -n "'$MAIL_URL','$DB_PMA_URL','$DB_PGA_URL'" echo -n "'$MAIL_URL','$DB_PMA_URL','$DB_PGA_URL', '$SOFTACULOUS'"
echo echo
} }

View file

@ -0,0 +1,46 @@
#!/bin/bash
# info: adding cronjob for vesta-softaculous installation
# options: NONE
#
# The function adds cronjob for letsencrypt ssl certificate installation
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Includes
source $VESTA/func/main.sh
source $VESTA/func/domain.sh
source $VESTA/conf/vesta.conf
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
is_system_enabled "$CRON_SYSTEM" 'CRON_SYSTEM'
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Adding cronjob for vesta-softaculous
cmd="sudo /usr/local/vesta/bin/v-add-vesta-softaculous"
check_cron=$(grep "$cmd" $VESTA/data/users/admin/cron.conf 2> /dev/null)
if [ -z "$check_cron" ] && [ ! -z "$CRON_SYSTEM" ]; then
$BIN/v-add-cron-job admin '*/1' '*' '*' '*' '*' "$cmd"
fi
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
# Logging
log_event "$OK" "$ARGUMENTS"
exit

View file

@ -463,7 +463,7 @@ if (!empty($_POST['save'])) {
// activating softaculous // activating softaculous
if (empty($_SESSION['error_msg'])) { if (empty($_SESSION['error_msg'])) {
if($_SESSION['SOFTACULOUS'] != $_POST['v_softaculous'] && $_POST['v_softaculous'] == 'yes'){ if($_SESSION['SOFTACULOUS'] != $_POST['v_softaculous'] && $_POST['v_softaculous'] == 'yes'){
exec (VESTA_CMD."v-add-sys-softaculous", $output, $return_var); exec (VESTA_CMD."v-add-vesta-softaculous WEB", $output, $return_var);
check_return_code($return_var,$output); check_return_code($return_var,$output);
unset($output); unset($output);
if (empty($_SESSION['error_msg'])) { if (empty($_SESSION['error_msg'])) {
@ -476,7 +476,7 @@ if (!empty($_POST['save'])) {
// disable softaculous // disable softaculous
if (empty($_SESSION['error_msg'])) { if (empty($_SESSION['error_msg'])) {
if($_SESSION['SOFTACULOUS'] != $_POST['v_softaculous'] && $_POST['v_softaculous'] == 'no'){ if($_SESSION['SOFTACULOUS'] != $_POST['v_softaculous'] && $_POST['v_softaculous'] == 'no'){
exec (VESTA_CMD."v-delete-sys-softaculous", $output, $return_var); exec (VESTA_CMD."v-delete-vesta-softaculous", $output, $return_var);
check_return_code($return_var,$output); check_return_code($return_var,$output);
unset($output); unset($output);
if (empty($_SESSION['error_msg'])) { if (empty($_SESSION['error_msg'])) {

View file

@ -280,67 +280,6 @@
<br><br> <br><br>
</td> </td>
</tr> </tr>
<tr>
<td class="vst-text step-top">
<label>
<input type="checkbox" class="vst-checkbox use_relay" name="v_mail_relay"">
<?=__('Use relay')?>
</label>
</td>
</tr>
<tr class="mail-relay" style="display: none;">
<td>
<table>
<tr>
<td class="vst-text step-left input-label">
<?php print __('Hostname');?><br>
<span style="font-size: 10pt; color:#777;"><?=__('enter hostname or IP address');?></span>
</td>
</tr>
<tr>
<td class="step-left">
<input type="text" size="20" class="vst-input v-ftp-user" name="v_relay_hostname" value="<?=htmlentities(trim($v_relay_hostname, "'"))?>">
</td>
</tr>
<tr>
<td class="vst-text step-left input-label">
<?php print __('Port');?><br>
</td>
</tr>
<tr>
<td class="step-left">
<input type="text" size="20" class="vst-input v-ftp-user" name="v_relay_port" value="<?=htmlentities(trim($v_relay_port, "'"))?>">
</td>
</tr>
<tr>
<td class="vst-text step-left input-label">
<?php print __('Username');?><br>
</td>
</tr>
<tr>
<td class="step-left">
<input type="text" size="20" class="vst-input v-ftp-user" name="v_relay_username" value="<?=htmlentities(trim($v_relay_username, "'"))?>">
</td>
</tr>
<tr>
<td class="vst-text step-left input-label">
<?php print __('Password');?><br>
</td>
</tr>
<tr>
<td class="step-left">
<input type="text" size="20" class="vst-input v-ftp-user" name="v_relay_password" value="<?=htmlentities(trim($v_relay_password, "'"))?>">
</td>
</tr>
</table>
</td>
</tr>
</table> </table>
</td> </td>
@ -925,7 +864,7 @@
</select> </select>
<br><br> <br><br>
<div class="softaculous description" <? if ($_SESSION['SOFTACULOUS'] != 'yes') { ?>style="display:none" <? } ?>> <div class="softaculous description" <? if ($_SESSION['SOFTACULOUS'] != 'yes') { ?>style="display:none" <? } ?>>
<h5>Web Application Installations Made Easy</h5> <h5>* plugin installation will run in background</h5>
Softaculous is a great Auto Installer having 426 great scripts, 1115 PHP Classes Softaculous is a great Auto Installer having 426 great scripts, 1115 PHP Classes
and we are still adding more. Softaculous is ideal for Web Hosting companies and and we are still adding more. Softaculous is ideal for Web Hosting companies and
it could give a significant boost to your sales. These scripts cover most of the it could give a significant boost to your sales. These scripts cover most of the