@@ -3,20 +3,9 @@ HESTIA="/usr/local/hestia"
33HESTIA_BACKUP=" /root/hst_upgrade/$( date +%d%m%Y%H%M) "
44spinner=" /-\|"
55
6- # load hestia.conf
7- source $HESTIA /conf/hestia.conf
8-
96# Set version(s)
107pma_v=' 4.8.5'
118
12- # Initialize backup directory
13- mkdir -p $HESTIA_BACKUP /templates/
14- mkdir -p $HESTIA_BACKUP /packages/
15-
16- # load hestia main functions
17- source /usr/local/hestia/func/main.sh
18-
19- echo " (*) Upgrading to Hestia Control Panel v$VERSION ..."
209# Upgrade phpMyAdmin
2110if [ " $DB_SYSTEM " = ' mysql' ]; then
2211 # Display upgrade information
@@ -72,172 +61,7 @@ if [ ! -z "$BACKEND_PORT" ]; then
7261 /usr/local/hestia/bin/v-change-sys-port $BACKEND_PORT
7362fi
7463
75- # Generating dhparam.
76- if [ ! -e /etc/ssl/dhparam.pem ]; then
77- echo " (*) Enabling HTTPS Strict Transport Security (HSTS) support"
78- echo -n " This will take some time, please wait..."
79- openssl dhparam 4096 -out /etc/ssl/dhparam.pem > /dev/null 2>&1 &
80- BACK_PID=$!
81-
82- # Check if package installation is done, print a spinner
83- spin_i=1
84- while kill -0 $BACK_PID > /dev/null 2>&1 ; do
85- printf " \b${spinner: spin_i++% ${# spinner} : 1} "
86- sleep 0.5
87- done
88-
89- # Do a blank echo to get the \n back
90- echo
91-
92- # Update dns servers in nginx.conf
93- dns_resolver=$( cat /etc/resolv.conf | grep -i ' ^nameserver' | cut -d ' ' -f2 | tr ' \r\n' ' ' | xargs)
94- sed -i " s/1.0.0.1 1.1.1.1/$dns_resolver /g" /etc/nginx/nginx.conf
95- fi
96-
97- # Update default page templates
98- echo " (*) Replacing default templates and packages..."
99- echo " Existing templates have been backed up to the following location:"
100- echo " $HESTIA_BACKUP /templates/"
101-
102- # Back up default package and install latest version
103- if [ -d $HESTIA /data/packages/ ]; then
104- cp -f $HESTIA /data/packages/default.pkg $HESTIA_BACKUP /packages/
105- fi
106-
107- # Back up old template files and install the latest versions
108- if [ -d $HESTIA /data/templates/ ]; then
109- cp -rf $HESTIA /data/templates $HESTIA_BACKUP /
110- $HESTIA /bin/v-update-web-templates
111- $HESTIA /bin/v-update-dns-templates
112- fi
113-
114- # Remove old Office 365 template as there is a newer version with an updated name
115- if [ -f $HESTIA /data/templates/dns/o365.tpl ]; then
116- rm -f $HESTIA /data/templates/dns/o365.tpl
117- fi
118-
119- # Back up and remove default index.html if it exists
120- if [ -f /var/www/html/index.html ]; then
121- cp -rf /var/www/html/index.html $HESTIA_BACKUP /templates/
122- rm -rf /var/www/html/index.html
123- fi
124-
125- # Configure default success page and set permissions on CSS, JavaScript, and Font dependencies for unassigned hosts
126- if [ ! -d /var/www/html ]; then
127- mkdir -p /var/www/html/
128- fi
129-
130- if [ ! -d /var/www/document_errors/ ]; then
131- mkdir -p /var/www/document_errors/
132- fi
133-
134- cp -rf $HESTIA /install/deb/templates/web/unassigned/* /var/www/html/
135- cp -rf $HESTIA /install/deb/templates/web/skel/document_errors/* /var/www/document_errors/
136- chmod 644 /var/www/html/*
137- chmod 751 /var/www/html/css
138- chmod 751 /var/www/html/js
139- chmod 751 /var/www/html/webfonts
140- chmod 644 /var/www/document_errors/*
141- chmod 751 /var/www/document_errors/css
142- chmod 751 /var/www/document_errors/js
143- chmod 751 /var/www/document_errors/webfonts
144-
145- # Correct permissions on CSS, JavaScript, and Font dependencies for default templates
146- chmod 751 $HESTIA /data/templates/web/skel/document_errors/css
147- chmod 751 $HESTIA /data/templates/web/skel/document_errors/js
148- chmod 751 $HESTIA /data/templates/web/skel/document_errors/webfonts
149- chmod 751 $HESTIA /data/templates/web/skel/public_* html/css
150- chmod 751 $HESTIA /data/templates/web/skel/public_* html/js
151- chmod 751 $HESTIA /data/templates/web/skel/public_* html/webfonts
152- chmod 751 $HESTIA /data/templates/web/suspend/css
153- chmod 751 $HESTIA /data/templates/web/suspend/js
154- chmod 751 $HESTIA /data/templates/web/suspend/webfonts
155- chmod 751 $HESTIA /data/templates/web/unassigned/css
156- chmod 751 $HESTIA /data/templates/web/unassigned/js
157- chmod 751 $HESTIA /data/templates/web/unassigned/webfonts
158-
159- # Add unassigned hosts configuration to nginx and apache2
160- if [ " $WEB_BACKEND " = " php-fpm" ]; then
161- echo " (!) Unassigned hosts configuration for Apache not necessary on PHP-FPM installations."
162- elif [ " $WEB_BACKEND " = " apache2" ]; then
163- echo " (*) Adding unassigned hosts configuration to apache2..."
164- if [ -f /usr/local/hestia/data/ips/* ]; then
165- for ip in /usr/local/hestia/data/ips/* ; do
166- ipaddr=${ip##*/ }
167- rm -f /etc/apache2/conf.d/$ip .conf
168- cp -f $HESTIA /install/deb/apache2/unassigned.conf /etc/apache2/conf.d/$ipaddr .conf
169- sed -i ' s/directIP/' $ipaddr ' /g' /etc/apache2/conf.d/$ipaddr .conf
170- done
171- fi
172- elif [ " $PROXY_SYSTEM " = " nginx" ]; then
173- echo " (*) Adding unassigned hosts configuration to nginx..."
174- if [ -f /usr/local/hestia/data/ips/* ]; then
175- for ip in /usr/local/hestia/data/ips/* ; do
176- ipaddr=${ip##*/ }
177- rm -f /etc/nginx/conf.d/$ip .conf
178- cp -f $HESTIA /install/deb/nginx/unassigned.inc /etc/nginx/conf.d/$ipaddr .conf
179- sed -i ' s/directIP/' $ipaddr ' /g' /etc/nginx/conf.d/$ipaddr .conf
180- done
181- fi
182- fi
183-
184- # Set Purge to false in roundcube config - https://goo.gl/3Nja3u
185- echo " (*) Updating Roundcube configuration..."
186- if [ -f /etc/roundcube/config.inc.php ]; then
187- sed -i " s/\['flag_for_deletion'] = 'Purge';/\['flag_for_deletion'] = false;/gI" /etc/roundcube/config.inc.php
188- fi
189- if [ -f /etc/roundcube/defaults.inc.php ]; then
190- sed -i " s/\['flag_for_deletion'] = 'Purge';/\['flag_for_deletion'] = false;/gI" /etc/roundcube/defaults.inc.php
191- fi
192- if [ -f /etc/roundcube/main.inc.php ]; then
193- sed -i " s/\['flag_for_deletion'] = 'Purge';/\['flag_for_deletion'] = false;/gI" /etc/roundcube/main.inc.php
194- fi
195-
196- # Remove old OS-specific installation files if they exist to free up space
197- if [ -d $HESTIA /install/ubuntu ]; then
198- echo " (*) Removing old installation data files for Ubuntu..."
199- rm -rf $HESTIA /install/ubuntu
200- fi
201- if [ -d $HESTIA /install/debian ]; then
202- echo " (*) Removing old installation data files for Debian..."
203- rm -rf $HESTIA /install/debian
204- fi
205-
206- # Fix dovecot configuration
207- echo " (*) Updating dovecot IMAP/POP server configuration..."
208- if [ -f /etc/dovecot/conf.d/15-mailboxes.conf ]; then
209- # Remove mailboxes configuration if it exists
210- rm -f /etc/dovecot/conf.d/15-mailboxes.conf
211- fi
212- if [ -f /etc/dovecot/dovecot.conf ]; then
213- # Update dovecot configuration and restart dovecot service
214- cp -f $HESTIA /install/deb/dovecot/dovecot.conf /etc/dovecot/dovecot.conf
215- systemctl restart dovecot
216- sleep 0.5
217- fi
218-
219- # Add IMAP system variable to configuration if dovecot is installed
220- if [ -z " $IMAP_SYSTEM " ]; then
221- if [ -f /usr/bin/dovecot ]; then
222- echo " (*) Adding missing IMAP_SYSTEM variable to hestia.conf..."
223- echo " IMAP_SYSTEM = 'dovecot'" >> $HESTIA /conf/hestia.conf
224- fi
225- fi
226-
227- # Rebuild mailboxes
228- for user in ` ls /usr/local/hestia/data/users/` ; do
229- echo " (*) Rebuilding mail domains for user: $user ..."
230- v-rebuild-mail-domains $user
231- done
232-
233-
234- # Remove Webalizer and replace it with awstats as default
235- echo " (*) Setting awstats as default web statistics backend..."
236- apt purge webalizer -y > /dev/null 2>&1
237- sed -i " s/STATS_SYSTEM='webalizer,awstats'/STATS_SYSTEM='awstats'/g" $HESTIA /conf/hestia.conf
238-
23964# Move clamav to proper location - https://goo.gl/zNuM11
24065if [ ! -d /usr/local/hestia/web/edit/server/clamav-daemon ]; then
24166 mv /usr/local/hestia/web/edit/server/clamd /usr/local/web/edit/server/clamav-daemon
242- fi
243-
67+ fi
0 commit comments