From 290ccc540b669bbede1bb4acc14220401e6cb49b Mon Sep 17 00:00:00 2001 From: Jamie McClelland Date: Fri, 9 Oct 2009 12:05:12 -0400 Subject: adding usage and check for valid command. --- kvm-creator | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'kvm-creator') diff --git a/kvm-creator b/kvm-creator index 763b6b9..b726e9a 100755 --- a/kvm-creator +++ b/kvm-creator @@ -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" -- cgit v1.2.3