commit:     0b378bf0d675188a438bfea9dee392fb2b5d0cfd
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Fri Aug 28 12:39:38 2020 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Fri Aug 28 13:45:38 2020 +0000
URL:        https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=0b378bf0

defaults/linuxrc: Make use of PATH (2)

Don't use absolute paths. Use 'hash' to test if command is available.

Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 defaults/linuxrc | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/defaults/linuxrc b/defaults/linuxrc
index 466e1f7..5c3b0ce 100644
--- a/defaults/linuxrc
+++ b/defaults/linuxrc
@@ -509,15 +509,16 @@ esac
 # Verify that it is safe to use ZFS
 if [ "${USE_ZFS}" = '1' ]
 then
-       for i in /sbin/zfs /sbin/zpool
+       for i in zfs zpool
        do
-               if [ ! -x ${i} ]
+               if ! hash ${i} >/dev/null 2>&1
                then
                        USE_ZFS=0
-                       bad_msg "Aborting use of ZFS because ${i} not found!"
+                       bad_msg "Aborting use of ZFS because '${i}' not found!"
                        break
                fi
        done
+       unset i
 
        [ "${USE_ZFS}" = '1' ] && MY_HWOPTS="${MY_HWOPTS} zfs"
 fi

Reply via email to