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