/usr/bin/lxc-restore is in lxc 0.7.5-3ubuntu52.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | #!/bin/sh
set -e
_CONTAINER="${1}"
if [ -n "${_CONTAINER}" ]
then
shift
else
echo "Usage: ${0} CONTAINER [BACKUP_NUMBER]"
exit 1
fi
if [ ! -x "$(which rsync 2>/dev/null)" ]
then
echo "E: rsync - no such file"
exit 1
fi
if [ ! -x "$(which lxc-info 2>/dev/null)" ]
then
echo "E: lxc-info - no such file"
exit 1
fi
if ! lxc-info -n ${_CONTAINER} 2>&1 | grep -qs "STOPPED"
then
echo "E: ${_CONTAINER} - not stopped"
exit 1
fi
# FIXME: Assumption of /var/lib/lxc
if ls /var/lib/lxc/${_CONTAINER}/rootfs.backup* > /dev/null 2>&1
then
if [ -n "${2}" ]
then
_BACKUP="${2}"
else
_BACKUP="1"
while [ -e "/var/lib/lxc/${_CONTAINER}/rootfs.backup${_BACKUP}" ]
do
_BACKUP="$((${_BACKUP} + 1))"
done
_BACKUP="$((${_BACKUP} - 1))"
fi
rsync -aPHv --delete --progress /var/lib/lxc/${_CONTAINER}/rootfs.backup${_BACKUP}/ /var/lib/lxc/${_CONTAINER}/rootfs
fi
|