Files
docker-install/Makefile
T
Sebastiaan van Stijn 0f72df0a14 shellcheck: ignore SC2317
This check gives a lot of false positives; ignoring it;

```
In build/install.sh line 106:
	set +x
        ^----^ SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).

In build/install.sh line 108:
	yy_a="$(echo "$1" | cut -d'.' -f1)"
        ^-- SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
                ^-----------------------^ SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).

In build/install.sh line 109:
	yy_b="$(echo "$2" | cut -d'.' -f1)"
        ^-- SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
                ^-----------------------^ SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).

In build/install.sh line 110:
	if [ "$yy_a" -lt "$yy_b" ]; then
        ^-- SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
           ^---------------------^ SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).

In build/install.sh line 111:
		return 1
                ^------^ SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).

In build/install.sh line 113:
	if [ "$yy_a" -gt "$yy_b" ]; then
        ^-- SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
           ^---------------------^ SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).

In build/install.sh line 114:
		return 0
                ^------^ SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).

In build/install.sh line 116:
	mm_a="$(echo "$1" | cut -d'.' -f2)"
        ^-- SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
                ^-----------------------^ SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).

In build/install.sh line 117:
	mm_b="$(echo "$2" | cut -d'.' -f2)"
        ^-- SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
                ^-----------------------^ SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).

In build/install.sh line 118:
	if [ "${mm_a#0}" -lt "${mm_b#0}" ]; then
        ^-- SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
           ^-----------------------------^ SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).

In build/install.sh line 119:
		return 1
                ^------^ SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).

In build/install.sh line 122:
	return 0
        ^------^ SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).

In build/install.sh line 659:
	exit 1
        ^----^ SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).

For more information:
  https://www.shellcheck.net/wiki/SC2317 -- Command appears to be unreachable...
make: *** [Makefile:20: shellcheck] Error 1
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-08-25 22:13:47 +02:00

35 lines
718 B
Makefile

TEST_IMAGE?=ubuntu:18.04
VERSION?=
CHANNEL?=
VOLUME_MOUNTS=-v "$(CURDIR)":/v
SHELLCHECK_EXCLUSIONS=$(addprefix -e, SC1091 SC1117 SC2317)
SHELLCHECK=docker run --rm $(VOLUME_MOUNTS) -w /v koalaman/shellcheck $(SHELLCHECK_EXCLUSIONS)
ENVSUBST_VARS=LOAD_SCRIPT_COMMIT_SHA
.PHONY: build
build: build/install.sh
build/install.sh: install.sh
mkdir -p $(@D)
LOAD_SCRIPT_COMMIT_SHA='$(shell git rev-parse HEAD)' envsubst '$(addprefix $$,$(ENVSUBST_VARS))' < $< > $@
.PHONY: shellcheck
shellcheck: build/install.sh
$(SHELLCHECK) $<
.PHONY: test
test: build/install.sh
docker run --rm -i \
$(VOLUME_MOUNTS) \
-w /v \
-e VERSION \
-e CHANNEL \
$(TEST_IMAGE) \
sh "$<"
.PHONY: clean
clean:
$(RM) -r build/