1 |
commit: c37d0daba2f264c72a945dcebd08e9a42d8649f7 |
2 |
Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Feb 29 20:34:09 2016 +0000 |
4 |
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Feb 29 20:34:16 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=c37d0dab |
7 |
|
8 |
fix rootfs detection per bug #552052 |
9 |
|
10 |
ZFS and btrfs tools if not explictly configured (either way), default to |
11 |
detecting the fstype of the rootfs. |
12 |
|
13 |
The old rootfs detection method was NOT reliable in all cases; so |
14 |
replace it with a different way. Future improvements should check for |
15 |
rootfs AND the local existence of the required binaries (and bail out |
16 |
early if the the rootrfs was detected but the binaries are not present). |
17 |
|
18 |
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org> |
19 |
|
20 |
gen_cmdline.sh | 4 ++-- |
21 |
gen_funcs.sh | 4 +++- |
22 |
2 files changed, 5 insertions(+), 3 deletions(-) |
23 |
|
24 |
diff --git a/gen_cmdline.sh b/gen_cmdline.sh |
25 |
index 01adfdd..e9e7401 100755 |
26 |
--- a/gen_cmdline.sh |
27 |
+++ b/gen_cmdline.sh |
28 |
@@ -100,9 +100,9 @@ longusage() { |
29 |
echo " --no-dmraid Exclude DMRAID support" |
30 |
echo " --e2fsprogs Include e2fsprogs" |
31 |
echo " --no-e2fsprogs Exclude e2fsprogs" |
32 |
- echo " --zfs Include ZFS support" |
33 |
+ echo " --zfs Include ZFS support (enabled by default if rootfs is zfs)" |
34 |
echo " --no-zfs Exclude ZFS support" |
35 |
- echo " --btrfs Include Btrfs support" |
36 |
+ echo " --btrfs Include Btrfs support (enabled by default if rootfs is btrfs)" |
37 |
echo " --no-btrfs Exclude Btrfs support" |
38 |
echo " --multipath Include Multipath support" |
39 |
echo " --no-multipath Exclude Multipath support" |
40 |
|
41 |
diff --git a/gen_funcs.sh b/gen_funcs.sh |
42 |
index 37942ad..eb807ad 100755 |
43 |
--- a/gen_funcs.sh |
44 |
+++ b/gen_funcs.sh |
45 |
@@ -498,7 +498,9 @@ set_config_with_override() { |
46 |
rootfs_type_is() { |
47 |
local fstype=$1 |
48 |
|
49 |
- if $(df -t ${fstype} / 2>/dev/null 1>/dev/null) |
50 |
+ # It is possible that the awk will return MULTIPLE lines, depending on your |
51 |
+ # initramfs setup (one of the entries will be 'rootfs'). |
52 |
+ if awk '($2=="/"){print $3}' /proc/mounts | grep -sq --line-regexp "$fstype" ; |
53 |
then |
54 |
echo yes |
55 |
else |