mirror of
https://github.com/hashicorp/packer.git
synced 2026-09-19 06:21:41 -04:00
scripts: styles
This commit is contained in:
+7
-10
@@ -10,25 +10,22 @@ WARN_COLOR="\x1b[33;01m"
|
||||
|
||||
# http://stackoverflow.com/questions/4023830/bash-how-compare-two-strings-in-version-format
|
||||
verify_go () {
|
||||
if [[ $1 == $2 ]]
|
||||
then
|
||||
if [[ $1 == $2 ]]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
local IFS=.
|
||||
local i ver1=($1) ver2=($2)
|
||||
|
||||
for ((i=${#ver1[@]}; i<${#ver2[@]}; i++))
|
||||
do
|
||||
for ((i=${#ver1[@]}; i<${#ver2[@]}; i++)); do
|
||||
ver1[i]=0
|
||||
done
|
||||
for ((i=0; i<${#ver1[@]}; i++))
|
||||
do
|
||||
if [[ -z ${ver2[i]} ]]
|
||||
then
|
||||
|
||||
for ((i=0; i<${#ver1[@]}; i++)); do
|
||||
if [[ -z ${ver2[i]} ]]; then
|
||||
ver2[i]=0
|
||||
fi
|
||||
if ((10#${ver1[i]} > 10#${ver2[i]}))
|
||||
then
|
||||
if ((10#${ver1[i]} > 10#${ver2[i]})); then
|
||||
echo -e "${ERROR_COLOR}==> Required Go version $1 not installed. Found $2 instead"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user