aboutsummaryrefslogtreecommitdiff
path: root/kvm-creator
diff options
context:
space:
mode:
authorJamie McClelland <jm@mayfirst.org>2009-10-09 12:05:12 -0400
committerJamie McClelland <jm@mayfirst.org>2009-10-09 12:05:12 -0400
commit290ccc540b669bbede1bb4acc14220401e6cb49b (patch)
tree026ed4bca40ef2f1878d2345ba4351d5dedee495 /kvm-creator
parent5e6ae8672b32dce26f273af156f73d950a06c198 (diff)
downloadkvm-manager-290ccc540b669bbede1bb4acc14220401e6cb49b.tar.gz
kvm-manager-290ccc540b669bbede1bb4acc14220401e6cb49b.tar.bz2
adding usage and check for valid command.
Diffstat (limited to 'kvm-creator')
-rwxr-xr-xkvm-creator10
1 files changed, 9 insertions, 1 deletions
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"