diff options
author | Tomek Mrugalski <tomasz@isc.org> | 2019-03-04 19:46:58 +0100 |
---|---|---|
committer | Tomek Mrugalski <tomek@isc.org> | 2019-03-06 15:15:29 +0100 |
commit | a9c968514638c56f677a12a6bba0d5c4ec973661 (patch) | |
tree | b6889a809c74980f5c0fb2e82eb4095c5a7baf00 /tools | |
parent | kea-admin fixed (diff) | |
download | kea-a9c968514638c56f677a12a6bba0d5c4ec973661.tar.xz kea-a9c968514638c56f677a12a6bba0d5c4ec973661.zip |
cql_config cleaned up
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/cql_config | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/tools/cql_config b/tools/cql_config index 8fad4295a3..955fa983cb 100755 --- a/tools/cql_config +++ b/tools/cql_config @@ -1,26 +1,27 @@ -#!/bin/bash +#!/bin/sh cql_lib="cassandra" -if test `uname -s` = "Darwin"; then - DIR=$(stat -f %N $0 | xargs dirname) +if test "$(uname -s)" = "Darwin"; then + DIR=$(stat -f %N "$0" | xargs dirname) else - DIR=$(readlink -f $0 | xargs dirname) + DIR=$(readlink -f "$0" | xargs dirname) fi -if ! [ -f ${DIR}/cql_config_defines.sh ] || ! [ -x ${DIR}/cql_config_defines.sh ] +if ! [ -f "${DIR}/cql_config_defines.sh" ] || ! [ -x "${DIR}/cql_config_defines.sh" ] then echo "missing path configuration file for DataStax Cassandra (cql_config_defines.sh)" exit 1 fi -source ${DIR}/cql_config_defines.sh +source "${DIR}/cql_config_defines.sh" if [ $# -ne 1 ] && [ $# -ne 2 ] then echo "run: \`$0 --help\` for more help" exit 1 fi -if [ $1 == "--help" ] + +if [ "$1" == "--help" ] then echo "cql_config 'option' ['library']" echo "options:" @@ -40,43 +41,42 @@ then echo " cassandra" echo " cassandra_static" exit 0 -else if [ $# -ne 2 ] - then - echo "run: \`$0 --help\` for more help" - exit 1 - else if [ $2 != "cassandra" ] && [ $2 != "cassandra_static" ] - then - echo "library $2 not supported" - echo "run: \`$0 --help\` for more help" - exit 1 - else - cql_lib=$2 - fi - fi fi -if [ $1 == "--cflags-only-other" ] + +if [ $# -ne 2 ]; then + echo "run: \`$0 --help\` for more help" + exit 1 +elif [ "$2" != "cassandra" ] && [ "$2" != "cassandra_static" ]; then + echo "library $2 not supported" + echo "run: \`$0 --help\` for more help" + exit 1 +else + cql_lib=$2 +fi + +if [ "$1" == "--cflags-only-other" ] then exit 0 fi -if [ $1 == "--cflags-only-I" ] +if [ "$1" == "--cflags-only-I" ] then echo "-I${CPP_DRIVER_PATH}/include/" exit 0 fi -if [ $1 == "--libs" ] +if [ "$1" == "--libs" ] then echo "-L${CPP_DRIVER_PATH}/build/ -l${cql_lib} -luv" exit 0 fi -if [ $1 == "--modversion" ] +if [ "$1" == "--modversion" ] then - MAJOR=`grep VERSION_MAJOR ${CPP_DRIVER_PATH}/include/cassandra.h | cut -d " " -f 3` - MINOR=`grep VERSION_MINOR ${CPP_DRIVER_PATH}/include/cassandra.h | cut -d " " -f 3` - PATCH=`grep VERSION_PATCH ${CPP_DRIVER_PATH}/include/cassandra.h | cut -d " " -f 3` + MAJOR=$(grep VERSION_MAJOR "${CPP_DRIVER_PATH}/include/cassandra.h" | cut -d " " -f 3) + MINOR=$(grep VERSION_MINOR "${CPP_DRIVER_PATH}/include/cassandra.h" | cut -d " " -f 3) + PATCH=$(grep VERSION_PATCH "${CPP_DRIVER_PATH}/include/cassandra.h" | cut -d " " -f 3) echo "${MAJOR}.${MINOR}.${PATCH}" exit 0 fi -if [ $1 == "--print-errors" ] +if [ "$1" == "--print-errors" ] then exit 0 fi |