Browse code

more checks to make sure script is run as intended

Anthony Young authored on 2011/11/08 07:37:00
Showing 1 changed files
... ...
@@ -1,5 +1,11 @@
1 1
 #!/usr/bin/env bash
2 2
 
3
+# echo commands
4
+set -o xtrace
5
+
6
+# exit on error to stop unexpected errors
7
+set -o errexit
8
+
3 9
 # Keep track of the current directory
4 10
 TOOLS_DIR=$(cd $(dirname "$0") && pwd)
5 11
 TOP_DIR=`cd $TOOLS_DIR/..; pwd`
... ...
@@ -20,6 +26,12 @@ if ! qemu-img info $1 | grep -q "file format: raw"; then
20 20
     exit 1
21 21
 fi
22 22
 
23
+# Make sure we are in the correct dir
24
+if [ ! -d files/apts ]; then
25
+    echo "Please run this script from devstack/tools/"
26
+    exit 1
27
+fi 
28
+
23 29
 # Mount the image
24 30
 STAGING_DIR=`mktemp -d uec.XXXXXXXXXX`
25 31
 mkdir -p $STAGING_DIR