sig-cloud-instance-build/openvz/img2vz.sh
Arif Ali db1dc24674 Initial import of files for OpenVZ
* added kickstart file for the image
* script to convert an image to a tarred VZ image
2014-06-17 22:08:33 +01:00

26 lines
427 B
Bash

#!/bin/bash
#
# This script imports a raw image into OpenVZ consumeable tarball. It takes one
# arguments: the name of the image file
usage() {
echo "usage: $(basename $0) <image>"
exit 1
}
image="$1"
if [[ -z $1 ]]; then
usage
fi
mount="$(mktemp -d --tmpdir)"
mount -o loop "$image" "$mount"
cd "$mount"
tar -cpzf ${image}.tar.gz --acls --selinux --xattrs .
cd - >& /dev/null
umount "$mount"
rmdir "$mount"