Skip to content

Commit 5c47bae

Browse files
committed
Fix: command not found in automatic build
1 parent 6885193 commit 5c47bae

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

build.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,14 @@ else
8989
echo "Virtualbox images will not be built."
9090
fi
9191

92-
if compare_versions $($packer_bin -v) $min_packer_ver false; then
92+
# Get element after "Packer" or first if only version is present (handles older versions)
93+
packer_version=$(echo "$packer_bin" | awk '{if (NF > 1 && $1 == "Packer") print $2; else print $1}')
94+
95+
if compare_versions $($packer_version) $min_packer_ver false; then
9396
echo "Compatible version of $packer_bin was found."
9497
else
9598
packer_bin=packer
96-
if compare_versions $($packer_bin -v) $min_packer_ver false; then
99+
if compare_versions $($packer_version) $min_packer_ver false; then
97100
echo "Compatible version of $packer_bin was found."
98101
else
99102
echo "Compatible version of packer was not found. Please install from here: https://www.packer.io/downloads.html"

0 commit comments

Comments
 (0)