]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: allow execution from a relative path
authorMichael Fritch <mfritch@suse.com>
Fri, 19 Nov 2021 18:26:11 +0000 (11:26 -0700)
committerJohn Mulligan <jmulligan@redhat.com>
Tue, 13 Sep 2022 16:17:20 +0000 (12:17 -0400)
let the build script run from a relative path (e.g. build or qa dir)

Signed-off-by: Michael Fritch <mfritch@suse.com>
src/cephadm/build.sh

index abf3290c607929fe970a73bc12217d140049fe25..00bd4c74925f882c81788d79b78e5ea0fa804abc 100755 (executable)
@@ -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