Gentoo Archives: gentoo-commits

From: Thomas Deutschmann <whissi@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/genkernel:master commit in: defaults/
Date: Fri, 28 Aug 2020 20:18:51
Message-Id: 1598622338.0b378bf0d675188a438bfea9dee392fb2b5d0cfd.whissi@gentoo
1 commit: 0b378bf0d675188a438bfea9dee392fb2b5d0cfd
2 Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
3 AuthorDate: Fri Aug 28 12:39:38 2020 +0000
4 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
5 CommitDate: Fri Aug 28 13:45:38 2020 +0000
6 URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=0b378bf0
7
8 defaults/linuxrc: Make use of PATH (2)
9
10 Don't use absolute paths. Use 'hash' to test if command is available.
11
12 Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>
13
14 defaults/linuxrc | 7 ++++---
15 1 file changed, 4 insertions(+), 3 deletions(-)
16
17 diff --git a/defaults/linuxrc b/defaults/linuxrc
18 index 466e1f7..5c3b0ce 100644
19 --- a/defaults/linuxrc
20 +++ b/defaults/linuxrc
21 @@ -509,15 +509,16 @@ esac
22 # Verify that it is safe to use ZFS
23 if [ "${USE_ZFS}" = '1' ]
24 then
25 - for i in /sbin/zfs /sbin/zpool
26 + for i in zfs zpool
27 do
28 - if [ ! -x ${i} ]
29 + if ! hash ${i} >/dev/null 2>&1
30 then
31 USE_ZFS=0
32 - bad_msg "Aborting use of ZFS because ${i} not found!"
33 + bad_msg "Aborting use of ZFS because '${i}' not found!"
34 break
35 fi
36 done
37 + unset i
38
39 [ "${USE_ZFS}" = '1' ] && MY_HWOPTS="${MY_HWOPTS} zfs"
40 fi