Date: Sun, 18 Jan 2015 01:50:10 +0000 (UTC) From: Neel Natu <neel@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r277309 - head/share/examples/bhyve Message-ID: <201501180150.t0I1oAZw099818@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: neel Date: Sun Jan 18 01:50:10 2015 New Revision: 277309 URL: https://svnweb.freebsd.org/changeset/base/277309 Log: Make the error message explicit instead of just printing the usage if the virtual machine name is not specified. Requested by: grehan MFC after: 1 week Modified: head/share/examples/bhyve/vmrun.sh Modified: head/share/examples/bhyve/vmrun.sh ============================================================================== --- head/share/examples/bhyve/vmrun.sh Sun Jan 18 01:28:08 2015 (r277308) +++ head/share/examples/bhyve/vmrun.sh Sun Jan 18 01:50:10 2015 (r277309) @@ -39,7 +39,13 @@ DEFAULT_CONSOLE=stdio DEFAULT_VIRTIO_DISK="./diskdev" DEFAULT_ISOFILE="./release.iso" +errmsg() { + echo "*** $1" +} + usage() { + local msg=$1 + echo "Usage: vmrun.sh [-ahi] [-c <CPUs>] [-C <console>] [-d <disk file>]" echo " [-e <name=value>] [-g <gdbport> ] [-H <directory>]" echo " [-I <location of installation iso>] [-m <memsize>]" @@ -58,18 +64,18 @@ usage() { echo " -m: memory size (default is ${DEFAULT_MEMSIZE})" echo " -t: tap device for virtio-net (default is $DEFAULT_TAPDEV)" echo "" - echo " This script needs to be executed with superuser privileges" - echo "" + [ -n "$msg" ] && errmsg "$msg" exit 1 } if [ `id -u` -ne 0 ]; then - usage + errmsg "This script must be executed with superuser privileges" + exit 1 fi kldstat -n vmm > /dev/null 2>&1 if [ $? -ne 0 ]; then - echo "vmm.ko is not loaded!" + errmsg "vmm.ko is not loaded" exit 1 fi @@ -140,7 +146,7 @@ fi shift $((${OPTIND} - 1)) if [ $# -ne 1 ]; then - usage + usage "virtual machine name not specified" fi vmname="$1"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201501180150.t0I1oAZw099818>