From ed410be4ea36a389fabd5312eb2450796f67c2fc Mon Sep 17 00:00:00 2001 From: Andrew Engelbrecht Date: Mon, 18 Oct 2021 21:31:19 -0400 Subject: [PATCH] bump the protocol version to 2 the API between client and server has changed, so we need the new protocol version number. --- kaya | 3 +-- kaya-client | 19 +++++++++++++------ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/kaya b/kaya index c8f29f9..4d98089 100755 --- a/kaya +++ b/kaya @@ -24,8 +24,7 @@ set -eE -o pipefail trap 'echo "kaya: backup failed" >&2' ERR -# first stable version of API between kaya and kaya-client -kaya_protocol_version=1 +kaya_protocol_version=2 kaya-usage() { cat << EOF >&2 diff --git a/kaya-client b/kaya-client index 1a82f9b..db3a4fb 100755 --- a/kaya-client +++ b/kaya-client @@ -23,13 +23,20 @@ shopt -s inherit_errexit 2>/dev/null ||: # ignore fail in bash < 4.4 set -eE -o pipefail trap 'echo "kaya-client: backup failed" >&2' ERR + +preferred_protocol_version=2 + read -r kaya_protocol_version -if [[ $kaya_protocol_version != 1 ]] ; then - echo "kaya-client: error: mismatched protocol version with kaya" >&2 - echo "kaya-client: error: kaya protocol version: ${kaya_protocol_version} kaya-client protocol version: 1" >&2 - exit 1 -fi +case $kaya_protocol_version in + 1|2) + ;; + *) + echo "kaya-client: error: mismatched protocol version with kaya" >&2 + echo "kaya-client: error: kaya protocol version: ${kaya_protocol_version} kaya-client protocol version: ${preferred_protocol_version}" >&2 + exit 1 + ;; +esac read -r password @@ -52,5 +59,5 @@ if (( ret )); then exit $ret else # needed in case ssh dies on the backup server, and exits with 0 (patched in OpenSSH version 8.8) - echo "KAYA_SUCCESSFUL_BACKUP_MESSAGE" + if [[ $kaya_protocol_version -ge 2 ]] ; then echo "KAYA_SUCCESSFUL_BACKUP_MESSAGE" ; fi fi -- 2.25.1