From 3b58a1c18ccc27e0d363b86dfeb714e06eb0f77a Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Thu, 8 Feb 2018 12:04:08 +0800 Subject: [PATCH] vstart.sh: introduce get_cmake_variable() Signed-off-by: Kefu Chai --- src/vstart.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/vstart.sh b/src/vstart.sh index ba2e87f8887..33010abb81c 100755 --- a/src/vstart.sh +++ b/src/vstart.sh @@ -16,10 +16,15 @@ if [ -n "$VSTART_DEST" ]; then CEPH_OUT_DIR=$VSTART_DEST/out fi +get_cmake_variable() { + local variable=$1 + grep "$variable" CMakeCache.txt | cut -d "=" -f 2 +} + # for running out of the CMake build directory if [ -e CMakeCache.txt ]; then # Out of tree build, learn source location from CMakeCache.txt - CEPH_ROOT=`grep ceph_SOURCE_DIR CMakeCache.txt | cut -d "=" -f 2` + CEPH_ROOT=$(get_cmake_variable ceph_SOURCE_DIR) CEPH_BUILD_DIR=`pwd` [ -z "$MGR_PYTHON_PATH" ] && MGR_PYTHON_PATH=$CEPH_ROOT/src/pybind/mgr fi