#!/bin/sh # Do an end to end checkpoint and restore with criu. set -e FAIL() { echo -n "Failed " >&2 echo "$*" >&2 exit 1 } if [ "$(id -u)" != "0" ]; then echo "ERROR: Must run as root." exit 1 fi verlte() { ! [ "$1" = "$(printf "$1\n$2" | sort -V | tail -n1)" ] } criu_version="$(criu --version | head -n1 | cut -d' ' -f 2)" if verlte "$criu_version" "1.3.1"; then echo "SKIP: skipping test because no (or wrong) criu installed." exit 0 fi name=lxc-test-criu lxc-create -t busybox -n $name || FAIL "creating container" cat >> "$(lxc-config lxc.lxcpath)/$name/config" <