Skip to content

Commit 28befb9

Browse files
author
Kristan Kenney
committed
Merge branch 'hotfix/upgrade-scripts' into develop
2 parents 4e13817 + a5cb461 commit 28befb9

File tree

11 files changed

+223
-243
lines changed

11 files changed

+223
-243
lines changed

install/upgrade/0.9.8-28.sh

Lines changed: 0 additions & 76 deletions
This file was deleted.

install/upgrade/1.00.0-190621.sh

Lines changed: 0 additions & 35 deletions
This file was deleted.

install/upgrade/messages.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
function welcome_message() {
3+
echo
4+
echo ' _ _ _ _ ____ ____ '
5+
echo ' | | | | ___ ___| |_(_) __ _ / ___| _ \ '
6+
echo ' | |_| |/ _ \/ __| __| |/ _` | | | |_) | '
7+
echo ' | _ | __/\__ \ |_| | (_| | |___| __/ '
8+
echo ' |_| |_|\___||___/\__|_|\__,_|\____|_| '
9+
echo ""
10+
echo " Hestia Control Panel Upgrade Script"
11+
echo " Version: $version "
12+
echo "==================================================="
13+
echo ""
14+
echo "Existing files will be backed up to the following location:"
15+
echo "$HESTIA_BACKUP/"
16+
echo ""
17+
echo "This process may take a few moments, please wait..."
18+
echo ""
19+
}
20+
21+
function upgrade_complete() {
22+
echo ""
23+
echo " Upgrade complete! Please report any bugs or issues to"
24+
echo " https://github.com/hestiacp/hestiacp/issues"
25+
echo ""
26+
echo " We hope that you enjoy this release of Hestia Control Panel,"
27+
echo " enjoy your day!"
28+
echo ""
29+
echo " Sincerely,"
30+
echo " The Hestia Control Panel development team"
31+
echo ""
32+
echo " www.hestiacp.com"
33+
echo " Made with love & pride by the open-source community around the world."
34+
echo ""
35+
echo ""
36+
}

install/upgrade/phpmyadmin.sh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/bin/bash
2+
3+
# Define version check function
4+
function version_ge(){ test "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1" -o ! -z "$1" -a "$1" = "$2"; }
5+
6+
# Set phpMyAdmin version for upgrade
7+
pma_v='4.9.0.1'
8+
9+
pma_release_file=$(ls /usr/share/phpmyadmin/RELEASE-DATE-* 2>/dev/null |tail -n 1)
10+
if version_ge "${pma_release_file##*-}" "$pma_v"; then
11+
echo "(*) phpMyAdmin $pma_v or newer is already installed: ${pma_release_file##*-}, skipping update..."
12+
else
13+
# Display upgrade information
14+
echo "(*) Upgrade phpMyAdmin to v$pma_v..."
15+
[ -d /usr/share/phpmyadmin ] || mkdir -p /usr/share/phpmyadmin
16+
17+
# Download latest phpMyAdmin release
18+
wget --quiet https://files.phpmyadmin.net/phpMyAdmin/$pma_v/phpMyAdmin-$pma_v-all-languages.tar.gz
19+
20+
# Unpack files
21+
tar xzf phpMyAdmin-$pma_v-all-languages.tar.gz
22+
23+
# Delete file to prevent error
24+
rm -fr /usr/share/phpmyadmin/doc/html
25+
26+
# Overwrite old files
27+
cp -rf phpMyAdmin-$pma_v-all-languages/* /usr/share/phpmyadmin
28+
29+
# Set config and log directory
30+
sed -i "s|define('CONFIG_DIR', '');|define('CONFIG_DIR', '/etc/phpmyadmin/');|" /usr/share/phpmyadmin/libraries/vendor_config.php
31+
sed -i "s|define('TEMP_DIR', './tmp/');|define('TEMP_DIR', '/var/lib/phpmyadmin/tmp/');|" /usr/share/phpmyadmin/libraries/vendor_config.php
32+
33+
# Create temporary folder and change permissions
34+
if [ ! -d /usr/share/phpmyadmin/tmp ]; then
35+
mkdir /usr/share/phpmyadmin/tmp
36+
chmod 777 /usr/share/phpmyadmin/tmp
37+
fi
38+
39+
# Clean up source files
40+
rm -fr phpMyAdmin-$pma_v-all-languages
41+
rm -f phpMyAdmin-$pma_v-all-languages.tar.gz
42+
fi

install/upgrade/restart.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
echo "(*) Restarting services..."
4+
sleep 3
5+
if [ ! -z $MAIL_SYSTEM ]; then
6+
$BIN/v-restart-mail $restart
7+
fi
8+
if [ ! -z $IMAP_SYSTEM ]; then
9+
$BIN/v-restart-service $IMAP_SYSTEM $restart
10+
fi
11+
if [ ! -z $WEB_SYSTEM ]; then
12+
$BIN/v-restart-web $restart
13+
$BIN/v-restart-proxy $restart
14+
fi
15+
if [ ! -z $DNS_SYSTEM ]; then
16+
$BIN/v-restart-dns $restart
17+
fi
18+
19+
# Restart SSH daemon and Hestia Control Panel service
20+
$BIN/v-restart-service ssh $restart
21+
$BIN/v-restart-service hestia $restart

install/upgrade/version.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
if [ $VERSION = "$version" ]; then
4+
echo "(!) The latest version of Hestia Control Panel ($version) is already installed."
5+
echo " Verifying configuration..."
6+
echo ""
7+
source /usr/local/hestia/install/upgrade/versions/$version.sh
8+
VERSION="$version"
9+
fi
10+
if [ $VERSION = "0.9.8-27" ]; then
11+
source /usr/local/hestia/install/upgrade/versions/0.9.8-28.sh
12+
VERSION="0.9.8-28"
13+
fi
14+
if [ $VERSION = "0.9.8-28" ]; then
15+
source /usr/local/hestia/install/upgrade/versions/1.00.0-190618.sh
16+
VERSION="1.00.0-190618"
17+
fi
18+
if [ $VERSION = "0.10.00" ] || [ $VERSION = "1.00.0-190618" ]; then
19+
source /usr/local/hestia/install/upgrade/versions/$version.sh
20+
VERSION="$version"
21+
fi
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/bash
2+
HESTIA="/usr/local/hestia"
3+
HESTIA_BACKUP="/root/hst_upgrade/$(date +%d%m%Y%H%M)"
4+
spinner="/-\|"
5+
6+
function version_ge(){ test "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1" -o ! -z "$1" -a "$1" = "$2"; }
7+
8+
# Add amd64 to repositories to prevent notifications - https://goo.gl/hmsSV7
9+
if ! grep -q 'arch=amd64' /etc/apt/sources.list.d/nginx.list; then
10+
sed -i s/"deb "/"deb [arch=amd64] "/g /etc/apt/sources.list.d/nginx.list
11+
fi
12+
if ! grep -q 'arch=amd64' /etc/apt/sources.list.d/mariadb.list; then
13+
sed -i s/"deb "/"deb [arch=amd64] "/g /etc/apt/sources.list.d/mariadb.list
14+
fi
15+
16+
# Fix named rule for AppArmor - https://goo.gl/SPqHdq
17+
if [ "$DNS_SYSTEM" = 'bind9' ] && [ ! -f /etc/apparmor.d/local/usr.sbin.named ]; then
18+
echo "/home/** rwm," >> /etc/apparmor.d/local/usr.sbin.named 2> /dev/null
19+
fi
20+
21+
# Remove obsolete ports.conf if exists.
22+
if [ -f /usr/local/hestia/data/firewall/ports.conf ]; then
23+
rm -f /usr/local/hestia/data/firewall/ports.conf
24+
fi
25+
26+
# Reset backend port
27+
if [ ! -z "$BACKEND_PORT" ]; then
28+
/usr/local/hestia/bin/v-change-sys-port $BACKEND_PORT
29+
fi
30+
31+
# Move clamav to proper location - https://goo.gl/zNuM11
32+
if [ ! -d /usr/local/hestia/web/edit/server/clamav-daemon ]; then
33+
mv /usr/local/hestia/web/edit/server/clamd /usr/local/web/edit/server/clamav-daemon
34+
fi

0 commit comments

Comments
 (0)