|
|
@@ -5,70 +5,20 @@ if [ ! -e "/usr/local/hestia/data/users/admin" ]; then
|
|
|
exit
|
|
|
fi
|
|
|
|
|
|
-# Upgrade routines go here
|
|
|
-
|
|
|
# Load hestia.conf
|
|
|
source /usr/local/hestia/conf/hestia.conf
|
|
|
|
|
|
-# Set version(s)
|
|
|
-pma_v='4.8.5'
|
|
|
-
|
|
|
-# Upgrade phpMyAdmin
|
|
|
-if [ "$DB_SYSTEM" = 'mysql' ]; then
|
|
|
- # Display upgrade information
|
|
|
- echo "Upgrade phpMyAdmin to v$pma_v..."
|
|
|
-
|
|
|
- # Download latest phpMyAdmin release
|
|
|
- wget --quiet https://files.phpmyadmin.net/phpMyAdmin/$pma_v/phpMyAdmin-$pma_v-all-languages.tar.gz
|
|
|
-
|
|
|
- # Unpack files
|
|
|
- tar xzf phpMyAdmin-$pma_v-all-languages.tar.gz
|
|
|
-
|
|
|
- # Delete file to prevent error
|
|
|
- rm -fr /usr/share/phpmyadmin/doc/html
|
|
|
-
|
|
|
- # Overwrite old files
|
|
|
- cp -rf phpMyAdmin-$pma_v-all-languages/* /usr/share/phpmyadmin
|
|
|
-
|
|
|
- # Set config and log directory
|
|
|
- sed -i "s|define('CONFIG_DIR', '');|define('CONFIG_DIR', '/etc/phpmyadmin/');|" /usr/share/phpmyadmin/libraries/vendor_config.php
|
|
|
- sed -i "s|define('TEMP_DIR', './tmp/');|define('TEMP_DIR', '/var/lib/phpmyadmin/tmp/');|" /usr/share/phpmyadmin/libraries/vendor_config.php
|
|
|
-
|
|
|
- # Create temporary folder and change permissions
|
|
|
- if [ ! -d /usr/share/phpmyadmin/tmp ]; then
|
|
|
- mkdir /usr/share/phpmyadmin/tmp
|
|
|
- chmod 777 /usr/share/phpmyadmin/tmp
|
|
|
- fi
|
|
|
+# Get hestia version
|
|
|
+version=$(dpkg -l | awk '$2=="hestia" { print $3 }')
|
|
|
|
|
|
- # Clean up
|
|
|
- rm -fr phpMyAdmin-$pma_v-all-languages
|
|
|
- rm -f phpMyAdmin-$pma_v-all-languages.tar.gz
|
|
|
+# Check if upgrade routine exists for target version
|
|
|
+if [ -f "/usr/local/hestia/install/upgrade/$version.sh" ]; then
|
|
|
+ source /usr/local/hestia/install/upgrade/$version.sh
|
|
|
fi
|
|
|
|
|
|
-# Add amd64 to repositories to prevent notifications - https://goo.gl/hmsSV7
|
|
|
-if ! grep -q 'arch=amd64' /etc/apt/sources.list.d/nginx.list; then
|
|
|
- sed -i s/"deb "/"deb [arch=amd64] "/g /etc/apt/sources.list.d/nginx.list
|
|
|
+# Set new hestia version in conf file
|
|
|
+if [ "$VERSION" != "$version" ]; then
|
|
|
+ sed -I "s/VERSION='$VERSION'/VERSION='$version'/" /usr/local/hestia/conf/hestia.conf
|
|
|
fi
|
|
|
-if ! grep -q 'arch=amd64' /etc/apt/sources.list.d/mariadb.list; then
|
|
|
- sed -i s/"deb "/"deb [arch=amd64] "/g /etc/apt/sources.list.d/mariadb.list
|
|
|
-fi
|
|
|
-
|
|
|
-# Fix named rule for AppArmor - https://goo.gl/SPqHdq
|
|
|
-if [ "$DNS_SYSTEM" = 'bind9' ] && [ ! -f /etc/apparmor.d/local/usr.sbin.named ]; then
|
|
|
- echo "/home/** rwm," >> /etc/apparmor.d/local/usr.sbin.named 2> /dev/null
|
|
|
-fi
|
|
|
-
|
|
|
-# Remove obsolete ports.conf if exists.
|
|
|
-if [ -f /usr/local/hestia/data/firewall/ports.conf ]; then
|
|
|
- rm -f /usr/local/hestia/data/firewall/ports.conf
|
|
|
-fi
|
|
|
-
|
|
|
-# Reset backend port
|
|
|
-if [ ! -z "$BACKEND_PORT" ]; then
|
|
|
- /usr/local/hestia/bin/v-change-sys-port $BACKEND_PORT
|
|
|
-fi
|
|
|
-
|
|
|
-# Copy default "Success" page for unassigned hosts
|
|
|
-cp -rf $hestiacp/templates/web/unassigned/* /var/www/
|
|
|
|
|
|
exit 0
|