Commit ab4a1501 by Stéphane Graber

lxc-create: Allow for empty or unset template name

This restores an old behaviour where lxc-create can be called without a template. In such case, only a minimal configuration is built and no rootfs is created. However the various backingstore code is still used. Signed-off-by: 's avatarStéphane Graber <stgraber@ubuntu.com> Acked-by: 's avatarSerge E. Hallyn <serge.hallyn@ubuntu.com>
parent 1c6085cd
...@@ -284,19 +284,19 @@ if [ ! -r "$lxc_config" ]; then ...@@ -284,19 +284,19 @@ if [ ! -r "$lxc_config" ]; then
exit 1 exit 1
fi fi
# Allow for a path to be provided as the template name if [ ! -z "$lxc_template" ]; then
if [ -x "$lxc_template" ]; then # Allow for a path to be provided as the template name
template_path=$lxc_template if [ -x "$lxc_template" ]; then
else template_path=$lxc_template
template_path=${templatedir}/lxc-$lxc_template else
fi template_path=${templatedir}/lxc-$lxc_template
fi
if ! [ -x "$template_path" ]; then if ! [ -x "$template_path" ]; then
echo "$(basename $0): unknown template '$lxc_template'" >&2 echo "$(basename $0): unknown template '$lxc_template'" >&2
cleanup cleanup
fi fi
if [ ! -z "$lxc_template" ]; then
sum=$(sha1sum $template_path | cut -d ' ' -f1) sum=$(sha1sum $template_path | cut -d ' ' -f1)
echo "# Template used to create this container: $lxc_template" >> $lxc_path/$lxc_name/config echo "# Template used to create this container: $lxc_template" >> $lxc_path/$lxc_name/config
if [ -n "$*" ]; then if [ -n "$*" ]; then
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment