mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-07-30 13:29:19 +00:00
lxc-create to run even if not in PATH
Signed-off-by: Michel Normand <normand@fr.ibm.com> Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
This commit is contained in:
parent
3bc15639eb
commit
96819f4d77
@ -43,6 +43,7 @@ help() {
|
|||||||
shortoptions='hn:f:t:'
|
shortoptions='hn:f:t:'
|
||||||
longoptions='help,name:,config:,template:'
|
longoptions='help,name:,config:,template:'
|
||||||
lxc_path=@LXCPATH@
|
lxc_path=@LXCPATH@
|
||||||
|
bindir=@BINDIR@
|
||||||
|
|
||||||
getopt=$(getopt -o $shortoptions --longoptions $longoptions -- "$@")
|
getopt=$(getopt -o $shortoptions --longoptions $longoptions -- "$@")
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
@ -115,7 +116,7 @@ if [ -d "$lxc_path/$lxc_name" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
trap "lxc-destroy -n $lxc_name; echo aborted; exit 1" SIGHUP SIGINT SIGTERM
|
trap "${bindir}/lxc-destroy -n $lxc_name; echo aborted; exit 1" SIGHUP SIGINT SIGTERM
|
||||||
|
|
||||||
mkdir -p $lxc_path/$lxc_name
|
mkdir -p $lxc_path/$lxc_name
|
||||||
|
|
||||||
@ -132,10 +133,10 @@ fi
|
|||||||
|
|
||||||
if [ ! -z $lxc_template ]; then
|
if [ ! -z $lxc_template ]; then
|
||||||
|
|
||||||
type lxc-$lxc_template
|
type ${bindir}/lxc-$lxc_template >/dev/null
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "unknown template '$lxc_template'"
|
echo "unknown template '$lxc_template'"
|
||||||
lxc-destroy -n $lxc_name
|
${bindir}/lxc-destroy -n $lxc_name
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -165,10 +166,10 @@ if [ ! -z $lxc_template ]; then
|
|||||||
read dummy
|
read dummy
|
||||||
fi
|
fi
|
||||||
|
|
||||||
lxc-$lxc_template --path=$lxc_path/$lxc_name --name=$lxc_name
|
${bindir}/lxc-$lxc_template --path=$lxc_path/$lxc_name --name=$lxc_name
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "failed to execute template '$lxc_template'"
|
echo "failed to execute template '$lxc_template'"
|
||||||
lxc-destroy -n $lxc_name
|
${bindir}/lxc-destroy -n $lxc_name
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user