[PATCH modular 07/13] config: add user input checking for *DIR environment variables
Gaetan Nadon
memsize at videotron.ca
Wed Dec 29 07:44:25 PST 2010
Check that the supplied path is a full patch name and not a relative
path name.
Autoconf configure srcipt does the same check:
error: expected an absolute directory name for --libdir: lib
Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
---
build.sh | 24 ++++++++++++++++++++++++
1 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/build.sh b/build.sh
index 659450e..42ec9c6 100755
--- a/build.sh
+++ b/build.sh
@@ -55,6 +55,15 @@ EOF
setup_buildenv() {
+ # All directories variables must be full path names
+ check_full_path $PREFIX PREFIX
+ check_full_path $EPREFIX EPREFIX
+ check_full_path $BINDIR BINDIR
+ check_full_path $DATAROOTDIR DATAROOTDIR
+ check_full_path $DATADIR DATADIR
+ check_full_path $LIBDIR LIBDIR
+ check_full_path $LOCALSTATEDIR LOCALSTATEDIR
+
# Must create local aclocal dir or aclocal fails
ACLOCAL_LOCALDIR="${DESTDIR}${DATADIR}/aclocal"
$SUDO mkdir -p ${ACLOCAL_LOCALDIR}
@@ -980,6 +989,21 @@ usage() {
envoptions
}
+# Ensure the named variable value contains a full path name
+# arguments:
+# $1 - the variable value (the path to examin)
+# $2 - the name of the variable
+# returns:
+# returns nothing or exit on error with message
+check_full_path () {
+ if [ X"`expr substr $1 1 1`" != X/ ]; then
+ echo "The path \"$1\" supplied by \"$2\" must be a full path name"
+ echo ""
+ usage
+ exit 1
+ fi
+}
+
HAVE_ARCH="`uname -i`"
DIR_ARCH=""
DIR_CONFIG="."
--
1.6.0.4
More information about the xorg-devel
mailing list