fix error handling

This commit is contained in:
2026-08-22 05:31:27 +02:00
parent 62f6865a06
commit 22675d1be3
+7 -6
View File
@@ -43,12 +43,13 @@ function full_usage() {
}
function pbc-version() {
local vers_info=$("$PBC" version)
local rc=$?
(( $rc != 0 )) && echo "Error running $PBC version ... exited with rc=$rc" >&2 && return $rc
local vers_info rc
vers_info=$("$PBC" version)
rc=$?
(( rc != 0 )) && echo "Error running $PBC version ... exited with rc=$rc" >&2 && return $rc
echo "$vers_info" | grep client
rc=$?
(( $rc != 0 )) && echo "Error reading client version, output was:" >&2 && echo "$vers_info" >&2
(( rc != 0 )) && echo "Error reading client version, output was:" >&2 && echo "$vers_info" >&2
return $rc
}
@@ -116,8 +117,8 @@ function install_proxmox_backup_client() {
! $installed && update=false
if $installed && ! $update; then
local version=$("$PBC" version | head -n 1)
(( $? != 0 )) && echo "Error running $PBC version: exited with rc=$?" >&2 && return 10
local version
version=$(pbc-version) || return 10
echo "Info: skip installation of proxmox-backup-client, already installed ($version)"
return 0
fi