From 8655bf0e6efdd3d87a5ed149be2ee5e3aa8473db Mon Sep 17 00:00:00 2001 From: Anthony Young Date: Mon, 7 Nov 2011 16:37:00 -0600 Subject: [PATCH] more checks to make sure script is run as intended --- tools/warm_apts_and_pips.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tools/warm_apts_and_pips.sh b/tools/warm_apts_and_pips.sh index c0b02b9..b20519f 100755 --- a/tools/warm_apts_and_pips.sh +++ b/tools/warm_apts_and_pips.sh @@ -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