Hello community,
here is the log from the commit of package os-prober.4839 for openSUSE:13.2:Update checked in at 2016-03-24 11:24:50
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:13.2:Update/os-prober.4839 (Old)
and /work/SRC/openSUSE:13.2:Update/.os-prober.4839.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "os-prober.4839"
Changes:
--------
New Changes file:
--- /dev/null 2016-01-27 19:41:03.648095915 +0100
+++ /work/SRC/openSUSE:13.2:Update/.os-prober.4839.new/os-prober.changes 2016-03-24 11:24:53.000000000 +0100
@@ -0,0 +1,189 @@
+-------------------------------------------------------------------
+Tue Mar 8 10:24:46 UTC 2016 - mchang@suse.com
+
+- sync patches from openSUSE Factory
+- fix os-prober fails to detect other SLES12 installation (bsc#892364)
+ * added Improve-btrfs-handling-on-os-probing-for-grub2.patch
+- fix os-prober mount error, no such file or directory (bsc#931955)
+ * added os-prober-btrfs-absolute-subvol.patch
+- also skip legacy grub if /boot/grub2/grub.cfg is present
+ * added os-prober-40grub-check-grub2.patch
+- fix detect os on default subvolume in snapshot (bsc#954225)
+ * added os-prober-btrfs-snapshot-detection.patch
+- fix os-prober update broke Linux detection (bsc#957018)
+ * added os-prober-btrfs-always-detect-default.patch
+- fix y2base runs at 100% cpu busy from beginning in installation of files to
+ completion (bsc#953987)
+ * added os-prober-linux-distro-avoid-expensive-ld-file-test.patch
+
+-------------------------------------------------------------------
+Tue Aug 19 11:15:57 UTC 2014 - mchang@suse.com
+
+- requires util-linux-systemd (bnc#892337)
+
+-------------------------------------------------------------------
+Fri Jun 20 20:42:01 UTC 2014 - jeffm@suse.com
+
+- add os-prober-call-dmraid-once.patch
+ * fix os-prober: dmraid is called without a device list for every
+ partition (bnc#883453)
+
+-------------------------------------------------------------------
+Sat May 31 20:49:32 UTC 2014 - crrodriguez@opensuse.org
+
+- Neither dmraid nor lvm are mandatory components to get a
+ working systemd but this package is, since it is required by grub2.
+ Downgrade the requires to recommends so lvm2/dmraid can be uninstalled
+ without rendering the system unusable.
+
+-------------------------------------------------------------------
+Thu May 29 08:26:40 UTC 2014 - mchang@suse.com
+
+- add os-prober-skip-part-on-multipath.patch
+ * fix os-prober creates many unusuable entries on multipath disk
+ (bnc#875327)
+
+-------------------------------------------------------------------
+Wed Jan 15 15:59:02 UTC 2014 - arvidjaar@gmail.com
+
+- fix os-prober-btrfsfix.patch - current "btrfs subvolume list -s"
+ adds some extra fields. Adjust field number to get subvolume name.
+
+-------------------------------------------------------------------
+Wed Dec 18 04:16:03 UTC 2013 - mchang@suse.com
+
+- add os-prober-fix-btrfs-subvol-mounted-tests.patch
+ * move btrfs subvolume mounted tests after regualr rootfs tree
+ tests to make sure that root and subvolume fs tree are tested.
+ * the test order is just a preference, assuming that distribution
+ are installed to root fs tree more likely than to a subvolume.
+
+-------------------------------------------------------------------
+Fri Dec 6 09:21:55 UTC 2013 - mchang@suse.com
+
+- add os-prober-dont-load-all-fs-module-and-dont-test-mount.patch
+ * don't modprobe that many kernel file system modules before mount
+ as mount will take care that for us (bnc#782689)
+ * don't test mount on partitions without any known file system
+ detected (bnc#851722)
+
+-------------------------------------------------------------------
+Thu Nov 7 07:01:44 UTC 2013 - mchang@suse.com
+
+- add require btrfsprogs
+
+-------------------------------------------------------------------
+Sun Aug 18 18:54:20 UTC 2013 - arvidjaar@gmail.com
+
+- add os-prober-accept-ESP-on-IMSM.patch
+ * accept EFI partition on IMSM MD array (bnc#818871)
+ * fix DOS partition table detection
+
+Fri May 31 10:26:48 UTC 2013 - arvidjaar@gmail.com
+
+- update to os-prober 1.61. Highlights:
+ * Fix detection of Fedora and other distros that moved /lib into /usr
+ * sed off (hdn,n) from the front of an initrd path
+ * Add support to detect BSD systems
+ * add support for probing EFI System Partition
+- rediff
+ * os-prober-1.49-fix-grub2.cfg-parsing.patch - part implemented
+ differenty upstream; added additional os-prober entries detection based
+ on menu entry ID as suggested by Vladimir Serbienko
+ * os-prober-1.49-grub2-mount.patch
+ * os-prober-SUSE.patch
+ * os-prober-linux-secure-boot.patch
+- drop upstream patches
+ * os-prober-usr_lib-detection.patch
+ * os-prober-skip-MS-legacy-on-UEFI.patch together with 05efi, efi-20microsoft,
+ efi-10elilo
+- add
+ * os-prober-btrfsfix.patch - support btrfs. Patch from Fedora with
+ all unrelated changes cleaned out
+ * os-prober-EFI-openSUSEfy.patch - cosmetic changes between our scripts
+ and version adopted upstream
+
+-------------------------------------------------------------------
+Fri Apr 5 16:33:28 UTC 2013 - arvidjaar@gmail.com
+
+- add os-prober-linux-secure-boot.patch (bnc#810912)
+ * recognize linuxefi/initrdefi too
+
+-------------------------------------------------------------------
+Fri Mar 22 17:29:32 UTC 2013 - arvidjaar@gmail.com
+
+- add os-prober-probe-MD-devices.patch (bnc#811006)
+ * probe also Linux MD devices
+
+-------------------------------------------------------------------
+Sun Mar 3 16:06:32 UTC 2013 - arvidjaar@gmail.com
+
+- 05efi - accept FUSE as valid filesystem too (bnc#807190)
+
+-------------------------------------------------------------------
+Fri Feb 8 15:16:13 UTC 2013 - arvidjaar@gmail.com
+
+- os-prober-usr_lib-detection.patch - fix detection of linux distro
+ which moved /lib to /usr/lib (e.g. Fedora)
+
+-------------------------------------------------------------------
+Sat Jan 19 19:12:20 UTC 2013 - arvidjaar@gmail.com
+
+- os-prober-1.49-grub2-mount.patch (bnc#767272)
+ * In openSUSE grub-mount is called grub2-mount
+
+-------------------------------------------------------------------
+Sat Jan 19 13:41:59 UTC 2013 - arvidjaar@gmail.com
+
+- fix os-prober-1.49-fix-grub2.cfg-parsing.patch (bnc#799457)
+ * initrd was missing
+ * entries sometimes were not emitted
+
+-------------------------------------------------------------------
+Wed Jan 16 18:09:08 UTC 2013 - arvidjaar@gmail.com
+
+- add os-prober-1.49-skip-LVM2_member.patch (bnc#798604)
+ * do not try to mount LVM2 PV
+
+-------------------------------------------------------------------
+Tue Jan 8 07:14:53 UTC 2013 - arvidjaar@gmail.com
+
+- add os-prober-1.49-fix-grub2.cfg-parsing.patch (bnc#796919)
+
+-------------------------------------------------------------------
+Fri Jan 4 11:18:01 UTC 2013 - arvidjaar@gmail.com
+
+- add support for chainloading another UEFI bootloader (bnc#775610)
+ * 05efi - top level driver to search ESP
+ * efi-20microsoft - support Microsoft UEFI bootloader
+ * efi-10elilo - support ELILO UEFI bootloader (Agnelo de la Crotche)
+- skip legacy Microsoft bootloader on UEFI (bnc#775610)
+
+-------------------------------------------------------------------
+Mon Dec 19 11:13:44 UTC 2011 - aj@suse.de
+
+- Clarify license.
+
+-------------------------------------------------------------------
+Thu Dec 8 12:23:12 UTC 2011 - aj@suse.de
+
+- Update to 1.49:
+ * MeeGo detection support
+ * Bugfixes
+
+-------------------------------------------------------------------
+Thu Dec 8 11:18:49 UTC 2011 - coolo@suse.com
+
+- this seems to be "GPL" as it was understood 2004, so guessing
+ GPL-2.0+
+
+-------------------------------------------------------------------
+Fri Sep 30 15:53:26 UTC 2011 - uli@suse.com
+
+- cross-build fix: use %__cc macro
+
+-------------------------------------------------------------------
+Tue Jul 12 13:08:58 UTC 2011 - aj@suse.de
+
+- Create new package.
+
New:
----
COPYING-note.txt
Improve-btrfs-handling-on-os-probing-for-grub2.patch
os-prober-1.49-fix-grub2.cfg-parsing.patch
os-prober-1.49-grub2-mount.patch
os-prober-1.49-skip-LVM2_member.patch
os-prober-40grub-check-grub2.patch
os-prober-EFI-openSUSEfy.patch
os-prober-SUSE.patch
os-prober-accept-ESP-on-IMSM.patch
os-prober-btrfs-absolute-subvol.patch
os-prober-btrfs-always-detect-default.patch
os-prober-btrfs-snapshot-detection.patch
os-prober-btrfsfix.patch
os-prober-call-dmraid-once.patch
os-prober-dont-load-all-fs-module-and-dont-test-mount.patch
os-prober-fix-btrfs-subvol-mounted-tests.patch
os-prober-linux-distro-avoid-expensive-ld-file-test.patch
os-prober-linux-secure-boot.patch
os-prober-newnsdirfix.patch
os-prober-probe-MD-devices.patch
os-prober-skip-part-on-multipath.patch
os-prober.changes
os-prober.spec
os-prober_1.61.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ os-prober.spec ++++++
#
# spec file for package os-prober
#
# Copyright (c) 2016 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
Name: os-prober
Version: 1.61
Release: 0
Summary: Probes disks on the system for installed operating systems
License: GPL-2.0+
Group: System/Boot
Url: http://kitenet.net/~joey/code/os-prober/
Source0: http://ftp.de.debian.org/debian/pool/main/o/os-prober/%{name}_%{version}.tar.gz
Source1: COPYING-note.txt
# move newns binary outside of os-prober subdirectory, so that debuginfo
# can be automatically generated for it
Patch0: os-prober-newnsdirfix.patch
# PATCH-FIX-OPENSUSE: Fix spelling of SUSE aj@suse.de
Patch1: os-prober-SUSE.patch
# PATCH-FIX-OPENSUSE: Fix parsing of grub.cfg [bnc#796919]
Patch3: os-prober-1.49-fix-grub2.cfg-parsing.patch
# PATCH-FIX-OPENSUSE: Do not try to mount LVM2 PV [bnc#798604]
Patch4: os-prober-1.49-skip-LVM2_member.patch
# PATCH-FIX-OPENSUSE: Use correct name for grub2-mount
Patch5: os-prober-1.49-grub2-mount.patch
# PATCH-FIX-OPENSUSE: Probe also unpartitioned Linux MD devices (bnc#811006)
Patch7: os-prober-probe-MD-devices.patch
# PATCH-FIX-OPENSUSE: Detect linux secure boot entries too (bnc#810912)
Patch8: os-prober-linux-secure-boot.patch
# PATCH-FIX-OPENSUSE: btrfs support from Fedora (rediffed)
Patch9: os-prober-btrfsfix.patch
# PATCH-FIX-OPENSUSE: difference between upstream and our previous scripts
Patch10: os-prober-EFI-openSUSEfy.patch
# PATCH-FIX-OPENSUSE: accept ESP on IMSM MD raid (bnc#818871)
Patch11: os-prober-accept-ESP-on-IMSM.patch
# PATCH-FIX-OPENSUSE: don't modprobe all file system modules and don't test mount on unknown partition (bnc#851722)
Patch12: os-prober-dont-load-all-fs-module-and-dont-test-mount.patch
# PATCH-FIX-OPENSUSE: fix os-prober entries for distro on btrfs root-fs not created (bnc#846003)
Patch13: os-prober-fix-btrfs-subvol-mounted-tests.patch
# PATCH-FIX-SLE: fix os-prober creates many unusuable entries on multipath disk (bnc#875327)
Patch14: os-prober-skip-part-on-multipath.patch
# PATCH-FIX-SLE: fix os-prober: dmraid is called without a device list for every partition (bnc#883453)
Patch15: os-prober-call-dmraid-once.patch
# PATCH-FIX-SLE: fix os-prober fails to detect other SLES12 installation (bsc#892364)
Patch17: Improve-btrfs-handling-on-os-probing-for-grub2.patch
# PATCH-FIX-SLE: fix os-prober mount error, no such file or directory (bsc#931955)
Patch18: os-prober-btrfs-absolute-subvol.patch
# PATCH-FIX-OPENSUSE: also skip legacy grub if /boot/grub2/grub.cfg is present
Patch19: os-prober-40grub-check-grub2.patch
# PATCH-FIX-OPENSUSE: detect os on default subvolume in snapshot (bsc#954225)
Patch21: os-prober-btrfs-snapshot-detection.patch
# PATCH-FIX-OPENSUSE: os-prober update broke Linux detection (bsc#957018)
Patch22: os-prober-btrfs-always-detect-default.patch
# PATCH-FIX-OPENSUSE: y2base runs at 100% cpu busy from beginning in installation of files to completion (bsc#953987)
Patch23: os-prober-linux-distro-avoid-expensive-ld-file-test.patch
Requires: /bin/grep
Requires: /bin/sed
Requires: /sbin/modprobe
Requires: btrfsprogs
Requires: coreutils
Recommends: dmraid
Recommends: lvm2
Requires: udev
Requires: util-linux
%if 0%{?suse_version} >= 1315
# For logger utility
Requires: util-linux-systemd
%endif
%description
This package detects other OSes available on a system and outputs the results
in a generic machine-readable format. Support for new OSes and Linux
distributions can be added easily.
%prep
%setup -q -n %{name}-%{version}
cp %SOURCE1 .
%patch0 -p1
%patch1 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch17 -p1
%patch18 -p1
%patch19 -p1
%patch21 -p1
%patch22 -p1
%patch23 -p1
%build
make %{?_smp_mflags} CC="%__cc" CFLAGS="%{optflags}"
%install
install -m 0755 -d %{buildroot}%{_bindir}
install -m 0755 -d %{buildroot}%{_localstatedir}/lib/%{name}
install -m 0755 -p os-prober linux-boot-prober %{buildroot}%{_bindir}
install -m 0755 -Dp newns %{buildroot}%{_libexecdir}/newns
install -m 0644 -Dp common.sh %{buildroot}%{_datadir}/%{name}/common.sh
%ifarch m68k
ARCH=m68k
%endif
%ifarch ppc ppc64
ARCH=powerpc
%endif
%ifarch sparc sparc64
ARCH=sparc
%endif
%ifarch %{ix86} x86_64
ARCH=x86
%endif
for probes in os-probes os-probes/mounted os-probes/init \
linux-boot-probes linux-boot-probes/mounted; do
install -m 755 -d %{buildroot}%{_libexecdir}/$probes
cp -a $probes/common/* %{buildroot}%{_libexecdir}/$probes
if [ -e "$probes/$ARCH" ]; then
cp -a $probes/$ARCH/* %{buildroot}%{_libexecdir}/$probes
fi
done
if [ "$ARCH" = x86 ]; then
install -m 755 -p os-probes/mounted/powerpc/20macosx \
%{buildroot}%{_libexecdir}/os-probes/mounted
fi
%files
%defattr(-,root,root,-)
%doc README TODO debian/copyright debian/changelog COPYING-note.txt
%{_bindir}/*
%{_libexecdir}/linux-boot-probes
%{_libexecdir}/newns
%{_libexecdir}/os-probes
%{_datadir}/%{name}
%{_localstatedir}/lib/%{name}
%changelog
++++++ COPYING-note.txt ++++++
Version 1.50 of os-prober contains a license clarification, the
license of the package is GPL-2+, see for example the following commits:
http://anonscm.debian.org/gitweb/?p=d-i/os-prober.git;a=commitdiff;h=249d081...
http://anonscm.debian.org/gitweb/?p=d-i/os-prober.git;a=commit;h=25024daeccd...
http://anonscm.debian.org/gitweb/?p=d-i/os-prober.git;a=commit;h=cc0ce8e5ec2...
The copyright file reads as of 2011-12-19:
The majority of code in os-prober is Copyright 2004-2011 by Joshua
Kwan, Joey Hess, Christian Perrier, Colin Watson and Otavio Salvador.
This is licensed under the terms of the GNU GPL, either version 2 or,
at your option, any later version.
Some portions of os-prober by other contributors has an unclear license
of "GNU GPL", with the version not specified.
On Debian systems, a copy of the GNU General Public License is available in
/usr/share/common-licenses/GPL.
++++++ Improve-btrfs-handling-on-os-probing-for-grub2.patch ++++++
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
v2:
a. Fix missing linux16/initrd16 parsing in entry result
b. Fix kernelfile path if separate boot partition on btrfs
Signed-off-by: Michael Chang
---
linux-boot-probes/mounted/common/40grub2 | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
Index: os-prober-1.61/linux-boot-probes/mounted/common/40grub2
===================================================================
--- os-prober-1.61.orig/linux-boot-probes/mounted/common/40grub2
+++ os-prober-1.61/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
@@ -81,7 +91,7 @@ parse_grub_menu () {
ignore_item=1
fi
;;
- linux|linuxefi)
+ linux|linuxefi|linux16)
# Hack alert: sed off any (hdn,n) but
# assume the kernel is on the same
# partition.
@@ -90,14 +100,14 @@ parse_grub_menu () {
parameters="$@"
# Systems with a separate /boot will not have
# the path to the kernel in grub.cfg.
- if [ "$partition" != "$bootpart" ]; then
+ if [ "$partition" != "$bootpart" -a "$type" != "btrfs" ]; then
kernel="/boot$kernel"
fi
;;
- initrd|initrdefi)
+ initrd|initrdefi|initrd16)
initrd="$(echo "$2" | sed 's/(.*)//')"
# Initrd same.
- if [ "$partition" != "$bootpart" ]; then
+ if [ "$partition" != "$bootpart" -a "$type" != "btrfs" ]; then
initrd="/boot$initrd"
fi
;;
++++++ os-prober-1.49-fix-grub2.cfg-parsing.patch ++++++
From: Andrey Borzenkov
Subject: fix parsing GRUB2 grub.cfg
References: bnc#796919
Fix several problems in parsing of grub.cfg by
linux-boot-probes/mounted/40grub2
1. Look for /boot/grub2-efi/grub.cfg as well (openSUSE 12.2)
2. It checked for literal "(on /dev/.*)" to filter out menu entries
added by another os-prober on target system. But grub.cfg now includes
TRANSLATED strings, so this check will fail if grub.cfg was created in
non-English locale. Use menu entry ID to check whether entry was added
by os-prober (it always starts with osprober-). Suggested by Vladimir
Serbienko.
Index: os-prober-1.61/linux-boot-probes/mounted/common/40grub2
===================================================================
--- os-prober-1.61.orig/linux-boot-probes/mounted/common/40grub2
+++ os-prober-1.61/linux-boot-probes/mounted/common/40grub2
@@ -43,6 +43,13 @@ parse_grub_menu () {
menuentry)
entry_result
shift 1
+ # Currently GRUB2 puts translated strings
+ # in grub.cfg, so checking for verbatim
+ # (on /dev/.*) will fail if target grub.cfg
+ # was created in non-English locale. Extract
+ # menu entry ID and check if it starts with
+ # "osprober-"
+ id="$(echo "$line" | sed -n 's/^.*[[:space:]]\+\(\$menuentry_id_option\|--id\)[[:space:]]\+\([^[:space:]]\+\).*$/\2/p')"
# The double-quoted string is the title.
# Make sure to look at the text of the line
# before 'set' mangled it.
@@ -58,9 +65,9 @@ parse_grub_menu () {
fi
if [ -z "$title" ]; then
ignore_item=1
- elif echo "$title" | grep -q '(on /dev/[^)]*)$'; then
+ elif echo "$title" | grep -q '(on /dev/[^)]*)$' || echo "$id" | grep -q "^\([\"']\|\)osprober-"; then
log "Skipping entry '$title':"
- log "appears to be an automatic reference taken from another menu.lst"
+ log "appears to be an automatic reference taken from another grub.cfg"
ignore_item=1
fi
;;
@@ -98,6 +105,9 @@ if [ -e "$mpoint/boot/grub/grub.cfg" ] &
[ "$mpoint/boot/grub/grub.cfg" -nt "$mpoint/boot/grub/menu.lst" ]); then
debug "parsing grub.cfg"
parse_grub_menu "$mpoint" "$partition" "$bootpart" < "$mpoint/boot/grub/grub.cfg"
+elif [ -e "$mpoint/boot/grub2-efi/grub.cfg" ]; then
+ debug "parsing grub.cfg"
+ parse_grub_menu "$mpoint" "$partition" "$bootpart" < "$mpoint/boot/grub2-efi/grub.cfg"
elif [ -e "$mpoint/boot/grub2/grub.cfg" ]; then
debug "parsing grub.cfg"
parse_grub_menu "$mpoint" "$partition" "$bootpart" < "$mpoint/boot/grub2/grub.cfg"
++++++ os-prober-1.49-grub2-mount.patch ++++++
From: Andrey Borzenkov
Subject: replace grub-mount with grub2-mount everywhere
References: bnc#799457, bnc#767272
We use grub2-mount, not grub-mount. As shown in bnc#799457,
grub2-mount may access filesystem even when kernel driver
will refuse it. os-prober makes devices read-only to prevent
accidental damage, so kernel driver fails if log replay is needed
but cannot be performed.
This may likely fix bnc#767272
Index: os-prober-1.57/os-probes/init/common/10filesystems
===================================================================
--- os-prober-1.57.orig/os-probes/init/common/10filesystems
+++ os-prober-1.57/os-probes/init/common/10filesystems
@@ -3,7 +3,7 @@
set +e # ignore errors from modprobe
FILESYSTEMS='ext2 ext3 ext4 reiserfs xfs jfs msdos vfat ntfs minix hfs hfsplus qnx4 ufs btrfs'
-# fuse is needed to make grub-mount work.
+# fuse is needed to make grub2-mount work.
FILESYSTEMS="$FILESYSTEMS fuse"
# The Ubuntu kernel udebs put a number of filesystem modules in
# fs-{core,secondary}-modules. It's fairly cheap to check for these too.
Index: os-prober-1.57/common.sh
===================================================================
--- os-prober-1.57.orig/common.sh
+++ os-prober-1.57/common.sh
@@ -259,8 +259,8 @@ linux_mount_boot () {
debug "found boot partition $1 for linux system on $partition, but cannot map to existing device"
else
debug "found boot partition $bootpart for linux system on $partition"
- if type grub-mount >/dev/null 2>&1 && \
- grub-mount "$boottomnt" "$tmpmnt/boot" 2>/dev/null; then
+ if type grub2-mount >/dev/null 2>&1 && \
+ grub2-mount "$boottomnt" "$tmpmnt/boot" 2>/dev/null; then
mounted=1
else
ro_partition "$boottomnt"
Index: os-prober-1.57/linux-boot-probes/common/50mounted-tests
===================================================================
--- os-prober-1.57.orig/linux-boot-probes/common/50mounted-tests
+++ os-prober-1.57/linux-boot-probes/common/50mounted-tests
@@ -34,11 +34,11 @@ if [ ! -d "$tmpmnt" ]; then
fi
mounted=
-if type grub-mount >/dev/null 2>&1 && \
- type grub-probe >/dev/null 2>&1 && \
- grub-mount "$partition" "$tmpmnt" 2>/dev/null; then
+if type grub2-mount >/dev/null 2>&1 && \
+ type grub2-probe >/dev/null 2>&1 && \
+ grub2-mount "$partition" "$tmpmnt" 2>/dev/null; then
mounted=1
- type="$(grub-probe -d "$partition" -t fs)"
+ type="$(grub2-probe -d "$partition" -t fs)"
[ "$type" ] || type=fuseblk
else
ro_partition "$partition"
Index: os-prober-1.57/os-probes/common/50mounted-tests
===================================================================
--- os-prober-1.57.orig/os-probes/common/50mounted-tests
+++ os-prober-1.57/os-probes/common/50mounted-tests
@@ -49,11 +49,11 @@ if [ ! -d "$tmpmnt" ]; then
fi
mounted=
-if type grub-mount >/dev/null 2>&1 && \
- type grub-probe >/dev/null 2>&1 && \
- grub-mount "$partition" "$tmpmnt" 2>/dev/null; then
+if type grub2-mount >/dev/null 2>&1 && \
+ type grub2-probe >/dev/null 2>&1 && \
+ grub2-mount "$partition" "$tmpmnt" 2>/dev/null; then
mounted=1
- type="$(grub-probe -d "$partition" -t fs)" || true
+ type="$(grub2-probe -d "$partition" -t fs)" || true
if [ "$type" ]; then
debug "mounted using GRUB $type filesystem driver"
else
++++++ os-prober-1.49-skip-LVM2_member.patch ++++++
Index: os-prober/os-probes/common/50mounted-tests
===================================================================
--- os-prober.orig/os-probes/common/50mounted-tests
+++ os-prober/os-probes/common/50mounted-tests
@@ -15,6 +15,9 @@ elif [ "$types" = swap ]; then
elif [ "$types" = crypto_LUKS ]; then
debug "$1 is a LUKS partition; skipping"
exit 0
+elif [ "$types" = LVM2_member ]; then
+ debug "$1 is a LVM2 partition; skipping"
+ exit 0
elif [ "$types" = ntfs ]; then
if type ntfs-3g >/dev/null 2>&1; then
types='ntfs-3g ntfs'
++++++ os-prober-40grub-check-grub2.patch ++++++
From: Andrei Borzenkov
Subject: Also skip legacy grub if grub2 is found
Check for grub.cfg also in /boot/grub2, not only in /boot/grub.
Index: os-prober/linux-boot-probes/mounted/x86/40grub
===================================================================
--- os-prober.orig/linux-boot-probes/mounted/x86/40grub
+++ os-prober/linux-boot-probes/mounted/x86/40grub
@@ -95,7 +95,9 @@ fi
if [ "$grubconf" ] && \
([ ! -e "$mpoint/boot/grub/grub.cfg" ] || \
- [ "$mpoint/boot/grub/$grubconf" -nt "$mpoint/boot/grub/grub.cfg" ]); then
+ [ "$mpoint/boot/grub/$grubconf" -nt "$mpoint/boot/grub/grub.cfg" ]) && \
+ ([ ! -e "$mpoint/boot/grub2/grub.cfg" ] || \
+ [ "$mpoint/boot/grub/$grubconf" -nt "$mpoint/boot/grub2/grub.cfg" ]); then
debug "parsing $grubconf"
parse_grub_menu "$mpoint" "$partition" "$bootpart" < "$mpoint/boot/grub/$grubconf"
fi
++++++ os-prober-EFI-openSUSEfy.patch ++++++
From: Andrey Borzenkov
Subject: keep UEFI scripts the same as they were in openSUSE
Small cosmetic changes to ensure UEFI scripts keep content
after upstream merged (slightly outdated) version of them.
- retain ELILO vendor prefix in case someone is really using it
- comment in 05efi is obviously wrong
Index: os-prober-1.61/os-probes/mounted/x86/efi/10elilo
===================================================================
--- os-prober-1.61.orig/os-probes/mounted/x86/efi/10elilo
+++ os-prober-1.61/os-probes/mounted/x86/efi/10elilo
@@ -11,7 +11,8 @@ elilo=`find $1 -name "elilo.efi"`
if [ -n "$elilo" ]; then
bdir=`dirname $elilo`
bdir=`basename $bdir`
- long="ELILO Boot Manager"
+ vendor=$(echo $bdir | sed 's|SuSE|SUSE|')
+ long="${vendor} ELILO Boot Manager"
short="ELILO"
path=${bdir}/elilo.efi
found=true
Index: os-prober-1.61/os-probes/mounted/x86/05efi
===================================================================
--- os-prober-1.61.orig/os-probes/mounted/x86/05efi
+++ os-prober-1.61/os-probes/mounted/x86/05efi
@@ -1,5 +1,5 @@
#!/bin/sh
-# Detects all Microsoft OSes on a collection of partitions.
+# Detects all UEFI bootloaders on EFI System Partition
. /usr/share/os-prober/common.sh
++++++ os-prober-SUSE.patch ++++++
Index: os-prober-1.57/os-probes/mounted/common/90linux-distro
===================================================================
--- os-prober-1.57.orig/os-probes/mounted/common/90linux-distro
+++ os-prober-1.57/os-probes/mounted/common/90linux-distro
@@ -84,7 +84,7 @@ if (ls "$dir"/lib*/ld*.so* || ls "$dir"/
short="RedHat"
long="$(cat "$dir/etc/redhat-release")"
elif [ -e "$dir/etc/SuSE-release" ]; then
- short="SuSE"
+ short="SUSE"
long="$(head -n 1 "$dir/etc/SuSE-release")"
elif [ -e "$dir/etc/gentoo-release" ]; then
short="Gentoo"
++++++ os-prober-accept-ESP-on-IMSM.patch ++++++
Index: os-prober-1.61/os-probes/mounted/x86/05efi
===================================================================
--- os-prober-1.61.orig/os-probes/mounted/x86/05efi
+++ os-prober-1.61/os-probes/mounted/x86/05efi
@@ -28,20 +28,31 @@ if type udevadm > /dev/null 2>&1; then
fi
if type udevinfo > /dev/null 2>&1; then
- # Skip virtual devices
+ eval "$(udevinfo -q property -n "$partition" | grep -E '^(MD_CONTAINER|ID_PART_ENTRY_(TYPE|SCHEME))=')"
+ debug "$partition container is '$MD_CONTAINER'"
+
+ # Skip virtual devices unless they are known SW-RAID
if udevinfo -q path -n $partition | grep -q /virtual/; then
- debug "$1 is virtual device: exiting"
- exit 1
+ # Check for Intel Matrix array
+ if [ -n "$MD_CONTAINER" ]; then
+ eval "$(udevinfo -q property -n "$MD_CONTAINER" | grep -E '^MD_METADATA=')"
+ debug "$MD_CONTAINER metadata is '$MD_METADATA'"
+ fi
+ if [ "$MD_METADATA" = imsm ]; then
+ debug "$partition is on IMSM array"
+ else
+ debug "$1 is virtual device: exiting"
+ exit 1
+ fi
fi
- eval "$(udevinfo -q property -n "$partition" | grep -E '^ID_PART_ENTRY_(TYPE|SCHEME)=')"
debug "$partition partition scheme is $ID_PART_ENTRY_SCHEME"
debug "$partition partition type is $ID_PART_ENTRY_TYPE"
if [ -z "$ID_PART_ENTRY_TYPE" -o -z "$ID_PART_ENTRY_SCHEME" -o \
- \( "$ID_PART_ENTRY_SCHEME" != gpt -a "$ID_PART_ENTRY_SCHEME" != msdos \) -o \
+ \( "$ID_PART_ENTRY_SCHEME" != gpt -a "$ID_PART_ENTRY_SCHEME" != dos \) -o \
\( "$ID_PART_ENTRY_SCHEME" = gpt -a "$ID_PART_ENTRY_TYPE" != c12a7328-f81f-11d2-ba4b-00a0c93ec93b \) -o \
- \( "$ID_PART_ENTRY_SCHEME" = msdos -a "$ID_PART_ENTRY_TYPE" != 0xef \) ]; then
+ \( "$ID_PART_ENTRY_SCHEME" = dos -a "$ID_PART_ENTRY_TYPE" != 0xef \) ]; then
debug "$partition is not a ESP partition: exiting"
exit 1
fi
++++++ os-prober-btrfs-absolute-subvol.patch ++++++
Index: os-prober-1.61/os-probes/common/50mounted-tests
===================================================================
--- os-prober-1.61.orig/os-probes/common/50mounted-tests
+++ os-prober-1.61/os-probes/common/50mounted-tests
@@ -58,9 +58,7 @@ mounted=
if [ "$types" = btrfs ]; then
partition="$BTRFSDEV"
-fi
-
-if type grub2-mount >/dev/null 2>&1 && \
+elif type grub2-mount >/dev/null 2>&1 && \
type grub2-probe >/dev/null 2>&1 && \
grub2-mount "$partition" "$tmpmnt" 2>/dev/null; then
mounted=1
@@ -114,9 +112,9 @@ if [ "$types" = btrfs ]; then
exit 1
fi
# besides regular subvols, get ro and snapshot so thet can be excluded
- subvols=$(btrfs subvolume list "$tmpmnt" | cut -d ' ' -f 9)
- rosubvols=$(btrfs subvolume list -r "$tmpmnt" | cut -d ' ' -f 9)
- sssubvols=$(btrfs subvolume list -s "$tmpmnt" | cut -d ' ' -f 14)
+ subvols=$(btrfs subvolume list -a "$tmpmnt" | cut -d ' ' -f 9 | sed -e s!^\/!!)
+ rosubvols=$(btrfs subvolume list -r -a "$tmpmnt" | cut -d ' ' -f 9 | sed -e s!^\/!!)
+ sssubvols=$(btrfs subvolume list -s -a "$tmpmnt" | cut -d ' ' -f 14 | sed -e s!^\/!!)
if ! umount "$tmpmnt"; then
warn "failed to umount btrfs volume on $tmpmnt"
rmdir "$tmpmnt" || true
++++++ os-prober-btrfs-always-detect-default.patch ++++++
Index: os-prober-1.61/linux-boot-prober
===================================================================
--- os-prober-1.61.orig/linux-boot-prober
+++ os-prober-1.61/linux-boot-prober
@@ -67,7 +67,12 @@ if [ "$type" = btrfs ]; then
fi
if [ -z "$mpoint" ]; then
# mount the btrfs root
- if ! mount -o subvol=$subvol -t btrfs -U $UUID "$tmpmnt" 2>/dev/null; then
+
+ if [ -n "$subvol" ]; then
+ opts="-o subvol=$subvol"
+ fi
+
+ if ! mount $opts -t btrfs -U $UUID "$tmpmnt" 2>/dev/null; then
warn "error mounting btrfs subvol=$subvol UUID=$UUID"
umount "$tmpmnt/boot" 2>/dev/null
umount "$tmpmnt" 2>/dev/null
Index: os-prober-1.61/os-probes/common/50mounted-tests
===================================================================
--- os-prober-1.61.orig/os-probes/common/50mounted-tests
+++ os-prober-1.61/os-probes/common/50mounted-tests
@@ -99,6 +99,48 @@ if [ "$mounted" ]; then
fi
fi
+
+probe_subvol ()
+{
+ local subvol=$1
+ local partition=$2
+ local UUID=$3
+ local tmpmnt=$4
+
+ mounted=
+ mpoint="$(grep btrfs /proc/self/mountinfo | grep "$partition " | grep "/$subvol " | cut -d ' ' -f 5)"
+ ret=1
+
+ if [ -n "$subvol" ]; then
+ opts="-o subvol=$subvol"
+ fi
+
+ if [ -n "$mpoint" ]; then
+ if [ "x$mpoint" = "x/" ]; then
+ continue # this is the root for the running system
+ fi
+ mounted=1
+ else
+ # again, do not mount btrfs ro
+ mount -t btrfs $opts -U "$UUID" "$tmpmnt"
+ mpoint="$tmpmnt"
+ fi
+ test="/usr/lib/os-probes/mounted/90linux-distro"
+ if [ -f "$test" ] && [ -x "$test" ]; then
+ debug "running subtest $test"
+ if "$test" "$partition" "$mpoint" btrfs "UUID=$UUID" "subvol=$subvol"; then
+ debug "os found by subtest $test on subvol $subvol"
+ ret=0
+ fi
+ fi
+ if [ -z "$mounted" ]; then
+ if ! umount "$tmpmnt"; then
+ warn "failed to umount $tmpmnt"
+ fi
+ fi
+ return $ret
+}
+
# all btrfs subvol processing here. Handle both unmounted and
# mounted subvolumes.
if [ "$types" = btrfs ]; then
@@ -121,45 +163,23 @@ if [ "$types" = btrfs ]; then
rmdir "$tmpmnt" || true
exit 1
fi
- if [ -z "$subvols" ]; then
- debug "no subvols found on btrfs volume $UUID"
- exit 1
- fi
+
found=
- for subvol in $subvols; do
- debug "begin btrfs processing for $UUID subvol=$subvol"
- if [ "$subvol" != "$defaultvol" ]; then
- if echo "$rosubvols" | grep -q -x "$subvol"; then
- continue
- fi
- if echo "$sssubvols" | grep -q -x "$subvol"; then
- continue
- fi
- fi
- mounted=
- mpoint="$(grep btrfs /proc/self/mountinfo | grep "$partition " | grep "/$subvol " | cut -d ' ' -f 5)"
- if [ -n "$mpoint" ]; then
- if [ "x$mpoint" = "x/" ]; then
- continue # this is the root for the running system
- fi
- mounted=1
- else
- # again, do not mount btrfs ro
- mount -t btrfs -o subvol="$subvol" -U "$UUID" "$tmpmnt"
- mpoint="$tmpmnt"
- fi
- test="/usr/lib/os-probes/mounted/90linux-distro"
- if [ -f "$test" ] && [ -x "$test" ]; then
- debug "running subtest $test"
- if "$test" "$partition" "$mpoint" btrfs "UUID=$UUID" "subvol=$subvol"; then
- debug "os found by subtest $test on subvol $subvol"
- found=1
- fi
+ # Always probe subvol or root set as default
+ if probe_subvol "$defaultvol" "$partition" "$UUID" "$tmpmnt"; then
+ found=1
+ fi
+
+ # Probe any other OS on subvol
+ for subvol in $subvols; do
+ if echo "$rosubvols" | grep -q -x "$subvol" ||
+ echo "$sssubvols" | grep -q -x "$subvol" ||
+ echo "$defaultvol" | grep -q -x "$subvol"; then
+ continue
fi
- if [ -z "$mounted" ]; then
- if ! umount "$tmpmnt"; then
- warn "failed to umount $tmpmnt"
- fi
+ debug "begin btrfs processing for $UUID subvol=$subvol"
+ if probe_subvol "$subvol" "$partition" "$UUID" "$tmpmnt"; then
+ found=1
fi
done
if [ "$found" ]; then
++++++ os-prober-btrfs-snapshot-detection.patch ++++++
Index: os-prober/os-probes/common/50mounted-tests
===================================================================
--- os-prober.orig/os-probes/common/50mounted-tests
+++ os-prober/os-probes/common/50mounted-tests
@@ -115,6 +115,7 @@ if [ "$types" = btrfs ]; then
subvols=$(btrfs subvolume list -a "$tmpmnt" | cut -d ' ' -f 9 | sed -e s!^\/!!)
rosubvols=$(btrfs subvolume list -r -a "$tmpmnt" | cut -d ' ' -f 9 | sed -e s!^\/!!)
sssubvols=$(btrfs subvolume list -s -a "$tmpmnt" | cut -d ' ' -f 14 | sed -e s!^\/!!)
+ defaultvol=$(btrfs subvolume get-default "$tmpmnt" | cut -d ' ' -f 9)
if ! umount "$tmpmnt"; then
warn "failed to umount btrfs volume on $tmpmnt"
rmdir "$tmpmnt" || true
@@ -127,11 +128,13 @@ if [ "$types" = btrfs ]; then
found=
for subvol in $subvols; do
debug "begin btrfs processing for $UUID subvol=$subvol"
- if echo "$rosubvols" | grep -q -x "$subvol"; then
- continue
- fi
- if echo "$sssubvols" | grep -q -x "$subvol"; then
- continue
+ if [ "$subvol" != "$defaultvol" ]; then
+ if echo "$rosubvols" | grep -q -x "$subvol"; then
+ continue
+ fi
+ if echo "$sssubvols" | grep -q -x "$subvol"; then
+ continue
+ fi
fi
mounted=
mpoint="$(grep btrfs /proc/self/mountinfo | grep "$partition " | grep "/$subvol " | cut -d ' ' -f 5)"
++++++ os-prober-btrfsfix.patch ++++++
Index: os-prober-1.57/common.sh
===================================================================
--- os-prober-1.57.orig/common.sh
+++ os-prober-1.57/common.sh
@@ -125,6 +125,7 @@ parse_proc_mounts () {
done
}
+# add forth parameter to pickup btrfs subvol info
parsefstab () {
while read -r line; do
case "$line" in
@@ -135,12 +136,22 @@ parsefstab () {
set -f
set -- $line
set +f
- printf '%s %s %s\n' "$1" "$2" "$3"
+ printf '%s %s %s %s\n' "$1" "$2" "$3" "$4"
;;
esac
done
}
+#check_btrfs_mounted $bootsv $bootuuid)
+check_btrfs_mounted () {
+ bootsv="$1"
+ bootuuid="$2"
+ bootdev=$(blkid | grep "$bootuuid" | cut -d ':' -f 1)
+ bindfrom=$(grep " btrfs " /proc/self/mountinfo |
+ grep " $bootdev " | grep " /$bootsv " | cut -d ' ' -f 5)
+ printf "%s" "$bindfrom"
+}
+
unescape_mount () {
printf %s "$1" | \
sed 's/\\011/ /g; s/\\012/\n/g; s/\\040/ /g; s/\\134/\\/g'
Index: os-prober-1.57/linux-boot-prober
===================================================================
--- os-prober-1.57.orig/linux-boot-prober
+++ os-prober-1.57/linux-boot-prober
@@ -5,16 +5,143 @@ set -e
newns "$@"
require_tmpdir
+ERR="n"
+
+tmpmnt=/var/lib/os-prober/mount
+if [ ! -d "$tmpmnt" ]; then
+ mkdir "$tmpmnt"
+fi
+
+mounted=
+bootmnt=
+bootsv=
+bootuuid=
grep "^/dev/" /proc/mounts | parse_proc_mounts >"$OS_PROBER_TMP/mounted-map" || true
-partition="$1"
+if [ -z "$1" ]; then
+ ERR=y
+elif [ "$1" = btrfs -a -z "$2" ]; then
+ ERR=y
+elif [ "$1" = btrfs -a -z "$3" ]; then
+ ERR=y
+elif [ "$1" = btrfs ]; then
+ type=btrfs
+ echo "$2" | grep -q "^UUID=" || ERR=y
+ echo "$3" | grep -q "^subvol=" || ERR=y
+ export "$2"
+ export "$3"
+ partition=$(blkid | grep "$UUID" | cut -d ':' -f 1 | tr '\n' ' ' | cut -d ' ' -f 1)
+ debug "btrfs: partition=$partition, UUID=$UUID, subvol=$subvol"
+else
+ partition="$1"
+ type=other
+fi
-if [ -z "$partition" ]; then
+if [ "x$ERR" != xn ]; then
echo "usage: linux-boot-prober partition" >&2
+ echo " linux-boot-prober partition | btrfs UUID=<> subvol=<>" >&2
exit 1
fi
+if [ "$type" = btrfs ]; then
+ # handle all of the btrfs stuff here
+ if [ ! -e "/proc/self/mountinfo" ]; then
+ warn "/proc/self/mountinfo does not exist, exiting"
+ umount "$tmpmnt" 2>/dev/null
+ rmdir "$tmpmnt" 2>/dev/null
+ exit 1
+ fi
+ mpoint=$(grep "btrfs" /proc/self/mountinfo | grep " /$subvol " | grep " $partition " | cut -d ' ' -f 5)
+ if [ "$mpoint" = "/" ]; then
+ warn "specifying active root not valid, exiting"
+ umount "$tmpmnt" 2>/dev/null
+ rmdir "$tmpmnt" 2>/dev/null
+ exit 1
+ fi
+ if [ "$mpoint" = "$tmpmnt" ]; then
+ warn "btrfs subvol=$subvool, UUID=$UUID, already mounted on $tmpmnt **ERROR**"
+ umount "$tmpmnt" 2>/dev/null
+ rmdir "$tmpmnt" 2>/dev/null
+ exit 1
+ fi
+ if [ -z "$mpoint" ]; then
+ # mount the btrfs root
+ if ! mount -o subvol=$subvol -t btrfs -U $UUID "$tmpmnt" 2>/dev/null; then
+ warn "error mounting btrfs subvol=$subvol UUID=$UUID"
+ umount "$tmpmnt/boot" 2>/dev/null
+ umount "$tmpmnt" 2>/dev/null
+ rmdir "$tmpmnt" 2>/dev/null
+ exit 1
+ fi
+ else
+ # bind-mount
+ if ! mount -o bind "$mpoint" "$tmpmnt" 2>/dev/null; then
+ warn "error mounting btrfs bindfrom=$mpoint subvol=$subvol UUID=$UUID"
+ umount "$tmpmnt/boot" 2>/dev/null
+ umount "$tmpmnt" 2>/dev/null
+ rmdir "$tmpmnt" 2>/dev/null
+ exit 1
+ fi
+ fi
+ debug "mounted btrfs $partition, subvol=$subvol on $tmpmnt"
+ if [ ! -e "$tmpmnt/etc/fstab" ]; then
+ warn "btrfs subvol=$subvol not root"
+ umount "$tmpmnt" 2>/dev/null
+ rmdir "$tmpmnt" 2>/dev/null
+ exit 1
+ fi
+ bootmnt=$(parsefstab < "$tmpmnt/etc/fstab" | grep " /boot ") || true
+ if [ -z "$bootmnt" ]; then
+ # /boot is part of the root
+ bootpart="$partition"
+ bootsv="$subvol"
+ elif echo "$bootmnt" | cut -d ' ' -f 3 | grep -q "btrfs"; then
+ # separate btrfs /boot subvolume
+ bootsv=$(echo "$bootmnt" | cut -d ' ' -f 4 | grep "^subvol=" | sed "s/subvol=//" )
+ bootuuid=$(echo "$bootmnt" | cut -d ' ' -f 1 | grep "^UUID=" | sed "s/UUID=//" )
+ debug "mounting btrfs $tmpmnt/boot UUID=$bootuuid subvol=$bootsv"
+ bindfrom=$(check_btrfs_mounted $bootsv $bootuuid)
+ if [ -n "$bindfrom" ]; then
+ # already mounted some place
+ if ! mount -o bind $bindfrom "$tmpmnt/boot" 2>/dev/null; then
+ warn "error bind mounting btrfs boot subvol=$bootsv, from=$bindfrom"
+ umount "$tmpmnt/boot" 2>/dev/null
+ umount "$tmpmnt" 2>/dev/null
+ rmdir "$tmpmnt" 2>/dev/null
+ exit 1
+ fi
+ elif ! mount -o subvol=$bootsv -t btrfs -U $bootuuid "$tmpmnt/boot" 2>/dev/null; then
+ warn "error mounting btrfs boot partition subvol=$bootsv, UUID=$bootuuid"
+ umount "$tmpmnt/boot" 2>/dev/null
+ umount "$tmpmnt" 2>/dev/null
+ rmdir "$tmpmnt" 2>/dev/null
+ exit 1
+ fi
+ bootpart=$(grep " btrfs " /proc/self/mountinfo | grep " /$bootsv " | cut -d ' ' -f 10)
+ else
+ # non-btrfs partition or logical volume
+ linux_mount_boot $partition $tmpmnt
+ bootpart="${mountboot%% *}"
+ bootsv=
+ fi
+
+ test="/usr/lib/linux-boot-probes/mounted/40grub2"
+ if [ -f $test ] && [ -x $test ]; then
+ debug "running $test $partition $bootpart $tmpmnt $type $subvol $bootsv"
+ if $test "$partition" "$bootpart" "$tmpmnt" "$type" "$subvol" "$bootsv"; then
+ debug "$test succeeded"
+ fi
+ fi
+ umount "$tmpmnt/boot" 2>/dev/null || true
+ if ! umount "$tmpmnt" 2>/dev/null; then
+ warn "problem umount $tmpmnt"
+ fi
+ rmdir "$tmpmnt" 2>/dev/null || true
+
+ exit 0
+fi
+
if ! mapped="$(mapdevfs "$partition")"; then
log "Device '$partition' does not exist; skipping"
continue
Index: os-prober-1.57/linux-boot-probes/mounted/common/40grub2
===================================================================
--- os-prober-1.57.orig/linux-boot-probes/mounted/common/40grub2
+++ os-prober-1.57/linux-boot-probes/mounted/common/40grub2
@@ -2,17 +2,27 @@
. /usr/share/os-prober/common.sh
set -e
+# add support for btrfs with no separate /boot
+# that is, rootsv = bootsv
partition="$1"
bootpart="$2"
mpoint="$3"
type="$4"
+rootsv="$5"
+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-)
+ else
+ kernelfile=$kernel
+ fi
if [ "$ignore_item" = 0 ] && \
[ -n "$kernel" ] && \
- [ -e "$mpoint/$kernel" ]; then
+ [ -e "$mpoint/$kernelfile" ]; then
result "$rootpart:$bootpart:$title:$kernel:$initrd:$parameters"
found_item=1
fi
Index: os-prober-1.57/os-prober
===================================================================
--- os-prober-1.57.orig/os-prober
+++ os-prober-1.57/os-prober
@@ -67,6 +67,9 @@ partitions () {
echo "$(LVM_SUPPRESS_FD_WARNINGS=1 log_output lvs --noheadings --separator : -o vg_name,lv_name |
sed "s|-|--|g;s|^[[:space:]]*\(.*\):\(.*\)$|/dev/mapper/\1-\2|")"
fi
+
+ # now lets make sure we got all of the btrfs partitions and disks
+ blkid | grep btrfs | cut -d ':' -f 1
}
parse_proc_swaps () {
@@ -125,6 +128,8 @@ if [ -f /proc/mdstat ] ; then
grep "^md" /proc/mdstat | parse_proc_mdstat >"$OS_PROBER_TMP/raided-map" || true
fi
+: >"$OS_PROBER_TMP/btrfs-vols"
+
for partition in $(partitions); do
if ! mapped="$(mapdevfs "$partition")"; then
log "Device '$partition' does not exist; skipping"
@@ -143,7 +148,26 @@ for partition in $(partitions); do
continue
fi
- if ! grep -q "^$mapped " "$OS_PROBER_TMP/mounted-map" ; then
+ # do btrfs processing here; both mounted and unmounted will
+ # 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
+ uuid=$(blkid -o value -s UUID $mapped)
+ if grep -q "^$uuid" "$OS_PROBER_TMP/btrfs-vols" ; then
+ continue
+ fi
+ debug "btrfs volume uuid=$uuid partition=$partition"
+ echo "$uuid" >>"$OS_PROBER_TMP/btrfs-vols"
+ test="/usr/lib/os-probes/50mounted-tests"
+ if [ -f "$test" ] && [ -x "$test" ]; then
+ debug "running $test on btrfs $partition"
+ if "$test" btrfs "$uuid" "$partition"; then
+ debug "os detected by $test"
+ continue
+ fi
+ fi
+
+ elif ! grep -q "^$mapped " "$OS_PROBER_TMP/mounted-map" ; then
for test in /usr/lib/os-probes/*; do
if [ -f "$test" ] && [ -x "$test" ]; then
debug "running $test on $partition"
Index: os-prober-1.57/os-probes/common/50mounted-tests
===================================================================
--- os-prober-1.57.orig/os-probes/common/50mounted-tests
+++ os-prober-1.57/os-probes/common/50mounted-tests
@@ -5,7 +5,19 @@ partition="$1"
. /usr/share/os-prober/common.sh
-types="$(fs_type "$partition")" || types=NOT-DETECTED
+if [ "x$1" = xbtrfs ]; then
+ types=btrfs
+ if [ -z "$2" -o -z "$3" ]; then
+ debug "missing btrfs parameters, exiting"
+ exit 1
+ fi
+ UUID="$2"
+ BTRFSDEV="$3"
+else
+ partition="$1"
+ types="$(fs_type "$partition")" || types=NOT-DETECTED
+fi
+
if [ "$types" = NOT-DETECTED ]; then
debug "$1 type not recognised; skipping"
exit 0
@@ -49,6 +61,76 @@ if [ ! -d "$tmpmnt" ]; then
fi
mounted=
+
+# all btrfs processing here. Handle both unmounted and
+# mounted subvolumes.
+if [ "$types" = btrfs ]; then
+ partition="$BTRFSDEV"
+ debug "begin btrfs processing for $UUID"
+ # note that the btrfs volume must not be mounted ro
+ if mount -t btrfs -U "$UUID" "$tmpmnt" 2>/dev/null; then
+ debug "btrfs volume $UUID mounted"
+ else
+ warn "cannot mount btrfs volume $UUID, exiting"
+ rmdir "$tmpmnt" || true
+ exit 1
+ fi
+ # besides regular subvols, get ro and snapshot so thet can be excluded
+ subvols=$(btrfs subvolume list "$tmpmnt" | cut -d ' ' -f 9)
+ rosubvols=$(btrfs subvolume list -r "$tmpmnt" | cut -d ' ' -f 9)
+ sssubvols=$(btrfs subvolume list -s "$tmpmnt" | cut -d ' ' -f 14)
+ if ! umount "$tmpmnt"; then
+ warn "failed to umount btrfs volume on $tmpmnt"
+ rmdir "$tmpmnt" || true
+ exit 1
+ fi
+ if [ -z "$subvols" ]; then
+ debug "no subvols found on btrfs volume $UUID"
+ exit 1
+ fi
+ found=
+ for subvol in $subvols; do
+ debug "begin btrfs processing for $UUID subvol=$subvol"
+ if echo "$rosubvols" | grep -q -x "$subvol"; then
+ continue
+ fi
+ if echo "$sssubvols" | grep -q -x "$subvol"; then
+ continue
+ fi
+ mounted=
+ mpoint="$(grep btrfs /proc/self/mountinfo | grep "$partition " | grep "/$subvol " | cut -d ' ' -f 5)"
+ if [ -n "$mpoint" ]; then
+ if [ "x$mpoint" = "x/" ]; then
+ continue # this is the root for the running system
+ fi
+ mounted=1
+ else
+ # again, do not mount btrfs ro
+ mount -t btrfs -o subvol="$subvol" -U "$UUID" "$tmpmnt"
+ mpoint="$tmpmnt"
+ fi
+ test="/usr/lib/os-probes/mounted/90linux-distro"
+ if [ -f "$test" ] && [ -x "$test" ]; then
+ debug "running subtest $test"
+ if "$test" "$partition" "$mpoint" btrfs "UUID=$UUID" "subvol=$subvol"; then
+ debug "os found by subtest $test on subvol $subvol"
+ found=1
+ fi
+ fi
+ if [ -z "$mounted" ]; then
+ if ! umount "$tmpmnt"; then
+ warn "failed to umount $tmpmnt"
+ fi
+ fi
+ done
+ rmdir "$tmpmnt" || true
+ if [ "$found" ]; then
+ exit 0
+ else
+ exit 1
+ fi
+fi
+
if type grub2-mount >/dev/null 2>&1 && \
type grub2-probe >/dev/null 2>&1 && \
grub2-mount "$partition" "$tmpmnt" 2>/dev/null; then
Index: os-prober-1.57/os-probes/mounted/common/90linux-distro
===================================================================
--- os-prober-1.57.orig/os-probes/mounted/common/90linux-distro
+++ os-prober-1.57/os-probes/mounted/common/90linux-distro
@@ -7,6 +7,8 @@ set -e
partition="$1"
dir="$2"
type="$3"
+uuid="$4"
+subvol="$5"
# This test is inaccurate, but given separate / and /boot partitions and the
# fact that only some architectures have ld-linux.so, I can't see anything
@@ -131,7 +133,11 @@ if (ls "$dir"/lib*/ld*.so* || ls "$dir"/
fi
label="$(count_next_label "$short")"
- result "$partition:$long:$label:linux"
+ if [ "x$type" = "xbtrfs" -a "x$uuid" != "x" -a "x$subvol" != "x" ]; then
+ result "$partition:$long:$label:linux:$type:$uuid:$subvol"
+ else
+ result "$partition:$long:$label:linux"
+ fi
exit 0
else
exit 1
Index: os-prober-1.57/README.btrfs
===================================================================
--- /dev/null
+++ os-prober-1.57/README.btrfs
@@ -0,0 +1,15 @@
+BTRFS is a new filesystem which combines the filesystem with logical volume
+management (subvolumes). For further information, see:
+ https://btrfs.wiki.kernel.org/index.php/Main_Page
+ https://btrfs.wiki.kernel.org/index.php/FAQ
+
+In order to support BTRFS, a number of changes were necessary to os-prober,
+os-probes/common/50mounted-tests, os-probes/mounted/common/90linux-distro,
+linux-boot-prober, and linux-boot-probes/common/50mounted-tests.
+
+The biggest impact will be to grub2 where there is additional information
+output by os-prober and where, if a BTRFS subvolume is being used for root,
+the parameters for linux-boot-prober have changed.
+
+Sun 30 Dec 2012 11:49:52 AM EST Gene Czarcinski
+
++++++ os-prober-call-dmraid-once.patch ++++++
From: Jeff Mahoney
Subject: os-prober: call dmraid -r *once*
References: bnc#883453
os-prober calls dmraid -r -c unqualifed for every partition and then greps
the result. dmraid -r -c without a device list will scan every device
on the system. Every time. The results will not differ between runs.
This patch saves the results and performs the grep afterward.
Signed-off-by: Jeff Mahoney
---
os-prober | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
--- a/os-prober
+++ b/os-prober
@@ -14,11 +14,17 @@ log_output () {
fi
}
+: >"$OS_PROBER_TMP/dmraid-map"
+DMRAID=$(type dmraid >/dev/null 2>&1 || true)
+if [ -n "$DMRAID" ]; then
+ dmraid -r -c >"$OS_PROBER_TMP/dmraid-map"
+fi
+
on_sataraid () {
type dmraid >/dev/null 2>&1 || return 1
local parent="${1%/*}"
local device="/dev/${parent##*/}"
- if dmraid -r -c | grep -q "$device"; then
+ if grep -q "$device" "$OS_PROBER_TMP/dmraid-map"; then
return 0
fi
return 1
++++++ os-prober-dont-load-all-fs-module-and-dont-test-mount.patch ++++++
Index: os-prober-1.61/os-probes/common/50mounted-tests
===================================================================
--- os-prober-1.61.orig/os-probes/common/50mounted-tests
+++ os-prober-1.61/os-probes/common/50mounted-tests
@@ -40,19 +40,13 @@ elif [ -z "$types" ]; then
debug "$1 is a LUKS partition; skipping"
exit 0
fi
- for type in $(grep -v nodev /proc/filesystems); do
- # hfsplus filesystems are mountable as hfs. Try hfs last so
- # that we can tell the difference.
- if [ "$type" = hfs ]; then
- delaytypes="${delaytypes:+$delaytypes }$type"
- elif [ "$type" = fuseblk ]; then
- if type ntfs-3g >/dev/null 2>&1; then
- types="${types:+$types }ntfs-3g"
- fi
- else
- types="${types:+$types }$type"
- fi
- done
+
+ # Simply skip such partition is better than trying to detect
+ # it by blinded test mounts with all kinds of kernel file system,
+ # that would lead to unwanted consequence like kernel oops and
+ # risk to corrupt your system and data.
+ debug "$1 is a partition without file system; skipping"
+ exit 0
fi
tmpmnt=/var/lib/os-prober/mount
@@ -144,7 +138,7 @@ if type grub2-mount >/dev/null 2>&1 && \
fi
else
ro_partition "$partition"
- for type in $types $delaytypes; do
+ for type in $types; do
if mount -o ro -t "$type" "$partition" "$tmpmnt" 2>/dev/null; then
debug "mounted as $type filesystem"
mounted=1
Index: os-prober-1.61/os-probes/init/common/10filesystems
===================================================================
--- os-prober-1.61.orig/os-probes/init/common/10filesystems
+++ os-prober-1.61/os-probes/init/common/10filesystems
@@ -1,39 +1,21 @@
#!/bin/sh
# Make sure filesystems are available.
-set +e # ignore errors from modprobe
+set -e
-FILESYSTEMS='ext2 ext3 ext4 reiserfs xfs jfs msdos vfat ntfs minix hfs hfsplus qnx4 ufs btrfs'
-# fuse is needed to make grub2-mount work.
-FILESYSTEMS="$FILESYSTEMS fuse"
-# The Ubuntu kernel udebs put a number of filesystem modules in
-# fs-{core,secondary}-modules. It's fairly cheap to check for these too.
-FILESYSTEMS="$FILESYSTEMS fs-core fs-secondary"
-
-if [ ! -e /var/lib/os-prober/modules ]; then
- # Check for anna-install to make it easier to use os-prober outside
- # d-i.
- if type anna-install >/dev/null 2>&1 && [ -d /lib/debian-installer ]; then
- for fs in $FILESYSTEMS; do
- ANNA_QUIET=1 DEBIAN_FRONTEND=none \
- log-output -t os-prober \
- anna-install "$fs-modules" || true
- done
- depmod -a >/dev/null 2>&1 || true
- fi
+# Make sure fuse is available for grub2-mount
+# As long as we use grub2-mount, we use grub2's own file system modules
+# to mount the partitiion and the operation don't require kernel support
+# other than fuse.
+if ! cat /proc/filesystems | grep nodev | cut -f2 | grep -qw fuse; then
+ modprobe fuse 2>&1 | logger -t os-prober
+fi
- for fs in $FILESYSTEMS; do
- case "$fs" in
- fs-*)
- ;;
- *)
- modprobe "$fs" 2>/dev/null | logger -t os-prober
- ;;
- esac
- done
+# Regarding file systems not supported by grub2, or systems simply don't
+# have grub2-mount, will use linux 'mount' utility. This will require
+# kernel file system module to work, but still we don't need to modprobe
+# all of them before mount, because mount() syscall will take care of it
+# by __request_module the needed kernel module and we should leave it do
+# that for us in order to have only needed modules get loaded.
+#
+# Still if you want any kernel module loaded, add them here.
- # We only want to keep this state inside d-i, so this is as good a
- # check as any.
- if type anna-install >/dev/null 2>&1 && [ -d /lib/debian-installer ]; then
- touch /var/lib/os-prober/modules
- fi
-fi
++++++ os-prober-fix-btrfs-subvol-mounted-tests.patch ++++++
Index: os-prober-1.61/os-probes/common/50mounted-tests
===================================================================
--- os-prober-1.61.orig/os-probes/common/50mounted-tests
+++ os-prober-1.61/os-probes/common/50mounted-tests
@@ -56,10 +56,54 @@ fi
mounted=
-# all btrfs processing here. Handle both unmounted and
-# mounted subvolumes.
if [ "$types" = btrfs ]; then
partition="$BTRFSDEV"
+fi
+
+if type grub2-mount >/dev/null 2>&1 && \
+ type grub2-probe >/dev/null 2>&1 && \
+ grub2-mount "$partition" "$tmpmnt" 2>/dev/null; then
+ mounted=1
+ type="$(grub2-probe -d "$partition" -t fs)" || true
+ if [ "$type" ]; then
+ debug "mounted using GRUB $type filesystem driver"
+ else
+ debug "mounted using GRUB, but unknown filesystem?"
+ type=fuseblk
+ fi
+else
+ ro_partition "$partition"
+ for type in $types; do
+ if mount -o ro -t "$type" "$partition" "$tmpmnt" 2>/dev/null; then
+ debug "mounted as $type filesystem"
+ mounted=1
+ break
+ fi
+ done
+fi
+
+if [ "$mounted" ]; then
+ for test in /usr/lib/os-probes/mounted/*; do
+ debug "running subtest $test"
+ if [ -f "$test" ] && [ -x "$test" ]; then
+ if "$test" "$partition" "$tmpmnt" "$type"; then
+ debug "os found by subtest $test"
+ if ! umount "$tmpmnt"; then
+ warn "failed to umount $tmpmnt"
+ fi
+ rmdir "$tmpmnt" || true
+ exit 0
+ fi
+ fi
+ done
+ if ! umount "$tmpmnt"; then
+ warn "failed to umount $tmpmnt"
+ fi
+fi
+
+# all btrfs subvol processing here. Handle both unmounted and
+# mounted subvolumes.
+if [ "$types" = btrfs ]; then
debug "begin btrfs processing for $UUID"
# note that the btrfs volume must not be mounted ro
if mount -t btrfs -U "$UUID" "$tmpmnt" 2>/dev/null; then
@@ -117,52 +161,9 @@ if [ "$types" = btrfs ]; then
fi
fi
done
- rmdir "$tmpmnt" || true
if [ "$found" ]; then
+ rmdir "$tmpmnt" || true
exit 0
- else
- exit 1
- fi
-fi
-
-if type grub2-mount >/dev/null 2>&1 && \
- type grub2-probe >/dev/null 2>&1 && \
- grub2-mount "$partition" "$tmpmnt" 2>/dev/null; then
- mounted=1
- type="$(grub2-probe -d "$partition" -t fs)" || true
- if [ "$type" ]; then
- debug "mounted using GRUB $type filesystem driver"
- else
- debug "mounted using GRUB, but unknown filesystem?"
- type=fuseblk
- fi
-else
- ro_partition "$partition"
- for type in $types; do
- if mount -o ro -t "$type" "$partition" "$tmpmnt" 2>/dev/null; then
- debug "mounted as $type filesystem"
- mounted=1
- break
- fi
- done
-fi
-
-if [ "$mounted" ]; then
- for test in /usr/lib/os-probes/mounted/*; do
- debug "running subtest $test"
- if [ -f "$test" ] && [ -x "$test" ]; then
- if "$test" "$partition" "$tmpmnt" "$type"; then
- debug "os found by subtest $test"
- if ! umount "$tmpmnt"; then
- warn "failed to umount $tmpmnt"
- fi
- rmdir "$tmpmnt" || true
- exit 0
- fi
- fi
- done
- if ! umount "$tmpmnt"; then
- warn "failed to umount $tmpmnt"
fi
fi
++++++ os-prober-linux-distro-avoid-expensive-ld-file-test.patch ++++++
Index: os-prober-1.61/os-probes/mounted/common/90linux-distro
===================================================================
--- os-prober-1.61.orig/os-probes/mounted/common/90linux-distro
+++ os-prober-1.61/os-probes/mounted/common/90linux-distro
@@ -10,6 +10,113 @@ type="$3"
uuid="$4"
subvol="$5"
+if [ -e "$dir/etc/debian_version" ]; then
+ short="Debian"
+ long="$(printf "Debian GNU/Linux (%s)\n" "$(cat "$dir/etc/debian_version")")"
+# RPM derived distributions may also have a redhat-release or
+# mandrake-release, so check their files first.
+elif [ -e "$dir/etc/altlinux-release" ]; then
+ short="ALTLinux"
+ long="$(cat "$dir/etc/altlinux-release")"
+elif [ -e "$dir/etc/magic-release" ]; then
+ short="Magic"
+ long="$(cat "$dir/etc/magic-release")"
+elif [ -e "$dir/etc/blackPanther-release" ]; then
+ short="blackPanther"
+ long="$(cat "$dir/etc/blackPanther-release")"
+elif [ -e "$dir/etc/ark-release" ]; then
+ short="Ark"
+ long="$(cat "$dir/etc/ark-release")"
+elif [ -e "$dir/etc/arch-release" ]; then
+ short="Arch"
+ long="$(cat "$dir/etc/arch-release")"
+elif [ -e "$dir/etc/asplinux-release" ]; then
+ short="ASPLinux"
+ long="$(cat "$dir/etc/asplinux-release")"
+elif [ -e "$dir/etc/lvr-release" ]; then
+ short="LvR"
+ long="$(cat "$dir/etc/lvr-release")"
+elif [ -e "$dir/etc/caos-release" ]; then
+ short="cAos"
+ long="$(cat "$dir/etc/caos-release")"
+elif [ -e "$dir/etc/aurox-release" ]; then
+ short="Aurox"
+ long="$(cat "$dir/etc/aurox-release")"
+elif [ -e "$dir/etc/engarde-release" ]; then
+ short="EnGarde"
+ long="$(cat "$dir/etc/engarde-release")"
+elif [ -e "$dir/etc/vine-release" ]; then
+ short="Vine"
+ long="$(cat "$dir/etc/vine-release")"
+elif [ -e "$dir/etc/whitebox-release" ]; then
+ short="WhiteBox"
+ long="$(cat "$dir/etc/whitebox-release")"
+elif [ -e "$dir/etc/pld-release" ]; then
+ short="PLD"
+ long="$(cat "$dir/etc/pld-release")"
+elif [ -e "$dir/etc/startcom-release" ]; then
+ short="StartCom"
+ long="$(cat "$dir/etc/startcom-release")"
+elif [ -e "$dir/etc/trustix-release" ]; then
+ short="Trustix"
+ long="$(cat "$dir/etc/trustix-release")"
+elif [ -e "$dir/etc/openna-release" ]; then
+ short="OpenNA"
+ long="$(cat "$dir/etc/openna-release")"
+elif [ -e "$dir/etc/conectiva-release" ]; then
+ short="Conectiva"
+ long="$(cat "$dir/etc/conectiva-release")"
+elif [ -e "$dir/etc/mandrake-release" ]; then
+ short="Mandrake"
+ long="$(cat "$dir/etc/mandrake-release")"
+elif [ -e "$dir/etc/fedora-release" ]; then
+ short="Fedora"
+ long="$(cat "$dir/etc/fedora-release")"
+elif [ -e "$dir/etc/redhat-release" ]; then
+ short="RedHat"
+ long="$(cat "$dir/etc/redhat-release")"
+elif [ -e "$dir/etc/SuSE-release" ]; then
+ short="SUSE"
+ long="$(head -n 1 "$dir/etc/SuSE-release")"
+elif [ -e "$dir/etc/gentoo-release" ]; then
+ short="Gentoo"
+ long="$(cat "$dir/etc/gentoo-release")"
+elif [ -e "$dir/etc/cobalt-release" ]; then
+ short="Cobalt"
+ long="$(cat "$dir/etc/cobalt-release")"
+elif [ -e "$dir/etc/yellowdog-release" ]; then
+ short="YellowDog"
+ long="$(cat "$dir/etc/yellowdog-release")"
+elif [ -e "$dir/etc/turbolinux-release" ]; then
+ short="Turbolinux"
+ long="$(cat "$dir/etc/turbolinux-release")"
+elif [ -e "$dir/etc/pardus-release" ]; then
+ short="Pardus"
+ long="$(cat "$dir/etc/pardus-release")"
+elif [ -e "$dir/etc/kanotix-version" ]; then
+ short="Kanotix"
+ long="$(cat "$dir/etc/kanotix-version")"
+elif [ -e "$dir/etc/slackware-version" ]; then
+ short="Slackware"
+ long="$(printf "Slackware Linux (%s)\n" "$(cat "$dir/etc/slackware-version")")"
+elif [ -e "$dir/sbin/pkgtool" ]; then
+ short="Slackware"
+ long="Slackware Linux"
+elif grep -qs OpenLinux "$dir/etc/issue"; then
+ short="Caldera"
+ long="Caldera OpenLinux"
+elif [ -e "$dir/etc/frugalware-release" ]; then
+ short="Frugalware Linux"
+ long="$(cat "$dir/etc/frugalware-release")"
+elif [ -e "$dir/etc/kdemar-release" ]; then
+ short="K-DEMar"
+ long="$(printf "K-DEMar GNU/Linux (%s)\n" "$(cat "$dir/etc/kdemar-release")")"
+elif [ -e "$dir/etc/lfs-release" ]; then
+ short="LFS"
+ long="$(printf "Linux From Scratch (%s)\n" "$(cat "$dir/etc/lfs-release")")"
+elif [ -e "$dir/etc/meego-release" ]; then
+ short="MeeGo"
+ long="$(head -1 "$dir/etc/meego-release")"
# This test is inaccurate, but given separate / and /boot partitions and the
# fact that only some architectures have ld-linux.so, I can't see anything
# better. Make sure this test has a high number so that more accurate tests
@@ -19,126 +126,17 @@ subvol="$5"
# symlinks we need to also check in $dir/usr/lib* for distributions that
# moved /lib* to /usr and only left symlinks behind.
# TODO: look for ld-linux.so on arches that have it
-if (ls "$dir"/lib*/ld*.so* || ls "$dir"/usr/lib*/ld*.so*) >/dev/null 2>/dev/null; then
- if [ -e "$dir/etc/debian_version" ]; then
- short="Debian"
- long="$(printf "Debian GNU/Linux (%s)\n" "$(cat "$dir/etc/debian_version")")"
- # RPM derived distributions may also have a redhat-release or
- # mandrake-release, so check their files first.
- elif [ -e "$dir/etc/altlinux-release" ]; then
- short="ALTLinux"
- long="$(cat "$dir/etc/altlinux-release")"
- elif [ -e "$dir/etc/magic-release" ]; then
- short="Magic"
- long="$(cat "$dir/etc/magic-release")"
- elif [ -e "$dir/etc/blackPanther-release" ]; then
- short="blackPanther"
- long="$(cat "$dir/etc/blackPanther-release")"
- elif [ -e "$dir/etc/ark-release" ]; then
- short="Ark"
- long="$(cat "$dir/etc/ark-release")"
- elif [ -e "$dir/etc/arch-release" ]; then
- short="Arch"
- long="$(cat "$dir/etc/arch-release")"
- elif [ -e "$dir/etc/asplinux-release" ]; then
- short="ASPLinux"
- long="$(cat "$dir/etc/asplinux-release")"
- elif [ -e "$dir/etc/lvr-release" ]; then
- short="LvR"
- long="$(cat "$dir/etc/lvr-release")"
- elif [ -e "$dir/etc/caos-release" ]; then
- short="cAos"
- long="$(cat "$dir/etc/caos-release")"
- elif [ -e "$dir/etc/aurox-release" ]; then
- short="Aurox"
- long="$(cat "$dir/etc/aurox-release")"
- elif [ -e "$dir/etc/engarde-release" ]; then
- short="EnGarde"
- long="$(cat "$dir/etc/engarde-release")"
- elif [ -e "$dir/etc/vine-release" ]; then
- short="Vine"
- long="$(cat "$dir/etc/vine-release")"
- elif [ -e "$dir/etc/whitebox-release" ]; then
- short="WhiteBox"
- long="$(cat "$dir/etc/whitebox-release")"
- elif [ -e "$dir/etc/pld-release" ]; then
- short="PLD"
- long="$(cat "$dir/etc/pld-release")"
- elif [ -e "$dir/etc/startcom-release" ]; then
- short="StartCom"
- long="$(cat "$dir/etc/startcom-release")"
- elif [ -e "$dir/etc/trustix-release" ]; then
- short="Trustix"
- long="$(cat "$dir/etc/trustix-release")"
- elif [ -e "$dir/etc/openna-release" ]; then
- short="OpenNA"
- long="$(cat "$dir/etc/openna-release")"
- elif [ -e "$dir/etc/conectiva-release" ]; then
- short="Conectiva"
- long="$(cat "$dir/etc/conectiva-release")"
- elif [ -e "$dir/etc/mandrake-release" ]; then
- short="Mandrake"
- long="$(cat "$dir/etc/mandrake-release")"
- elif [ -e "$dir/etc/fedora-release" ]; then
- short="Fedora"
- long="$(cat "$dir/etc/fedora-release")"
- elif [ -e "$dir/etc/redhat-release" ]; then
- short="RedHat"
- long="$(cat "$dir/etc/redhat-release")"
- elif [ -e "$dir/etc/SuSE-release" ]; then
- short="SUSE"
- long="$(head -n 1 "$dir/etc/SuSE-release")"
- elif [ -e "$dir/etc/gentoo-release" ]; then
- short="Gentoo"
- long="$(cat "$dir/etc/gentoo-release")"
- elif [ -e "$dir/etc/cobalt-release" ]; then
- short="Cobalt"
- long="$(cat "$dir/etc/cobalt-release")"
- elif [ -e "$dir/etc/yellowdog-release" ]; then
- short="YellowDog"
- long="$(cat "$dir/etc/yellowdog-release")"
- elif [ -e "$dir/etc/turbolinux-release" ]; then
- short="Turbolinux"
- long="$(cat "$dir/etc/turbolinux-release")"
- elif [ -e "$dir/etc/pardus-release" ]; then
- short="Pardus"
- long="$(cat "$dir/etc/pardus-release")"
- elif [ -e "$dir/etc/kanotix-version" ]; then
- short="Kanotix"
- long="$(cat "$dir/etc/kanotix-version")"
- elif [ -e "$dir/etc/slackware-version" ]; then
- short="Slackware"
- long="$(printf "Slackware Linux (%s)\n" "$(cat "$dir/etc/slackware-version")")"
- elif [ -e "$dir/sbin/pkgtool" ]; then
- short="Slackware"
- long="Slackware Linux"
- elif grep -qs OpenLinux "$dir/etc/issue"; then
- short="Caldera"
- long="Caldera OpenLinux"
- elif [ -e "$dir/etc/frugalware-release" ]; then
- short="Frugalware Linux"
- long="$(cat "$dir/etc/frugalware-release")"
- elif [ -e "$dir/etc/kdemar-release" ]; then
- short="K-DEMar"
- long="$(printf "K-DEMar GNU/Linux (%s)\n" "$(cat "$dir/etc/kdemar-release")")"
- elif [ -e "$dir/etc/lfs-release" ]; then
- short="LFS"
- long="$(printf "Linux From Scratch (%s)\n" "$(cat "$dir/etc/lfs-release")")"
- elif [ -e "$dir/etc/meego-release" ]; then
- short="MeeGo"
- long="$(head -1 "$dir/etc/meego-release")"
- else
- short="Linux"
- long="unknown Linux distribution"
- fi
-
- label="$(count_next_label "$short")"
- if [ "x$type" = "xbtrfs" -a "x$uuid" != "x" -a "x$subvol" != "x" ]; then
- result "$partition:$long:$label:linux:$type:$uuid:$subvol"
- else
- result "$partition:$long:$label:linux"
- fi
- exit 0
+elif (ls "$dir"/lib*/ld*.so* || ls "$dir"/usr/lib*/ld*.so*) >/dev/null 2>/dev/null; then
+ short="Linux"
+ long="unknown Linux distribution"
else
exit 1
fi
+
+label="$(count_next_label "$short")"
+if [ "x$type" = "xbtrfs" -a "x$uuid" != "x" -a "x$subvol" != "x" ]; then
+ result "$partition:$long:$label:linux:$type:$uuid:$subvol"
+else
+ result "$partition:$long:$label:linux"
+fi
+exit 0
Index: os-prober-1.61/os-prober
===================================================================
--- os-prober-1.61.orig/os-prober
+++ os-prober-1.61/os-prober
@@ -181,6 +181,11 @@ 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
continue
++++++ os-prober-linux-secure-boot.patch ++++++
From: Andrey Borzenkov
Subject: detect linuxefi/initrdefi secure bootloaders too
Reference: bnc#810912
Recognize initrdefi and linuxefi too. Whether linux/initrd or
linuxefi/initrdefi will be emitted is controlled by SECURE_BOOT
setting in /etc/sysconfig/bootloader.
Index: os-prober-1.61/linux-boot-probes/mounted/common/40grub2
===================================================================
--- os-prober-1.61.orig/linux-boot-probes/mounted/common/40grub2
+++ os-prober-1.61/linux-boot-probes/mounted/common/40grub2
@@ -71,7 +71,7 @@ parse_grub_menu () {
ignore_item=1
fi
;;
- linux)
+ linux|linuxefi)
# Hack alert: sed off any (hdn,n) but
# assume the kernel is on the same
# partition.
@@ -84,7 +84,7 @@ parse_grub_menu () {
kernel="/boot$kernel"
fi
;;
- initrd)
+ initrd|initrdefi)
initrd="$(echo "$2" | sed 's/(.*)//')"
# Initrd same.
if [ "$partition" != "$bootpart" ]; then
++++++ os-prober-newnsdirfix.patch ++++++
diff -up os-prober-1.46/common.sh.newnsmove os-prober-1.46/common.sh
--- os-prober-1.46/common.sh.newnsmove 2011-04-10 05:30:57.000000000 +0430
+++ os-prober-1.46/common.sh 2011-05-04 04:08:09.603020037 +0430
@@ -1,5 +1,5 @@
newns () {
- [ "$OS_PROBER_NEWNS" ] || exec /usr/lib/os-prober/newns "$0" "$@"
+ [ "$OS_PROBER_NEWNS" ] || exec /usr/lib/newns "$0" "$@"
}
cleanup_tmpdir=false
++++++ os-prober-probe-MD-devices.patch ++++++
Index: os-prober-1.61/os-prober
===================================================================
--- os-prober-1.61.orig/os-prober
+++ os-prober-1.61/os-prober
@@ -39,6 +39,11 @@ partitions () {
fi
done
+ # Add Linux MD unpartioned devices. Linux MD partitions are already covered above
+ [ -f /proc/mdstat ] && grep '^md' /proc/mdstat | while read md line; do
+ [ -e "/dev/$md" ] && echo "/dev/$md"
+ done
+
# Add Serial ATA RAID devices
if type dmraid >/dev/null 2>&1 && \
dmraid -s -c >/dev/null 2>&1; then
@@ -79,7 +84,8 @@ parse_proc_mdstat () {
udevadm info "$@"
}
fi
- while read line; do
+ # Only add MD slaves to the list
+ while read md line; do
for word in $line; do
dev="${word%%\[*}"
# TODO: factor this out to something in di-utils if
++++++ os-prober-skip-part-on-multipath.patch ++++++
Index: os-prober-1.61/os-prober
===================================================================
--- os-prober-1.61.orig/os-prober
+++ os-prober-1.61/os-prober
@@ -24,6 +24,29 @@ on_sataraid () {
return 1
}
+mp_disks="UNDEF"
+on_multipath () {
+ type multipath >/dev/null 2>&1 || return 1
+ local parent="${1%/*}"
+ local device="${parent##*/}"
+
+ if [ "$mp_disks" = "UNDEF" ]; then
+ mp_disks=`multipath -d -l | sed -n -e 's/^.\+[0-9]\+:[0-9]\+:[0-9]\+:[0-9]\+ \([^ ]\+\) .*/\1/p'`
+ fi
+
+ if [ -z "$mp_disks" ]; then
+ return 1
+ fi
+
+ for i in $mp_disks; do
+ if [ "$device" = "$i" ]; then
+ debug "$1: part of multipath disk $i"
+ return 0
+ fi
+ done
+ return 1
+}
+
partitions () {
# Exclude partitions that have whole_disk sysfs attribute set.
if [ -d /sys/block ]; then
@@ -31,7 +54,7 @@ partitions () {
# Serial ATA RAID disk.
for part in /sys/block/*/*[0-9]; do
if [ -f "$part/start" ] && \
- [ ! -f "$part/whole_disk" ] && ! on_sataraid $part; then
+ [ ! -f "$part/whole_disk" ] && ! on_sataraid $part && ! on_multipath $part; then
name="$(echo "${part##*/}" | sed 's,[!.],/,g')"
if [ -e "/dev/$name" ]; then
echo "/dev/$name"