From 38e9b9a260d9be153fb9f65a5e7090b62f8817e4 Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Tue, 9 Jun 2020 16:13:10 -0400 Subject: [PATCH] makefile: automatically select docker or podman container tools After having forgot to explicitly pass CONTAINER_CMD for the millionth time I figured copying ceph-csi a smidgen and automatically selecting podman or docker based on availability would be save me some typing. Signed-off-by: John Mulligan --- Makefile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index b01ee03..79fac4a 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ CI_IMAGE_NAME = go-ceph-ci -CONTAINER_CMD := docker +CONTAINER_CMD ?= CONTAINER_OPTS := --security-opt $(shell grep -q selinux /sys/kernel/security/lsm && echo "label=disable" || echo "apparmor:unconfined") CONTAINER_CONFIG_DIR := testing/containers/ceph VOLUME_FLAGS := @@ -8,6 +8,13 @@ RESULTS_DIR := CHECK_GOFMT_FLAGS := -e -s -l IMPLEMENTS_OPTS := +ifeq ($(CONTAINER_CMD),) + CONTAINER_CMD:=$(shell docker version >/dev/null 2>&1 && echo docker) +endif +ifeq ($(CONTAINER_CMD),) + CONTAINER_CMD:=$(shell podman version >/dev/null 2>&1 && echo podman) +endif + # the full name of the marker file including the ceph version BUILDFILE=.build.$(CEPH_VERSION)