mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-08-15 00:27:05 +00:00
lxc: update man and help of lxc-create
few added lines to document the new lxc-create -t option Signed-off-by: Michel Normand <normand@fr.ibm.com> Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
This commit is contained in:
parent
23a92fad75
commit
0bb4f8cf3b
@ -50,6 +50,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
<cmdsynopsis>
|
<cmdsynopsis>
|
||||||
<command>lxc-create <replaceable>-n name</replaceable>
|
<command>lxc-create <replaceable>-n name</replaceable>
|
||||||
<optional>-f config_file</optional></command>
|
<optional>-f config_file</optional></command>
|
||||||
|
<optional>-t template</optional></command>
|
||||||
</cmdsynopsis>
|
</cmdsynopsis>
|
||||||
</refsynopsisdiv>
|
</refsynopsisdiv>
|
||||||
|
|
||||||
@ -94,6 +95,20 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term>
|
||||||
|
<option>-t <replaceable>template</replaceable></option>
|
||||||
|
</term>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
'template' is the short name of an existing 'lxc-template'
|
||||||
|
script that is called by lxc-create.
|
||||||
|
eg: lxc-debian, lxc-busybox ...
|
||||||
|
Refer to those exemples for details of expecting script structure.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
</variablelist>
|
</variablelist>
|
||||||
|
|
||||||
</refsect1>
|
</refsect1>
|
||||||
|
@ -26,21 +26,27 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "usage: $0 -n <name> [-f configuration]"
|
echo "usage: lxc-create -n <name> [-f configuration] [-t template] [-h]"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ "$(id -u)" != "0" ]; then
|
help() {
|
||||||
echo "This command has to be run as root"
|
usage
|
||||||
exit 1
|
echo
|
||||||
fi
|
echo "creates a lxc system object."
|
||||||
|
echo
|
||||||
|
echo "Options:"
|
||||||
|
echo "name : name of the container"
|
||||||
|
echo "configuration: lxc configuration"
|
||||||
|
echo "template : lxc-template is an accessible template script"
|
||||||
|
}
|
||||||
|
|
||||||
shortoptions='n:f:t:'
|
shortoptions='hn:f:t:'
|
||||||
longoptions='name:,config:,template:'
|
longoptions='help,name:,config:,template:'
|
||||||
lxc_path=@LXCPATH@
|
lxc_path=@LXCPATH@
|
||||||
|
|
||||||
getopt=$(getopt -o $shortoptions --longoptions $longoptions -- "$@")
|
getopt=$(getopt -o $shortoptions --longoptions $longoptions -- "$@")
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
usage $0
|
usage
|
||||||
exit 1;
|
exit 1;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -48,6 +54,10 @@ eval set -- "$getopt"
|
|||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
-h|--help)
|
||||||
|
help
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
-n|--name)
|
-n|--name)
|
||||||
shift
|
shift
|
||||||
lxc_name=$1
|
lxc_name=$1
|
||||||
@ -68,20 +78,25 @@ while true; do
|
|||||||
break;;
|
break;;
|
||||||
*)
|
*)
|
||||||
echo $1
|
echo $1
|
||||||
usage $0
|
usage
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ ! -r $lxc_path ]; then
|
if [ -z "$lxc_name" ]; then
|
||||||
echo "no configuration path defined !"
|
echo "no container name specified"
|
||||||
|
usage
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$lxc_name" ]; then
|
if [ "$(id -u)" != "0" ]; then
|
||||||
echo "no container name specified"
|
echo "This command has to be run as root"
|
||||||
usage $0
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -r $lxc_path ]; then
|
||||||
|
echo "no configuration path defined !"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user