From 39d444a339c3605e30d7d8afe671b48cb4365479 Mon Sep 17 00:00:00 2001 From: Arvind S Raj Date: Sat, 26 Apr 2014 20:55:25 +0530 Subject: [PATCH] Abort configure script if haikuports, haikuports cross and haikuporter directories do not exist. Signed-off-by: Jessica Hamilton --- configure | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/configure b/configure index 20f7e14351..4dca26fcd6 100755 --- a/configure +++ b/configure @@ -2,6 +2,9 @@ # # configure [ ] +# set flag to exit script when exit command is executed +set -e + # usage # # Prints usage. @@ -183,6 +186,19 @@ absolute_path() fi } +# check_dir_exists +# +# check if a directory exists or not +# +check_dir_exists() +{ + if [ -d "$1" ]; then + return 0 + else + return 1 + fi +} + # real_path # # returns the realpath of a symbolic link. @@ -570,6 +586,18 @@ while [ $# -gt 0 ] ; do HOST_HAIKU_PORTER="`absolute_path $2`" HAIKU_PORTS_CROSS="`absolute_path $3`" HAIKU_PORTS="`absolute_path $4`" + check_dir_exists "$HOST_HAIKU_PORTER" || ( + echo "Non-existent directory $HOST_HAIKU_PORTER" >&2 + exit 1 + ) + check_dir_exists "$HAIKU_PORTS" || ( + echo "Non-existent directory $HAIKU_PORTS" >&2 + exit 1 + ) + check_dir_exists "$HAIKU_PORTS_CROSS" || ( + echo "Non-existent directory $HAIKU_PORTS_CROSS" >&2 + exit 1 + ) shift 4 ;; --build-cross-tools)