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.
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)
