From f75065842f53b0f5ee56681eb85e3ce4bbea1a27 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Tue, 2 Oct 2018 13:27:47 +0000 Subject: Add helper function to read out CRIU version This adds a simple CRIU version check using the vendored-in CRIU go bindings. Signed-off-by: Adrian Reber --- pkg/criu/criu.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 pkg/criu/criu.go (limited to 'pkg') diff --git a/pkg/criu/criu.go b/pkg/criu/criu.go new file mode 100644 index 000000000..f4cce238a --- /dev/null +++ b/pkg/criu/criu.go @@ -0,0 +1,19 @@ +package criu + +import ( + "github.com/checkpoint-restore/go-criu" +) + +// MinCriuVersion for Podman at least CRIU 3.11 is required +const MinCriuVersion = 31100 + +// CheckForCriu uses CRIU's go bindings to check if the CRIU +// binary exists and if it at least the version Podman needs. +func CheckForCriu() bool { + c := criu.MakeCriu() + result, err := c.IsCriuAtLeast(MinCriuVersion) + if err != nil { + return false + } + return result +} -- cgit v1.2.3-54-g00ecf