@@ -24,10 +24,13 @@ SHELLCHECK_VERSION ?= v0.8.0
2424SHELLCHECK_BIN := out/linters/shellcheck-$(SHELLCHECK_VERSION ) -$(LINT_ARCH )
2525$(SHELLCHECK_BIN ) :
2626 mkdir -p out/linters
27- rm -rf out/linters/shellcheck-*
28- curl -sSfL https://github.com/koalaman/shellcheck/releases/download/$(SHELLCHECK_VERSION ) /shellcheck-$(SHELLCHECK_VERSION ) .$(LINT_OS_LOWER ) .$(LINT_ARCH ) .tar.xz | tar -C out/linters -xJf -
29- mv out/linters/shellcheck-$(SHELLCHECK_VERSION ) /shellcheck $@
30- rm -rf out/linters/shellcheck-$(SHELLCHECK_VERSION ) /shellcheck
27+ curl -sSfL -o $@ .tar.xz https://github.com/koalaman/shellcheck/releases/download/$(SHELLCHECK_VERSION ) /shellcheck-$(SHELLCHECK_VERSION ) .$(LINT_OS_LOWER ) .$(LINT_ARCH ) .tar.xz \
28+ || echo " Unable to fetch shellcheck for $( LINT_OS) /$( LINT_ARCH) : falling back to locally install"
29+ test -f $@ .tar.xz \
30+ && tar -C out/linters -xJf $@ .tar.xz \
31+ && mv out/linters/shellcheck-$(SHELLCHECK_VERSION ) /shellcheck $@ \
32+ || printf " #!/usr/bin/env shellcheck\n" > $@
33+ chmod u+x $@
3134
3235LINTERS += shellcheck-lint
3336shellcheck-lint : $(SHELLCHECK_BIN )
@@ -41,8 +44,9 @@ HADOLINT_VERSION ?= v2.8.0
4144HADOLINT_BIN := out/linters/hadolint-$(HADOLINT_VERSION ) -$(LINT_ARCH )
4245$(HADOLINT_BIN ) :
4346 mkdir -p out/linters
44- rm -rf out/linters/hadolint-*
45- curl -sfL https://github.com/hadolint/hadolint/releases/download/v2.6.1/hadolint-$(LINT_OS ) -$(LINT_ARCH ) > $@
47+ curl -o $@ .dl -sfL https://github.com/hadolint/hadolint/releases/download/$(HADOLINT_VERSION ) /hadolint-$(LINT_OS ) -$(LINT_ARCH ) \
48+ || echo " Unable to fetch hadolint for $( LINT_OS) /$( LINT_ARCH) , falling back to local install"
49+ test -f $@ .dl && mv $(HADOLINT_BIN ) .dl $@ || printf " #!/usr/bin/env hadolint\n" > $@
4650 chmod u+x $@
4751
4852LINTERS += hadolint-lint
@@ -73,7 +77,7 @@ $(YAMLLINT_BIN):
7377 mkdir -p out/linters
7478 rm -rf out/linters/yamllint-*
7579 curl -sSfL https://github.com/adrienverge/yamllint/archive/refs/tags/v$(YAMLLINT_VERSION ) .tar.gz | tar -C out/linters -zxf -
76- cd $(YAMLLINT_ROOT ) && pip3 install --target dist .
80+ cd $(YAMLLINT_ROOT ) && pip3 install --target dist . || pip install --target dist .
7781
7882LINTERS += yamllint-lint
7983yamllint-lint : $(YAMLLINT_BIN )
0 commit comments