]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
lxc: update man and help of lxc-create
authorMichel Normand <normand@fr.ibm.com>
Fri, 8 Jan 2010 13:34:13 +0000 (14:34 +0100)
committerDaniel Lezcano <dlezcano@fr.ibm.com>
Fri, 8 Jan 2010 13:34:13 +0000 (14:34 +0100)
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>
doc/lxc-create.sgml.in
src/lxc/lxc-create.in

index ccc2b011394f3da2715cbd600f249b34a43733b1..5a2baae089f15c8915eafff47aa4a024c8d5296d 100644 (file)
@@ -50,6 +50,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
     <cmdsynopsis>
       <command>lxc-create <replaceable>-n name</replaceable>
        <optional>-f config_file</optional></command>
+       <optional>-t template</optional></command>
     </cmdsynopsis>
   </refsynopsisdiv>
 
@@ -94,6 +95,20 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
        </listitem>
       </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>
 
   </refsect1>
index 7514803df32e4711275d28c4da95a91241da8ff8..0ebc00d4f45c10a312f4a2992bcf4b5c05efb8a1 100644 (file)
 #
 
 usage() {
-    echo "usage: $0 -n <name> [-f configuration]"
+    echo "usage: lxc-create -n <name> [-f configuration] [-t template] [-h]"
 }
 
-if [ "$(id -u)" != "0" ]; then
-   echo "This command has to be run as root"
-   exit 1
-fi
+help() {
+    usage
+    echo
+    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:'
-longoptions='name:,config:,template:'
+shortoptions='hn:f:t:'
+longoptions='help,name:,config:,template:'
 lxc_path=@LXCPATH@
 
 getopt=$(getopt -o $shortoptions --longoptions  $longoptions -- "$@")
 if [ $? != 0 ]; then
-    usage $0
+    usage
     exit 1;
 fi
 
@@ -48,6 +54,10 @@ eval set -- "$getopt"
 
 while true; do
         case "$1" in
+           -h|--help)
+               help
+               exit 1
+               ;;
            -n|--name)
                shift
                lxc_name=$1
@@ -68,20 +78,25 @@ while true; do
                break;;
             *)
                echo $1
-               usage $0
+               usage
                exit 1
                ;;
         esac
 done
 
-if [ ! -r $lxc_path ]; then
-    echo "no configuration path defined !"
+if [ -z "$lxc_name" ]; then
+    echo "no container name specified"
+    usage
     exit 1
 fi
 
-if [ -z "$lxc_name" ]; then
-    echo "no container name specified"
-    usage $0
+if [ "$(id -u)" != "0" ]; then
+   echo "This command has to be run as root"
+   exit 1
+fi
+
+if [ ! -r $lxc_path ]; then
+    echo "no configuration path defined !"
     exit 1
 fi
 
@@ -150,4 +165,4 @@ if [ ! -z $lxc_template ]; then
     echo "'$lxc_template' template installed"
 fi
 
-echo "'$lxc_name' created"
\ No newline at end of file
+echo "'$lxc_name' created"