From ddf36613f3408ce42f15b03b4e9c6ad8478b97f8 Mon Sep 17 00:00:00 2001
From: Hongxu Jia <hongxu.jia@windriver.com>
Date: Tue, 2 Mar 2021 01:33:05 -0800
Subject: [PATCH] fix command /bin/findmnt, /bin/lsblk, /bin/sort not found

In oe-core (util-linux and coreutils), the commands locates in
${bindir} rather than /bin, add BINDIR to configure it

Upstream-Status: Inappropriate [oe specific]

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
 configure.ac                | 3 +++
 scripts/blkdeactivate.sh.in | 7 ++++---
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 4811d4a3d..137b31a82 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1611,6 +1611,8 @@ fi
 
 SYSCONFDIR="$(eval echo $(eval echo $sysconfdir))"
 
+BINDIR="$(eval echo $(eval echo $bindir))"
+
 SBINDIR="$(eval echo $(eval echo $sbindir))"
 LVM_PATH="$SBINDIR/lvm"
 AC_DEFINE_UNQUOTED(LVM_PATH, ["$LVM_PATH"], [Path to lvm binary.])
@@ -1829,6 +1831,7 @@ AC_SUBST(SACKPT_CFLAGS)
 AC_SUBST(SACKPT_LIBS)
 AC_SUBST(SALCK_CFLAGS)
 AC_SUBST(SALCK_LIBS)
+AC_SUBST(BINDIR)
 AC_SUBST(SBINDIR)
 AC_SUBST(SELINUX_LIBS)
 AC_SUBST(SELINUX_PC)
diff --git a/scripts/blkdeactivate.sh.in b/scripts/blkdeactivate.sh.in
index 7c517b87b..7ef1bb766 100644
--- a/scripts/blkdeactivate.sh.in
+++ b/scripts/blkdeactivate.sh.in
@@ -42,13 +42,14 @@ VDO="/bin/vdo"
 
 sbindir="@SBINDIR@"
 DMSETUP="$sbindir/dmsetup"
+bindir="@BINDIR@"
 LVM="$sbindir/lvm"
 
 if "$UMOUNT" --help | grep -- "--all-targets" >"$DEV_DIR/null"; then
 	UMOUNT_OPTS="--all-targets "
 else
 	UMOUNT_OPTS=""
-	FINDMNT="/bin/findmnt -r --noheadings -u -o TARGET"
+	FINDMNT="$bindir/findmnt -r --noheadings -u -o TARGET"
 	FINDMNT_READ="read -r mnt"
 fi
 DMSETUP_OPTS=""
@@ -57,10 +58,10 @@ MDADM_OPTS=""
 MPATHD_OPTS=""
 VDO_OPTS=""
 
-LSBLK="/bin/lsblk -r --noheadings -o TYPE,KNAME,NAME,MOUNTPOINT"
+LSBLK="$bindir/lsblk -r --noheadings -o TYPE,KNAME,NAME,MOUNTPOINT"
 LSBLK_VARS="local devtype local kname local name local mnt"
 LSBLK_READ="read -r devtype kname name mnt"
-SORT_MNT="/bin/sort -r -u -k 4"
+SORT_MNT="$bindir/sort -r -u -k 4"
 
 # Do not show tool errors by default (only done/skipping summary
 # message provided by this script) and no verbose mode by default.
-- 
2.29.2

