|
| 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 |
0 commit comments