From 32c966170f349eb5926b4566360f28dc89a138c2 Mon Sep 17 00:00:00 2001 From: Andreas Henriksson Date: Thu, 8 Oct 2015 02:29:46 +0200 Subject: [PATCH 15/18] Properly handle extended dos partitions (#1322957) Changes os-prober behavior to skip extended dos partitions by default. ------------------------------------------------------------------------ Adjust extended dos support for blkid/util-linux 2.24+ (Closes: #735169). Signed-off-by: Cyril Brulebois ------------------------------------------------------------------------ (cherry picked from commit 6d93bc444b28a038080aef67fd3b670720315bf9) Resolves: rhbz#1322957 --- common.sh | 23 +++++++++++++++++++++++ linux-boot-probes/common/50mounted-tests | 4 ++++ 2 files changed, 27 insertions(+) diff --git a/common.sh b/common.sh index 7fcae5a..4cd300d 100644 --- a/common.sh +++ b/common.sh @@ -126,6 +126,29 @@ fs_type () { fi } +is_dos_extended_partition() { + if type blkid >/dev/null 2>&1; then + local output + + output="$(blkid -o export $1)" + + # old blkid (util-linux << 2.24) errors out on extended p. + if [ "$?" = "2" ]; then + return 0 + fi + + # dos partition type and no filesystem type?... + if echo $output | grep -q ' PTTYPE=dos ' && + ! echo $output | grep -q ' TYPE='; then + return 0 + else + return 1 + fi + fi + + return 1 +} + parse_proc_mounts () { while read -r line; do set -f diff --git a/linux-boot-probes/common/50mounted-tests b/linux-boot-probes/common/50mounted-tests index 41e26e6..91b6dd9 100755 --- a/linux-boot-probes/common/50mounted-tests +++ b/linux-boot-probes/common/50mounted-tests @@ -20,6 +20,10 @@ elif [ "$types" = ntfs ]; then types='ntfs-3g ntfs' fi elif [ -z "$types" ]; then + if is_dos_extended_partition "$partition"; then + debug "$1 looks like an extended dos partition; skipping" + exit 0 + fi if type cryptsetup >/dev/null 2>&1 && \ cryptsetup luksDump "$partition" >/dev/null 2>&1; then debug "$1 is a LUKS partition; skipping" -- 2.5.5