summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorTomek Mrugalski <tomasz@isc.org>2019-03-04 20:13:29 +0100
committerTomek Mrugalski <tomek@isc.org>2019-03-06 15:15:29 +0100
commit6f440c6e489eebaa8b6e814e7bede8eaabddeb71 (patch)
treef0f31296038c01d2d010189e1832d60bfbd1a773 /tools
parentcql_config cleaned up (diff)
downloadkea-6f440c6e489eebaa8b6e814e7bede8eaabddeb71.tar.xz
kea-6f440c6e489eebaa8b6e814e7bede8eaabddeb71.zip
sysrepo_config cleaned up
Diffstat (limited to 'tools')
-rwxr-xr-xtools/sysrepo_config125
1 files changed, 62 insertions, 63 deletions
diff --git a/tools/sysrepo_config b/tools/sysrepo_config
index a4f1165bca..1ec2106d98 100755
--- a/tools/sysrepo_config
+++ b/tools/sysrepo_config
@@ -2,88 +2,87 @@
sysrepo_lib="libsysrepo"
-if [ -z ${YANG_LIBRARY_PATH} ]
+if [ -z "${YANG_LIBRARY_PATH}" ]
then
- YANG_LIBRARY_PATH=/
+ YANG_LIBRARY_PATH=/
fi
-if test `uname -s` = "Darwin"; then
- DIR=$(stat -f %N $0 | xargs dirname)
+if [ "$(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}/sysrepo_config_defines.sh ] || ! [ -x ${DIR}/sysrepo_config_defines.sh ]
-then
- echo "missing path configuration file for Sysrepo (sysrepo_config_defines.sh)"
- exit 0
+if ! [ -f "${DIR}/sysrepo_config_defines.sh" ] || ! [ -x "${DIR}/sysrepo_config_defines.sh" ]; then
+ echo "missing path configuration file for Sysrepo (sysrepo_config_defines.sh)"
+ exit 0
fi
source ${DIR}/sysrepo_config_defines.sh
if [ $# -ne 1 ] && [ $# -ne 2 ]
then
- echo "run: \`$0 --help\` for more help"
+ echo "run: \`$0 --help\` for more help1"
exit 0
fi
-if [ $1 == "--help" ]
+if [ "$1" == "--help" ]
then
- echo "sysrepo_config 'option' ['library']"
- echo "options:"
- echo "--help"
- echo " print this help message"
- echo "--cflags-only-other"
- echo " get cpp compilation flags"
- echo "--cflags-only-I"
- echo " get include path"
- echo "--libs"
- echo " get lib path"
- echo "--modversion"
- echo " get version"
- echo "--variable=SR_REPOSITORY_LOC"
- echo " get repo path"
- echo "libraries:"
- echo " libsysrepo"
- exit 0
-else if [ $# -ne 2 ]
- then
- echo "run: \`$0 --help\` for more help"
- exit 0
- else if [ $2 != "libsysrepo" ]
- then
- echo "library $2 not supported"
- echo "run: \`$0 --help\` for more help"
- exit 0
- else
- sysrepo_lib=$2
- fi
- fi
+ echo "sysrepo_config 'option' ['library']"
+ echo "options:"
+ echo "--help"
+ echo " print this help message"
+ echo "--cflags-only-other"
+ echo " get cpp compilation flags"
+ echo "--cflags-only-I"
+ echo " get include path"
+ echo "--libs"
+ echo " get lib path"
+ echo "--modversion"
+ echo " get version"
+ echo "--variable=SR_REPOSITORY_LOC"
+ echo " get repo path"
+ echo "libraries:"
+ echo " libsysrepo"
+ exit 0
fi
-if [ $1 == "--cflags-only-other" ]
-then
- exit 0
+
+if [ $# -ne 2 ]; then
+ echo "Incorrect number of parameters specified"
+ echo "run: \`$0 --help\` for more help2"
+ exit 0
+elif [ "$2" != "libsysrepo" ]; then
+ echo "library $2 not supported"
+ echo "run: \`$0 --help\` for more help"
+ exit 0
+else
+ sysrepo_lib=$2
fi
-if [ $1 == "--cflags-only-I" ]
-then
- echo "-I${SYSREPO_PATH}/inc/"
- exit 0
+
+if [ "$1" = "--cflags-only-other" ]; then
+ exit 0
fi
-if [ $1 == "--libs" ]
-then
-# Earlier versions also required -lprotobuf, but it is no longer needed.
- echo "-L${SYSREPO_PATH}/build/src -L${SYSREPO_PATH}/build/swig -L$YANG_LIBRARY_PATH -l:${sysrepo_lib}.a -lSysrepo-cpp -lyang -pthread -lpcre -lev -lavl -lprotobuf-c"
- exit 0
+
+if [ "$1" = "--cflags-only-I" ]; then
+ echo "-I${SYSREPO_PATH}/inc/"
+ exit 0
fi
-if [ $1 == "--modversion" ]
-then
- MAJOR="1"
- MINOR="0"
- PATCH="0"
- echo "${MAJOR}.${MINOR}.${PATCH}"
- exit 0
+
+if [ "$1" = "--libs" ]; then
+ # Earlier versions also required -lprotobuf, but it is no longer needed.
+ echo "-L${SYSREPO_PATH}/build/src -L${SYSREPO_PATH}/build/swig -L$YANG_LIBRARY_PATH -l:${sysrepo_lib}.a -lSysrepo-cpp -lyang -pthread -lpcre -lev -lavl -lprotobuf-c"
+ exit 0
fi
-if [ $1 == "--variable=SR_REPOSITORY_LOC" ]
-then
- echo "${SYSREPO_PATH}/build/repository"
+
+if [ "$1" == "--modversion" ]; then
+ MAJOR="1"
+ MINOR="0"
+ PATCH="0"
+ echo "${MAJOR}.${MINOR}.${PATCH}"
+ exit 0
fi
+
+if [ "$1" == "--variable=SR_REPOSITORY_LOC" ]; then
+ echo "${SYSREPO_PATH}/build/repository"
+fi
+
echo "wrong parameter"
echo "run: \`$0 --help\` for more help"