From bc4151982a1d984b7f876b405d535fc7fe4dfa6c0543bc70fac8ee389f064f3d Mon Sep 17 00:00:00 2001 From: Michael Chang Date: Sat, 30 May 2015 00:59:49 +0000 Subject: [PATCH 1/2] Accepting request 309239 from home:eeich:branches:Base:System - Improve-btrfs-handling-on-os-probing-for-grub2.patch * Improve btrfs handling on os-probing for grub2 (bsc#892364) - Replaces: os-prober-btrfsfix-trim-leading-subvol.patch OBS-URL: https://build.opensuse.org/request/show/309239 OBS-URL: https://build.opensuse.org/package/show/Base:System/os-prober?expand=0&rev=53 --- ...rfs-handling-on-os-probing-for-grub2.patch | 61 +++++++++++++++++++ os-prober.changes | 7 +++ os-prober.spec | 2 +- 3 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 Improve-btrfs-handling-on-os-probing-for-grub2.patch diff --git a/Improve-btrfs-handling-on-os-probing-for-grub2.patch b/Improve-btrfs-handling-on-os-probing-for-grub2.patch new file mode 100644 index 0000000..f0557ea --- /dev/null +++ b/Improve-btrfs-handling-on-os-probing-for-grub2.patch @@ -0,0 +1,61 @@ +From: Egbert Eich +Date: Fri May 29 08:55:21 2015 +0200 +Subject: Improve btrfs handling on os-probing for grub2 +Patch-mainline: never + +References: bsc#892364 +Signed-off-by: Egbert Eich + +Currently probing of a grub2 config file is broken if +the root/boot fs is btrfs. This is due to a patch picked +from Fedora which attempts to determine the location of +the kernel and probe for it. +This code has meanwhile changed on Fedora, however the +new version works no better than the old one. +It is possible that this code works under very special +circumstances of the Fedora system, however it is by no +means valid. +Our goal is to +a. determine the location of the kernel in the mounted fs + regardless whether the grub2 config specifies an absolute + or relative path to the kernel file. +b. Prepend the correct prefix if grub2_btrfs expects an + absolute path (either because the current grub2 fs isn't + btrfs or absolute path addressing is explicitely requested). +c. Attempt to handle the location of the kernel file correctly + if this lives on a separate btrfs subvolume. + (Currently this only works if the path to this subvolume is + identical to the fs path). + +Signed-off-by: Egbert Eich +--- + linux-boot-probes/mounted/common/40grub2 | 16 +++++++++++++--- + 1 file changed, 13 insertions(+), 3 deletions(-) + +diff --git a/linux-boot-probes/mounted/common/40grub2 b/linux-boot-probes/mounted/common/40grub2 +index b548585..ccdbebb 100755 +--- a/linux-boot-probes/mounted/common/40grub2 ++++ b/linux-boot-probes/mounted/common/40grub2 +@@ -14,9 +14,19 @@ bootsv="$6" + found_item=0 + + entry_result () { +- if [ "x$type" = "xbtrfs" -a "$rootsv" = "$bootsv" ]; then +- # trim off the leading subvol +- kernelfile=$(echo "$kernel" | cut -d '/' -f 2- | cut -d '/' -f 2-) ++ if [ "x$type" = "xbtrfs" ]; then ++ bsv=${bootsv:+/}${bootsv} ++ # if path is not relative to subvolume make it relative ++ kernel=${kernel#${bsv}} ++ kernelfile=$kernel ++ initrd=${initrd#${bsv}} ++ if [ "x$GRUB_FS" != "xbtrfs" -o "x${SUSE_BTRFS_SNAPSHOT_BOOTING}" != "xtrue" ]; then ++ # absolute path needed: prepend subvolume if $kernel isn't empty ++ kernel=${kernel:+${bsv}}${kernel} ++ initrd=${initrd:+${bsv}}${initrd} ++ fi ++ # assumed: rootsv != bootsv if rootsv isn't ancestor of bootsv ++ [ "$partition" != "$bootpart" -o "$rootsv" != "$bootsv" ] && kernelfile="/boot${kernelfile}" + else + kernelfile=$kernel + fi diff --git a/os-prober.changes b/os-prober.changes index 7d1a32f..c4b259b 100644 --- a/os-prober.changes +++ b/os-prober.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Fri May 29 07:14:40 UTC 2015 - eich@suse.com + +- Improve-btrfs-handling-on-os-probing-for-grub2.patch + * Improve btrfs handling on os-probing for grub2 (bsc#892364) +- Replaces: os-prober-btrfsfix-trim-leading-subvol.patch + ------------------------------------------------------------------- Wed May 13 15:45:30 UTC 2015 - mchang@suse.com diff --git a/os-prober.spec b/os-prober.spec index f722cd9..0dc45dc 100644 --- a/os-prober.spec +++ b/os-prober.spec @@ -57,7 +57,7 @@ Patch15: os-prober-call-dmraid-once.patch # PATCH-FIX-OPENSUSE: fix os-prober misinterprets Windows 8 to be Vista (bsc#910654) Patch16: os-prober-grep-for-windows-bcd-file.patch # PATCH-FIX-SLE: fix os-prober fails to detect other SLES12 installation (bsc#892364) -Patch17: os-prober-btrfsfix-trim-leading-subvol.patch +Patch17: Improve-btrfs-handling-on-os-probing-for-grub2.patch Requires: /bin/grep Requires: /bin/sed Requires: /sbin/modprobe From bb58685f87355c82ed4c9e1b8a9af47190db959b9367d68e4d18988980dcf5c5 Mon Sep 17 00:00:00 2001 From: Michael Chang Date: Mon, 1 Jun 2015 07:26:31 +0000 Subject: [PATCH 2/2] Accepting request 309523 from home:michael-chang:branches:Base:System - Deleted os-prober-btrfsfix-trim-leading-subvol.patch: supersceded by Improve-btrfs-handling-on-os-probing-for-grub2.patch OBS-URL: https://build.opensuse.org/request/show/309523 OBS-URL: https://build.opensuse.org/package/show/Base:System/os-prober?expand=0&rev=54 --- os-prober-btrfsfix-trim-leading-subvol.patch | 13 ------------- os-prober.changes | 6 ++++++ os-prober.spec | 2 +- 3 files changed, 7 insertions(+), 14 deletions(-) delete mode 100644 os-prober-btrfsfix-trim-leading-subvol.patch diff --git a/os-prober-btrfsfix-trim-leading-subvol.patch b/os-prober-btrfsfix-trim-leading-subvol.patch deleted file mode 100644 index 09877c1..0000000 --- a/os-prober-btrfsfix-trim-leading-subvol.patch +++ /dev/null @@ -1,13 +0,0 @@ -Index: os-prober/linux-boot-probes/mounted/common/40grub2 -=================================================================== ---- os-prober.orig/linux-boot-probes/mounted/common/40grub2 -+++ os-prober/linux-boot-probes/mounted/common/40grub2 -@@ -16,7 +16,7 @@ found_item=0 - entry_result () { - if [ "x$type" = "xbtrfs" -a "$rootsv" = "$bootsv" ]; then - # trim off the leading subvol -- kernelfile=$(echo "$kernel" | cut -d '/' -f 2- | cut -d '/' -f 2-) -+ kernelfile=$(echo "$kernel" | sed -e "s!^/${rootsv}/!!") - else - kernelfile=$kernel - fi diff --git a/os-prober.changes b/os-prober.changes index c4b259b..5be29bb 100644 --- a/os-prober.changes +++ b/os-prober.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Mon Jun 1 07:16:32 UTC 2015 - mchang@suse.com + +- Deleted os-prober-btrfsfix-trim-leading-subvol.patch: supersceded + by Improve-btrfs-handling-on-os-probing-for-grub2.patch + ------------------------------------------------------------------- Fri May 29 07:14:40 UTC 2015 - eich@suse.com diff --git a/os-prober.spec b/os-prober.spec index 0dc45dc..138d0be 100644 --- a/os-prober.spec +++ b/os-prober.spec @@ -1,7 +1,7 @@ # # spec file for package os-prober # -# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed