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() { function pbc-version() {
local vers_info=$("$PBC" version) local vers_info rc
local rc=$? vers_info=$("$PBC" version)
(( $rc != 0 )) && echo "Error running $PBC version ... exited with rc=$rc" >&2 && return $rc rc=$?
(( rc != 0 )) && echo "Error running $PBC version ... exited with rc=$rc" >&2 && return $rc
echo "$vers_info" | grep client echo "$vers_info" | grep client
rc=$? 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 return $rc
} }
@@ -116,8 +117,8 @@ function install_proxmox_backup_client() {
! $installed && update=false ! $installed && update=false
if $installed && ! $update; then if $installed && ! $update; then
local version=$("$PBC" version | head -n 1) local version
(( $? != 0 )) && echo "Error running $PBC version: exited with rc=$?" >&2 && return 10 version=$(pbc-version) || return 10
echo "Info: skip installation of proxmox-backup-client, already installed ($version)" echo "Info: skip installation of proxmox-backup-client, already installed ($version)"
return 0 return 0
fi fi