lxc-template: Backport --rootfs fallback from old template [GH-282]

This commit is contained in:
Fabio Rehm 2014-05-07 17:32:44 -03:00
parent 3bd22955dd
commit b210b260b1

View file

@ -88,8 +88,8 @@ if [ -z "${LXC_TARBALL}" ]; then
exit 1 exit 1
fi fi
if [ -z "${LXC_ROOTFS}" ]; then if [ -z "${LXC_PATH}" ]; then
echo "'rootfs' parameter is required" echo "'path' parameter is required"
exit 1 exit 1
fi fi
@ -98,9 +98,14 @@ if [ -z "${LXC_CONFIG}" ]; then
exit 1 exit 1
fi fi
if [ -z "${LXC_PATH}" ]; then # if $LXC_ROOTFS exists here, it was passed in with --rootfs
echo "'path' parameter is required" if [ -z "${LXC_ROOTFS}" ]; then
exit 1 config=${LXC_PATH}/config
if grep -q '^lxc.rootfs' $config 2>/dev/null ; then
LXC_ROOTFS=`grep 'lxc.rootfs =' $config | awk -F= '{ print $2 }'`
else
LXC_ROOTFS=$LXC_PATH/rootfs
fi
fi fi
# Unpack the rootfs # Unpack the rootfs