From a07698369871fc7ba955b4fd6d984bc65906b05b Mon Sep 17 00:00:00 2001 From: Michael Fritch Date: Fri, 19 Nov 2021 11:26:11 -0700 Subject: [PATCH] cephadm: allow execution from a relative path let the build script run from a relative path (e.g. build or qa dir) Signed-off-by: Michael Fritch --- src/cephadm/build.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/cephadm/build.sh b/src/cephadm/build.sh index abf3290c607..00bd4c74925 100755 --- a/src/cephadm/build.sh +++ b/src/cephadm/build.sh @@ -1,6 +1,7 @@ -#!/usr/bin/env bash +#!/bin/bash -ex -set -ex +SCRIPT_NAME=$(basename ${BASH_SOURCE[0]}) +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" clean_up() { if [ -e ${buildir} ]; then @@ -12,7 +13,7 @@ trap clean_up EXIT PYTHON=$(which python3) # Create build directory and install required dependencies -target_fpath="$(pwd)/cephadm" +target_fpath=${SCRIPT_DIR}/cephadm if [ -n "$1" ]; then target_fpath="$1" fi @@ -22,7 +23,7 @@ if [ -e "requirements.txt" ]; then fi # Make sure all newly created source files are copied here as well! -cp cephadm.py ${builddir}/__main__.py +cp ${SCRIPT_DIR}/cephadm.py ${builddir}/__main__.py version=$($PYTHON --version) if [[ "$version" =~ ^Python[[:space:]]([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)$ ]]; then -- 2.47.3