#!/bin/bash

#This script tries to acquire the lock for the specified machine config (given
#as a base name, not a fully-qualified path). If the -n option is given, it
#returns failure if an instance is already running. Otherwise it waits for the
#VM to exit.

. "`dirname $0`/bootscriptfunctions.sh"

nb_opt=""
update_opt=""
if [ x"$1" = x-n ]
then
	nb_opt="-n"
	shift
else
	update_opt="-u"
fi

if [ ! "$1" ]
then
	echo "usage: `basename $0` [-n] <machine config name>"
	exit 1
fi

acquire_guest_lock $nb_opt $update_opt "$1"
