more checks to make sure script is run as intended

This commit is contained in:
Anthony Young 2011-11-07 16:37:00 -06:00
parent 069f2f7a53
commit 8655bf0e6e

View file

@ -1,5 +1,11 @@
#!/usr/bin/env bash
# echo commands
set -o xtrace
# exit on error to stop unexpected errors
set -o errexit
# Keep track of the current directory
TOOLS_DIR=$(cd $(dirname "$0") && pwd)
TOP_DIR=`cd $TOOLS_DIR/..; pwd`
@ -20,6 +26,12 @@ if ! qemu-img info $1 | grep -q "file format: raw"; then
exit 1
fi
# Make sure we are in the correct dir
if [ ! -d files/apts ]; then
echo "Please run this script from devstack/tools/"
exit 1
fi
# Mount the image
STAGING_DIR=`mktemp -d uec.XXXXXXXXXX`
mkdir -p $STAGING_DIR