os-prober/os-prober-btrfs-multiple-device.patch
Michael Chang ce7b65b98c Accepting request 726441 from home:michael-chang:branches:Base:System
- Fix duplicated distro detected on btrfs multiple device (bsc#1142858)
  * os-prober-btrfs-multiple-device.patch

- Update URL for downloading source archive from Debain Salsa server
  * os-prober.spec
- Added
  * os-prober-1.76.tar.bz2
- Removed
  * os-prober_1.76.tar.xz

OBS-URL: https://build.opensuse.org/request/show/726441
OBS-URL: https://build.opensuse.org/package/show/Base:System/os-prober?expand=0&rev=98
2019-08-27 10:14:38 +00:00

36 lines
1.4 KiB
Diff

Index: os-prober-1.76/os-prober
===================================================================
--- os-prober-1.76.orig/os-prober
+++ os-prober-1.76/os-prober
@@ -161,6 +161,15 @@ fi
: >"$OS_PROBER_TMP/btrfs-vols"
+btrfsrootdev=$(sed -n -e 's!\([^\s]\+\)\s\+\(/\|/target/boot\|/target\)\s\+btrfs!\1!p;ta;b;:a;q' "$OS_PROBER_TMP/mounted-map")
+if [ -n "$btrfsrootdev" ] ; then
+ if btrfsrootdev="$(mapdevfs "$btrfsrootdev")"; then
+ btrfsrootdevuuid=$(blkid -o value -s UUID "$btrfsrootdev")
+ debug "btrfs is mounted as root, uuid: $btrfsrootdevuuid"
+ echo "$btrfsrootdevuuid" >>"$OS_PROBER_TMP/btrfs-vols"
+ fi
+fi
+
for partition in $(partitions); do
if ! mapped="$(mapdevfs "$partition")"; then
log "Device '$partition' does not exist; skipping"
@@ -183,13 +192,9 @@ for partition in $(partitions); do
# be handled by 50mounted-tests so we can do a subvol only once.
type=$(blkid -o value -s TYPE $mapped || true)
if [ "$type" = btrfs ]; then
- mpoint=$(grep "^$mapped " "$OS_PROBER_TMP/mounted-map" | head -n1 | cut -d " " -f 2)
- mpoint="$(unescape_mount "$mpoint")"
- if [ "$mpoint" = "/target/boot" ] || [ "$mpoint" = "/target" ] || [ "$mpoint" = "/" ]; then
- continue
- fi
uuid=$(blkid -o value -s UUID $mapped)
if grep -q "^$uuid" "$OS_PROBER_TMP/btrfs-vols" ; then
+ debug "skipped btrfs partition=$partition uuid=$uuid"
continue
fi
debug "btrfs volume uuid=$uuid partition=$partition"