diff --git a/install.sh b/install.sh index 676c35e..83067c0 100755 --- a/install.sh +++ b/install.sh @@ -11,7 +11,8 @@ shopt -s nullglob globstar VERSION=${version:-} DOWNLOAD="false" -# Check if hadolint exists +# Check if hadolint is installed and compare versions to decide +# if we should download a new version if [ -x "$(command -v hadolint)" ]; then INSTALLED_VERSION=$(hadolint --version | cut -d " " -f 4 2>&1) echo "::debug::Found existing Hadolint version: ${INSTALLED_VERSION}" @@ -19,6 +20,8 @@ if [ -x "$(command -v hadolint)" ]; then echo "::debug::Hadolint version (${INSTALLED_VERSION}) does not match requested version (${VERSION})" DOWNLOAD="true" fi +else + DOWNLOAD="true" fi # Download hadolint if necessary @@ -32,7 +35,4 @@ if [ "${DOWNLOAD}" == "true" ]; then chmod +x /usr/local/bin/hadolint fi -echo $PATH - echo "::debug:: $(hadolint --version | cut -d " " -f 4 2>&1) installed successfully" - \ No newline at end of file