Commit 24b292c9 by Stéphane Graber

lxc-create: Support passing a full path to -t

In some cases it may be useful to pass a full path to an executable template script directly to lxc-create. Signed-off-by: 's avatarStéphane Graber <stgraber@ubuntu.com>
parent aeb958be
......@@ -113,6 +113,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
eg. busybox, debian, fedora, ubuntu or sshd.
Refer to the examples in <filename>@LXCTEMPLATEDIR@</filename>
for details of the expected script structure.
Alternatively, the full path to an executable template script
can also be passed as a parameter.
</para>
</listitem>
</varlistentry>
......
......@@ -290,14 +290,20 @@ if [ $backingstore = "lvm" ]; then
fi
if [ ! -z $lxc_template ]; then
# Allow for a path to be provided as the template name
if [ -x $lxc_template ]; then
template_path=$lxc_template
else
template_path=${templatedir}/lxc-$lxc_template
fi
type ${templatedir}/lxc-$lxc_template 2>/dev/null
type $template_path 2>/dev/null
if [ $? -ne 0 ]; then
echo "$(basename $0): unknown template '$lxc_template'" >&2
cleanup
fi
${templatedir}/lxc-$lxc_template --path=$lxc_path/$lxc_name --name=$lxc_name $*
$template_path --path=$lxc_path/$lxc_name --name=$lxc_name $*
if [ $? -ne 0 ]; then
echo "$(basename $0): failed to execute template '$lxc_template'" >&2
cleanup
......
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