From 3958b1dd77ce75c3d2077acc62b4babc8419a9e6 Mon Sep 17 00:00:00 2001 From: Thomas Deutschmann Date: Tue, 14 Apr 2020 19:40:16 +0200 Subject: [PATCH] sys-fs/lvm2: runscript: unify $lvm_path handling Signed-off-by: Thomas Deutschmann --- sys-fs/lvm2/files/lvm.rc-2.02.187 | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/sys-fs/lvm2/files/lvm.rc-2.02.187 b/sys-fs/lvm2/files/lvm.rc-2.02.187 index daafffd5b28b..1bf8002b9dab 100644 --- a/sys-fs/lvm2/files/lvm.rc-2.02.187 +++ b/sys-fs/lvm2/files/lvm.rc-2.02.187 @@ -71,12 +71,10 @@ start() { # NOTE: Add needed modules for LVM or RAID, etc # to /etc/modules.autoload if needed + lvm_path="$(_get_lvm_path)" - for lvm_path in /bin/lvm /sbin/lvm ; do - [ -x "${lvm_path}" ] && break - done - if [ ! -x "${lvm_path}" ] ; then - eerror "Cannot find lvm binary in /sbin or /bin!" + if [ -z "${lvm_path}" ] ; then + eerror "Failed to find lvm binary in /bin or /sbin!" return 1 fi if [ -z "${CDBOOT}" ] ; then @@ -121,12 +119,9 @@ start_post() { } stop() { - for lvm_path in /bin/lvm /sbin/lvm ; do - [ -x "${lvm_path}" ] && break - done - - if [ ! -x "${lvm_path}" ] ; then - eerror "Cannot find lvm binary in /sbin or /bin!" + lvm_path="$(_get_lvm_path)" + if [ -z "${lvm_path}" ] ; then + eerror "Failed to find lvm binary in /bin or /sbin!" return 1 fi -- 2.26.2