Skip to content

Commit 747bd13

Browse files
ptrinhjaapmarcusScIT-Raphael
authored
Bump b2 cli to latest official version (hestiacp#2349)
* Bump b2 cli to latest official version Bump b2 cli to latest official version. This will fix the issue that Backblaze backup fail to run with /tmp noexec * Update hestia.spec * Update upgrade.sh * Add upgrade function b2 tool * Adjust typo. Co-authored-by: Jaap Marcus <9754650+jaapmarcus@users.noreply.github.com> Co-authored-by: Raphael Schneeberger <rs@scit.ch>
1 parent 4847330 commit 747bd13

File tree

5 files changed

+57
-8
lines changed

5 files changed

+57
-8
lines changed

bin/v-add-backup-host

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,16 @@ path=${5-/backup}
2121
port=$6
2222

2323
# Includes
24-
# shellcheck source=/etc/hestiacp/hestia.conf
25-
source /etc/hestiacp/hestia.conf
2624
# shellcheck source=/usr/local/hestia/func/main.sh
2725
source $HESTIA/func/main.sh
28-
2926
# load config file
3027
source_conf "$HESTIA/conf/hestia.conf"
28+
# Fetch current verison B2 CLI tool
29+
source_conf "$HESTIA/install/upgrade/upgrade.conf"
3130

3231
# Paths
3332
b2cli="/usr/local/bin/b2"
34-
b2lnk="https://f000.backblazeb2.com/file/backblazefiles/b2/cli/linux/b2"
33+
b2lnk="https://github.com/Backblaze/B2_Command_Line_Tool/releases/download/v$b2_v/b2-linux"
3534

3635
# Defining ftp command function
3736
ftpc() {

func/upgrade.sh

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ source $HESTIA/func/syshealth.sh
1414
####### Functions & Initialization #######
1515
#####################################################################
1616

17+
# Define version check function
18+
function version_ge(){ test "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1" -o -n "$1" -a "$1" = "$2"; }
19+
1720
add_upgrade_message (){
1821
if [ -f "$HESTIA_BACKUP/message.log" ]; then
1922
echo -e $1 >> $HESTIA_BACKUP/message.log
@@ -545,12 +548,29 @@ upgrade_start_routine() {
545548
#####################################################################
546549
}
547550

551+
upgrade_b2_tool(){
552+
b2cli="/usr/local/bin/b2"
553+
b2lnk="https://github.com/Backblaze/B2_Command_Line_Tool/releases/download/v$b2_v/b2-linux"
554+
if [ -f "$b2cli" ]; then
555+
b2_version=$(b2 version | grep -o -E '[0-9].[0-9].[0-9]+' | head -1);
556+
if version_ge "$b2_version" "$b2_v"; then
557+
echo "[ * ] Backblaze CLI tool is up to date ($b2_v)..."
558+
else
559+
echo "[ * ] Upgrading Backblaze CLI tool to version v$b2_v..."
560+
rm $b2cli
561+
wget -O $b2cli $b2lnk > /dev/null 2>&1
562+
chmod +x $b2cli > /dev/null 2>&1
563+
if [ ! -f "$b2cli" ]; then
564+
echo "Error: Binary download failed, b2 doesnt work as expected."
565+
exit 3
566+
fi
567+
fi
568+
fi
569+
}
570+
548571
upgrade_phpmyadmin() {
549572
# Check if MariaDB/MySQL is installed on the server before attempting to install or upgrade phpMyAdmin
550573
if [ -n "$(echo $DB_SYSTEM | grep -w 'mysql')" ]; then
551-
# Define version check function
552-
function version_ge(){ test "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1" -o -n "$1" -a "$1" = "$2"; }
553-
554574
pma_release_file=$(ls /usr/share/phpmyadmin/RELEASE-DATE-* 2>/dev/null |tail -n 1)
555575
if version_ge "${pma_release_file##*-}" "$pma_v"; then
556576
echo "[ * ] phpMyAdmin is up to date (${pma_release_file##*-})..."

install/upgrade/upgrade.conf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,6 @@ fm_v='7.7.0'
5454

5555
# Set version of PHPMailer to update during upgrade if not already installed
5656
pm_v='6.5.3'
57+
58+
# Backblaze
59+
b2_v='3.2.0'

src/deb/hestia/postinst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ upgrade_phpmailer | tee -a $LOG
8989
# Upgrade phpMyAdmin if applicable
9090
upgrade_phpmyadmin | tee -a $LOG
9191

92+
# Upgrade blackblaze-cli-took if applicable
93+
upgrade_b2_tool | tee -a $LOG
94+
9295
# Set new version number in hestia.conf
9396
upgrade_set_version $new_version
9497
upgrade_set_branch $new_version

src/rpm/hestia/hestia.spec

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,32 @@ if [ -e "/usr/local/hestia/data/users/admin" ]; then
8686
# Execute version-specific upgrade scripts
8787
upgrade_start_routine
8888

89+
# Update Web domain templates
90+
upgrade_rebuild_web_templates | tee -a $LOG
91+
92+
# Update Mail domain templates
93+
upgrade_rebuild_mail_templates | tee -a $LOG
94+
95+
# Update DNS zone templates
96+
upgrade_rebuild_dns_templates | tee -a $LOG
97+
98+
# Upgrade File Manager and update configuration
99+
upgrade_filemanager | tee -a $LOG
100+
101+
# Upgrade Rainloop if applicable
102+
upgrade_rainloop | tee -a $LOG
103+
104+
# Upgrade Roundcube if applicable
105+
upgrade_roundcube | tee -a $LOG
106+
107+
# Upgrade PHPMailer if applicable
108+
upgrade_phpmailer | tee -a $LOG
109+
89110
# Upgrade phpMyAdmin if applicable
90-
upgrade_phpmyadmin
111+
upgrade_phpmyadmin | tee -a $LOG
112+
113+
# Upgrade blackblaze-cli-took if applicable
114+
upgrade_b2_tool | tee -a $LOG
91115

92116
# Set new version number in hestia.conf
93117
upgrade_set_version

0 commit comments

Comments
 (0)