]> gitweb.fluxo.info Git - kvm-manager.git/commitdiff
adding usage and check for valid command.
authorJamie McClelland <jm@mayfirst.org>
Fri, 9 Oct 2009 16:05:12 +0000 (12:05 -0400)
committerJamie McClelland <jm@mayfirst.org>
Fri, 9 Oct 2009 16:05:12 +0000 (12:05 -0400)
kvm-creator

index 763b6b9517cb77871b9aa9598f2e4ebc14a62d96..b726e9aa8e39f859c999749030d363e66fb5e311 100755 (executable)
@@ -24,6 +24,12 @@ else
   MAC=00:00:00:00:00:00
 fi
 
+usage() {
+
+       die "USAGE: kvm-creator create|destroy|demo guestname [volumegroup [disksize [ram [tap [mac] ] ] ] ]"
+
+}
+
 die() {
 
   echo "$1"
@@ -47,7 +53,7 @@ validate() {
 
   # Make sure none of the pieces already exist.
   [ -z "$NAME" ] && die "Please pass the name of the virtual server to create"
-  [ -z "$VG" ] && die "Please pass the name of the volume group to use"
+  [ -z "$VG" ] && [ "$CMD" == "create" ] && die "Please pass the name of the volume group to use"
   getent passwd "$NAME" > /dev/null
   [ "$?" -eq "0" ] && die "The username '$NAME' already exists."
   getent group "$NAME" > /dev/null
@@ -108,4 +114,6 @@ demo() {
 
 }
 
+[ "$CMD" != "create" ] && [ "$CMD" != "destroy" ] && [ "$CMD" != "demo" ] && usage
+
 "$CMD"