]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
cql_config cleaned up
authorTomek Mrugalski <tomasz@isc.org>
Mon, 4 Mar 2019 18:46:58 +0000 (19:46 +0100)
committerTomek Mrugalski <tomek@isc.org>
Wed, 6 Mar 2019 14:15:29 +0000 (09:15 -0500)
.gitlab-ci.yml
tools/cql_config

index f786960aabcc2b7845dffca2c1b1a301bd022ec7..34fcbc7926520ad8311d6808213debabe6079cf0 100644 (file)
@@ -21,5 +21,8 @@ shellcheck:
   before_script:
     - sudo apt-get -y install shellcheck
   script:
-    - SCRIPTS="src/bin/keactrl/keactrl.in src/bin/admin/kea-admin.in src/bin/admin/admin-utils.sh"
+    - SCRIPTS="src/bin/keactrl/keactrl.in"
+    - SCRIPTS+="src/bin/admin/kea-admin.in"
+    - SCRIPTS+="src/bin/admin/admin-utils.sh"
+    - SCRIPTS+="tools/cql_config"
     - shellcheck ${SCRIPTS} ${SHELLCHECK_OPTS}
index 8fad4295a32c683758d6469edcae42766328596f..955fa983cb0b62593933f9f922066a98d315ea94 100755 (executable)
@@ -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