From: Michael Fritch Date: Fri, 19 Nov 2021 18:26:11 +0000 (-0700) Subject: cephadm: allow execution from a relative path X-Git-Tag: v18.0.0~7^2~16 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a07698369871fc7ba955b4fd6d984bc65906b05b;p=ceph.git 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 --- diff --git a/src/cephadm/build.sh b/src/cephadm/build.sh index abf3290c6079..00bd4c74925f 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