From b20daeea6ff9d1774a5fe56e59f8cb0efebcdff5 Mon Sep 17 00:00:00 2001 From: Alexandre Pujol Date: Wed, 3 Jan 2018 14:46:23 +0000 Subject: [PATCH] Fix: use is-at-least function to check program version --- extras/test/40_regression.sh | 3 ++- tomb | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/extras/test/40_regression.sh b/extras/test/40_regression.sh index c7096c1..5272288 100644 --- a/extras/test/40_regression.sh +++ b/extras/test/40_regression.sh @@ -3,10 +3,11 @@ export test_description="Tomb regression tests" source ./setup +autoload -U is-at-least TOMB_VERSION=("2.3" "2.2" "2.0.1" "2.1") zshversion=$(zsh --version | awk 'NR==1 {print $2}') -[[ $zshversion =~ "5.3" ]] && TOMB_VERSION=("2.3") +{ is-at-least "5.3" $zshversion } && TOMB_VERSION=("2.3") for version in "${TOMB_VERSION[@]}"; do URL="https://files.dyne.org/tomb/old-releases/Tomb-$version.tar.gz" diff --git a/tomb b/tomb index 4981585..edb3a5a 100755 --- a/tomb +++ b/tomb @@ -1002,7 +1002,7 @@ gpg_decrypt() { gpgpopt=(--yes) # GPG option '--try-secret-key' exist since GPG 2.1 - { option_is_set -R } && [[ $gpgver =~ "2.1." ]] && { + { option_is_set -R } && { autoload -U is-at-least && is-at-least "2.1" $gpgver } && { typeset -a recipients recipients=(${(s:,:)$(option_value -R)}) { is_valid_recipients $recipients } || {