@@ -29,7 +29,8 @@ if [ "$release" -eq 8 ]; then
2929 mysql-client postgresql postgresql-contrib phppgadmin phpMyAdmin mc
3030 flex whois rssh git idn zip sudo bc ftp lsof ntpdate rrdtool quota
3131 e2fslibs bsdutils e2fsprogs curl imagemagick fail2ban dnsutils
32- bsdmainutils cron vesta vesta-nginx vesta-php expect libmail-dkim-perl unrar-free"
32+ bsdmainutils cron vesta vesta-nginx vesta-php expect libmail-dkim-perl
33+ unrar-free vim-common"
3334else
3435 software=" nginx apache2 apache2-utils apache2.2-common
3536 apache2-suexec-custom libapache2-mod-ruid2
4142 mysql-client postgresql postgresql-contrib phppgadmin phpMyAdmin mc
4243 flex whois rssh git idn zip sudo bc ftp lsof ntpdate rrdtool quota
4344 e2fslibs bsdutils e2fsprogs curl imagemagick fail2ban dnsutils
44- bsdmainutils cron vesta vesta-nginx vesta-php expect unrar-free"
45+ bsdmainutils cron vesta vesta-nginx vesta-php expect unrar-free
46+ vim-common"
4547fi
4648
4749# Defining help function
967969if [ " $postgresql " = ' yes' ]; then
968970 wget $vestacp /postgresql/pg_hba.conf -O /etc/postgresql/* /main/pg_hba.conf
969971 service postgresql restart
970- sudo -u postgres psql -c " ALTER USER postgres WITH PASSWORD '$vpass '" 2> /dev/null
972+ sudo -u postgres psql -c " ALTER USER postgres WITH PASSWORD '$vpass '"
971973
972974 # Configuring phpPgAdmin
973975 if [ " $apache " = ' yes' ]; then
974- wget $vestacp /pga/phppgadmin.conf -O /etc/apache2/conf.d/phppgadmin.conf
976+ wget $vestacp /pga/phppgadmin.conf \
977+ -O /etc/apache2/conf.d/phppgadmin.conf
975978 fi
976979 wget $vestacp /pga/config.inc.php -O /etc/phppgadmin/config.inc.php
977980fi
@@ -1065,13 +1068,13 @@ if [ "$clamd" = 'yes' ]; then
10651068 mkdir /var/run/clamav
10661069 fi
10671070 chown -R clamav:clamav /var/run/clamav
1068- if [ -f " /lib/systemd/system/clamav-daemon.service" ]; then
1069- file=" /lib/systemd/system/clamav-daemon.service"
1070- if [ $( grep -ic " mkdir" $file ) -eq 0 ]; then
1071- sed -i " s/\[Service\]/\[Service\]\nExecStartPre = \/bin\/mkdir -p \/var\/run\/clamav\nExecStartPre = \/bin\/chown -R clamav:clamav \/var\/run\/clamav/g" $file
1072- fi
1071+ if [ -e " /lib/systemd/system/clamav-daemon.service" ]; then
1072+ exec_pre1=' ExecStartPre=/bin/mkdir -p /var/run/clamav'
1073+ exec_pre2=' ExecStartPre=/bin/chown -R clamav:clamav /var/run/clamav'
1074+ sed -i " s|\[Service\]/|[Service]\n$exec_pre1 \n$exec_pre2 |g" \
1075+ /lib/systemd/system/clamav-daemon.service
1076+ systemctl daemon-reload
10731077 fi
1074-
10751078 service clamav-daemon start
10761079 check_result $? " clamav-daeom start failed"
10771080fi
@@ -1086,7 +1089,8 @@ if [ "$spamd" = 'yes' ]; then
10861089 sed -i " s/ENABLED=0/ENABLED=1/" /etc/default/spamassassin
10871090 service spamassassin start
10881091 check_result $? " spamassassin start failed"
1089- if [[ $( systemctl list-unit-files | grep spamassassin) =~ " disabled" ]]; then
1092+ unit_files=" $( systemctl list-unit-files | grep spamassassin) "
1093+ if [[ " $unit_files " =~ " disabled" ]]; then
10901094 systemctl enable spamassassin
10911095 fi
10921096fi
@@ -1113,9 +1117,11 @@ if [ "$exim" = 'yes' ] && [ "$mysql" = 'yes' ]; then
11131117 /etc/roundcube/plugins/password/config.inc.php
11141118 r=" $( gen_pass) "
11151119 mysql -e " CREATE DATABASE roundcube"
1116- mysql -e " GRANT ALL ON roundcube.* TO roundcube@localhost IDENTIFIED BY '$r '"
1120+ mysql -e " GRANT ALL ON roundcube.*
1121+ TO roundcube@localhost IDENTIFIED BY '$r '"
11171122 sed -i " s/%password%/$r /g" /etc/roundcube/db.inc.php
1118- sed -i " s/localhost/$servername /g" /etc/roundcube/plugins/password/config.inc.php
1123+ sed -i " s/localhost/$servername /g" \
1124+ /etc/roundcube/plugins/password/config.inc.php
11191125 mysql roundcube < /usr/share/dbconfig-common/data/roundcube/install/mysql
11201126 chmod a+r /etc/roundcube/main.inc.php
11211127 if [ " $release " -eq 8 ]; then
@@ -1134,13 +1140,15 @@ if [ "$exim" = 'yes' ] && [ "$mysql" = 'yes' ]; then
11341140 if [[ -L " $tinymceFolder " && -d " $tinymceFolder " ]]; then
11351141 if [ -f " $tinymceBadJS " ]; then
11361142 wget $tinymceFixArchiveURL -O $tinymceFixArchive
1137- if [[ -f " $tinymceFixArchive " && -s " $tinymceFixArchive " ]]; then
1143+ if [[ -f " $tinymceFixArchive " && -s " $tinymceFixArchive " ]]
1144+ then
11381145 rm $tinymceFolder
11391146 tar -xzf $tinymceFixArchive -C $tinymceParentFolder
11401147 rm $tinymceFixArchive
11411148 chown -R root:root $tinymceFolder
11421149 else
1143- echo " File roundcube-tinymce.tar.gz is not downloaded, RoundCube tinyMCE fix is not applied"
1150+ echo -n " File roundcube-tinymce.tar.gz is not downloaded,"
1151+ echo " RoundCube tinyMCE fix is not applied"
11441152 rm $tinymceFixArchive
11451153 fi
11461154 fi
@@ -1210,7 +1218,7 @@ $VESTA/bin/v-update-sys-ip
12101218
12111219# Get main ip
12121220ip=$( ip addr| grep ' inet ' | grep global| head -n1| awk ' {print $2}' | cut -f1 -d/)
1213- copy_of_ip =$ip
1221+ local_ip =$ip
12141222
12151223# Firewall configuration
12161224if [ " $iptables " = ' yes' ]; then
@@ -1227,19 +1235,19 @@ fi
12271235
12281236# Configuring libapache2-mod-remoteip
12291237if [ " $apache " = ' yes' ] && [ " $nginx " = ' yes' ] ; then
1230- copy_of_pub_ip= $pub_ip
1231- echo " <IfModule mod_remoteip.c>" > /etc/apache2/mods-available/ remoteip.conf
1232- echo " RemoteIPHeader X-Real-IP" >> /etc/apache2/mods-available/ remoteip.conf
1233- if [ " $copy_of_ip " != " 127.0.0.1" ] && [ " $copy_of_pub_ip " != " 127.0.0.1" ]; then
1234- echo " RemoteIPInternalProxy 127.0.0.1" >> /etc/apache2/mods-available/ remoteip.conf
1238+ cd /etc/apache2/mods-available
1239+ echo " <IfModule mod_remoteip.c>" > remoteip.conf
1240+ echo " RemoteIPHeader X-Real-IP" >> remoteip.conf
1241+ if [ " $local_ip " != " 127.0.0.1" ] && [ " $pub_ip " != " 127.0.0.1" ]; then
1242+ echo " RemoteIPInternalProxy 127.0.0.1" >> remoteip.conf
12351243 fi
1236- if [ ! -z " $copy_of_ip " ] && [ " $copy_of_ip " != " $copy_of_pub_ip " ]; then
1237- echo " RemoteIPInternalProxy $copy_of_ip " >> /etc/apache2/mods-available/ remoteip.conf
1244+ if [ ! -z " $local_ip " ] && [ " $local_ip " != " $pub_ip " ]; then
1245+ echo " RemoteIPInternalProxy $local_ip " >> remoteip.conf
12381246 fi
1239- if [ ! -z " $copy_of_pub_ip " ]; then
1240- echo " RemoteIPInternalProxy $copy_of_pub_ip " >> /etc/apache2/mods-available/ remoteip.conf
1247+ if [ ! -z " $pub_ip " ]; then
1248+ echo " RemoteIPInternalProxy $pub_ip " >> remoteip.conf
12411249 fi
1242- echo " </IfModule>" >> /etc/apache2/mods-available/ remoteip.conf
1250+ echo " </IfModule>" >> remoteip.conf
12431251 sed -i " s/LogFormat \" %h/LogFormat \" %a/g" /etc/apache2/apache2.conf
12441252 a2enmod remoteip
12451253 service apache2 restart
0 commit comments