mirror of
https://github.com/containers/podman.git
synced 2025-05-20 08:36:23 +08:00
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 <areber@redhat.com>
This commit is contained in:

committed by
Adrian Reber

parent
20b5714f35
commit
f75065842f
19
pkg/criu/criu.go
Normal file
19
pkg/criu/criu.go
Normal file
@ -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
|
||||||
|
}
|
Reference in New Issue
Block a user