From e93ad835eab95839c932363682ef5195062a6cea Mon Sep 17 00:00:00 2001 From: Caspar Derksen Date: Wed, 2 Jan 2019 21:10:35 +0100 Subject: [PATCH] fix: portability Linux/Mac --- Makefile | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index df107de..ba796d0 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,15 @@ -TAG = my/oradb +TAG = my/oradb IMAGE = oracle/database:12.2.0.1-ee FILE = images/oradb-12201-ee.tgz +ifeq ($(shell uname -s), Linux) + XARGS_ARGS = --no-run-if-empty + ZCAT = zcat +else + XARGS_ARGS = + ZCAT = gzcat +endif + .PHONY: default default: build @@ -17,15 +25,15 @@ run: build .PHONY: logs logs: - docker ps -q -f ancestor=$(TAG) | xargs docker logs -f + docker ps -q -f ancestor=$(TAG) | xargs $(XARGS_ARGS) docker logs -f .PHONY: stop stop: - -docker ps -q -f ancestor=$(TAG) | xargs docker stop + -docker ps -q -f ancestor=$(TAG) | xargs $(XARGS_ARGS) docker stop .PHONY: rm rm: stop - -docker ps -a -q -f ancestor=$(TAG) | xargs docker rm -f + -docker ps -a -q -f ancestor=$(TAG) | xargs $(XARGS_ARGS) docker rm -f .PHONY: rmi rmi: @@ -37,15 +45,15 @@ save: .PHONY: load load: - gzcat $(FILE) | docker load + $(ZCAT) $(FILE) | docker load .PHONY: clean clean: stop rmi .PHONY: clobber clobber: clean - -docker images | tail -n +2 | awk '$$1 == "" {print $$3}' | xargs docker rmi -f + -docker images | tail -n +2 | awk '$$1 == "" {print $$3}' | xargs $(XARGS_ARGS) docker rmi -f .PHONY: pristine pristine: clobber - -docker volume rm -f oradata \ No newline at end of file + -docker volume rm -f oradata