shortoptions='hn:f:t:'
longoptions='help,name:,config:,template:'
lxc_path=@LXCPATH@
+bindir=@BINDIR@
getopt=$(getopt -o $shortoptions --longoptions $longoptions -- "$@")
if [ $? != 0 ]; then
exit 1
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
if [ ! -z $lxc_template ]; then
- type lxc-$lxc_template
+ type ${bindir}/lxc-$lxc_template >/dev/null
if [ $? -ne 0 ]; then
echo "unknown template '$lxc_template'"
- lxc-destroy -n $lxc_name
+ ${bindir}/lxc-destroy -n $lxc_name
exit 1
fi
read dummy
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
echo "failed to execute template '$lxc_template'"
- lxc-destroy -n $lxc_name
+ ${bindir}/lxc-destroy -n $lxc_name
exit 1
fi