ceph-daemon: remove guesswork to find script file

Allow passing CEPH_DAEMON via the environment or default to using the
script from the standard location.

Signed-off-by: Michael Fritch <mfritch@suse.com>
This commit is contained in:
Michael Fritch 2019-12-05 07:58:48 -07:00
parent 9e03530441
commit 995e5c3209
No known key found for this signature in database
GPG Key ID: 75F3EB2E80A03B7F

View File

@ -22,16 +22,12 @@ OSD_LV_NAME=${SCRIPT_NAME%.*}
[ -z "$SUDO" ] && SUDO=sudo
if [ -z "$CEPH_DAEMON" ]; then
[ -x src/ceph-daemon/ceph-daemon ] && CEPH_DAEMON=src/ceph-daemon/ceph-daemon
[ -x ../src/ceph-daemon/ceph-daemon ] && CEPH_DAEMON=../src/ceph-daemon/ceph-daemon
[ -x ./ceph-daemon/ceph-daemon ] && CEPH_DAEMON=./ceph-daemon/ceph-daemon
[ -x ./ceph-daemon ] && CEPH_DAEMON=.ceph-daemon
which ceph-daemon && CEPH_DAEMON=$(which ceph-daemon)
CEPH_DAEMON=${SCRIPT_DIR}/../../src/ceph-daemon/ceph-daemon
fi
# at this point, we need $CEPH_DAEMON set
if [ -z "$CEPH_DAEMON" ]; then
echo "ceph-daemon not found.Please set \$CEPH_DAEMON"
if ! [ -x "$CEPH_DAEMON" ]; then
echo "ceph-daemon not found. Please set \$CEPH_DAEMON"
exit 1
fi