From 9d8a669fbdef64158b6684ec3755b31e1462e611 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Kapica?= Date: Wed, 16 Oct 2024 01:34:19 +0200 Subject: [PATCH] Fix: command not found in automatic build --- build.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index 03f8974e..18777fe8 100755 --- a/build.sh +++ b/build.sh @@ -89,11 +89,14 @@ else echo "Virtualbox images will not be built." fi -if compare_versions $($packer_bin -v) $min_packer_ver false; then +# Get element after "Packer" or first if only version is present (handles older versions) +packer_version=$($packer_bin version -machine-readable | cut -d, -f 4 | head -n 1) + +if compare_versions $packer_version $min_packer_ver false; then echo "Compatible version of $packer_bin was found." else packer_bin=packer - if compare_versions $($packer_bin -v) $min_packer_ver false; then + if compare_versions $packer_version $min_packer_ver false; then echo "Compatible version of $packer_bin was found." else echo "Compatible version of packer was not found. Please install from here: https://www.packer.io/downloads.html"