Initialize for os-prober
This commit is contained in:
commit
442fc77bf4
28 changed files with 2333 additions and 0 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
os-prober_1.76.tar.xz
|
1
.os-prober.metadata
Normal file
1
.os-prober.metadata
Normal file
|
@ -0,0 +1 @@
|
|||
8153d4851df29f79bdca2bf4be900cde77b4da92fb25a52e33efbb70f74a6e27 os-prober_1.76.tar.xz
|
19
COPYING-note.txt
Normal file
19
COPYING-note.txt
Normal file
|
@ -0,0 +1,19 @@
|
|||
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=249d0814ae9c6e308baaaad4ec4e0a403a592ffd
|
||||
http://anonscm.debian.org/gitweb/?p=d-i/os-prober.git;a=commit;h=25024daeccd86cec17353455b99af677b3b83b16
|
||||
http://anonscm.debian.org/gitweb/?p=d-i/os-prober.git;a=commit;h=cc0ce8e5ec252b10127ca3ebb71c12cd31d4ebc4
|
||||
|
||||
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.
|
94
Improve-btrfs-handling-on-os-probing-for-grub2.patch
Normal file
94
Improve-btrfs-handling-on-os-probing-for-grub2.patch
Normal file
|
@ -0,0 +1,94 @@
|
|||
From: Egbert Eich <eich@suse.de>
|
||||
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 <eich@suse.com>
|
||||
|
||||
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 <eich@suse.de>
|
||||
|
||||
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 <mchang@suse.com>
|
||||
---
|
||||
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
|
||||
;;
|
18
os-prober-05efi-blkid.patch
Normal file
18
os-prober-05efi-blkid.patch
Normal file
|
@ -0,0 +1,18 @@
|
|||
Index: os-prober/os-probes/mounted/x86/05efi
|
||||
===================================================================
|
||||
--- os-prober.orig/os-probes/mounted/x86/05efi
|
||||
+++ os-prober/os-probes/mounted/x86/05efi
|
||||
@@ -46,6 +46,13 @@ if type udevinfo > /dev/null 2>&1; then
|
||||
fi
|
||||
fi
|
||||
|
||||
+ # udev may not work in chroot as its db may not be there, bailout that by blkid (bsc#1076779)
|
||||
+ if [ -z "$ID_PART_ENTRY_TYPE" -a -z "$ID_PART_ENTRY_SCHEME" ] &&
|
||||
+ type blkid > /dev/null 2>&1; then
|
||||
+ debug "fallback to blkid"
|
||||
+ eval "$(blkid -p -o udev "$partition" | grep -E '^(ID_PART_ENTRY_(TYPE|SCHEME))=')"
|
||||
+ fi
|
||||
+
|
||||
debug "$partition partition scheme is $ID_PART_ENTRY_SCHEME"
|
||||
debug "$partition partition type is $ID_PART_ENTRY_TYPE"
|
||||
|
55
os-prober-1.49-fix-grub2.cfg-parsing.patch
Normal file
55
os-prober-1.49-fix-grub2.cfg-parsing.patch
Normal file
|
@ -0,0 +1,55 @@
|
|||
From: Andrey Borzenkov <arvidjaar@gmail.com>
|
||||
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"
|
68
os-prober-1.49-grub2-mount.patch
Normal file
68
os-prober-1.49-grub2-mount.patch
Normal file
|
@ -0,0 +1,68 @@
|
|||
Index: os-prober-1.76/common.sh
|
||||
===================================================================
|
||||
--- os-prober-1.76.orig/common.sh
|
||||
+++ os-prober-1.76/common.sh
|
||||
@@ -279,8 +279,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
|
||||
fi
|
||||
fi
|
||||
Index: os-prober-1.76/linux-boot-probes/common/50mounted-tests
|
||||
===================================================================
|
||||
--- os-prober-1.76.orig/linux-boot-probes/common/50mounted-tests
|
||||
+++ os-prober-1.76/linux-boot-probes/common/50mounted-tests
|
||||
@@ -48,11 +48,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
|
||||
fi
|
||||
|
||||
Index: os-prober-1.76/os-probes/common/50mounted-tests
|
||||
===================================================================
|
||||
--- os-prober-1.76.orig/os-probes/common/50mounted-tests
|
||||
+++ os-prober-1.76/os-probes/common/50mounted-tests
|
||||
@@ -58,11 +58,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
|
||||
Index: os-prober-1.76/os-probes/init/common/10filesystems
|
||||
===================================================================
|
||||
--- os-prober-1.76.orig/os-probes/init/common/10filesystems
|
||||
+++ os-prober-1.76/os-probes/init/common/10filesystems
|
||||
@@ -3,7 +3,7 @@
|
||||
set +e # ignore errors from modprobe
|
||||
|
||||
FILESYSTEMS='ext2 ext3 ext4 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.
|
19
os-prober-40grub-check-grub2.patch
Normal file
19
os-prober-40grub-check-grub2.patch
Normal file
|
@ -0,0 +1,19 @@
|
|||
From: Andrei Borzenkov <arvidjaar@gmail.com>
|
||||
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
|
34
os-prober-EFI-openSUSEfy.patch
Normal file
34
os-prober-EFI-openSUSEfy.patch
Normal file
|
@ -0,0 +1,34 @@
|
|||
From: Andrey Borzenkov <arvidjaar@gmail.com>
|
||||
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/os-probes/mounted/x86/efi/10elilo
|
||||
===================================================================
|
||||
--- os-prober.orig/os-probes/mounted/x86/efi/10elilo
|
||||
+++ os-prober/os-probes/mounted/x86/efi/10elilo
|
||||
@@ -11,7 +11,8 @@ elilo=`find $1 -name "elilo.efi"`
|
||||
if [ -n "$elilo" ]; then
|
||||
bdir="${elilo%/*}"
|
||||
bdir="${elilo##*/}"
|
||||
- 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/os-probes/mounted/x86/05efi
|
||||
===================================================================
|
||||
--- os-prober.orig/os-probes/mounted/x86/05efi
|
||||
+++ os-prober/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
|
||||
|
13
os-prober-SUSE.patch
Normal file
13
os-prober-SUSE.patch
Normal file
|
@ -0,0 +1,13 @@
|
|||
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"
|
33
os-prober-accept-ESP-on-IMSM.patch
Normal file
33
os-prober-accept-ESP-on-IMSM.patch
Normal file
|
@ -0,0 +1,33 @@
|
|||
Index: os-prober-1.76/os-probes/mounted/x86/05efi
|
||||
===================================================================
|
||||
--- os-prober-1.76.orig/os-probes/mounted/x86/05efi
|
||||
+++ os-prober-1.76/os-probes/mounted/x86/05efi
|
||||
@@ -28,13 +28,24 @@ 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"
|
||||
|
41
os-prober-btrfs-absolute-subvol.patch
Normal file
41
os-prober-btrfs-absolute-subvol.patch
Normal file
|
@ -0,0 +1,41 @@
|
|||
Index: os-prober/os-probes/common/50mounted-tests
|
||||
===================================================================
|
||||
--- os-prober.orig/os-probes/common/50mounted-tests
|
||||
+++ os-prober/os-probes/common/50mounted-tests
|
||||
@@ -72,9 +72,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
|
||||
@@ -110,7 +108,11 @@ if [ "$mounted" ]; then
|
||||
fi
|
||||
done
|
||||
fi
|
||||
-do_unmount
|
||||
+
|
||||
+if [ "$types" != "btrfs" ]; then
|
||||
+ do_unmount
|
||||
+ exit 1
|
||||
+fi
|
||||
|
||||
# all btrfs processing here. Handle both unmounted and
|
||||
# mounted subvolumes.
|
||||
@@ -125,9 +127,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!^\<FS_TREE\>/!!)
|
||||
+ rosubvols=$(btrfs subvolume list -r -a "$tmpmnt" | cut -d ' ' -f 9 | sed -e s!^\<FS_TREE\>/!!)
|
||||
+ sssubvols=$(btrfs subvolume list -s -a "$tmpmnt" | cut -d ' ' -f 14 | sed -e s!^\<FS_TREE\>/!!)
|
||||
if ! umount "$tmpmnt"; then
|
||||
warn "failed to umount btrfs volume on $tmpmnt"
|
||||
rmdir "$tmpmnt" || true
|
131
os-prober-btrfs-always-detect-default.patch
Normal file
131
os-prober-btrfs-always-detect-default.patch
Normal file
|
@ -0,0 +1,131 @@
|
|||
Index: os-prober/linux-boot-prober
|
||||
===================================================================
|
||||
--- os-prober.orig/linux-boot-prober
|
||||
+++ os-prober/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/os-probes/common/50mounted-tests
|
||||
===================================================================
|
||||
--- os-prober.orig/os-probes/common/50mounted-tests
|
||||
+++ os-prober/os-probes/common/50mounted-tests
|
||||
@@ -114,6 +114,47 @@ if [ "$types" != "btrfs" ]; then
|
||||
exit 1
|
||||
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 processing here. Handle both unmounted and
|
||||
# mounted subvolumes.
|
||||
if [ "$types" = btrfs ]; then
|
||||
@@ -136,45 +177,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
|
||||
rmdir "$tmpmnt" || true
|
31
os-prober-btrfs-snapshot-detection.patch
Normal file
31
os-prober-btrfs-snapshot-detection.patch
Normal file
|
@ -0,0 +1,31 @@
|
|||
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!^\<FS_TREE\>/!!)
|
||||
rosubvols=$(btrfs subvolume list -r -a "$tmpmnt" | cut -d ' ' -f 9 | sed -e s!^\<FS_TREE\>/!!)
|
||||
sssubvols=$(btrfs subvolume list -s -a "$tmpmnt" | cut -d ' ' -f 14 | sed -e s!^\<FS_TREE\>/!!)
|
||||
+ 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)"
|
418
os-prober-btrfsfix.patch
Normal file
418
os-prober-btrfsfix.patch
Normal file
|
@ -0,0 +1,418 @@
|
|||
Index: os-prober/common.sh
|
||||
===================================================================
|
||||
--- os-prober.orig/common.sh
|
||||
+++ os-prober/common.sh
|
||||
@@ -155,6 +155,7 @@ parse_proc_mounts () {
|
||||
done
|
||||
}
|
||||
|
||||
+# add forth parameter to pickup btrfs subvol info
|
||||
parsefstab () {
|
||||
while read -r line; do
|
||||
case "$line" in
|
||||
@@ -165,12 +166,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/linux-boot-prober
|
||||
===================================================================
|
||||
--- os-prober.orig/linux-boot-prober
|
||||
+++ os-prober/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/linux-boot-probes/mounted/common/40grub2
|
||||
===================================================================
|
||||
--- os-prober.orig/linux-boot-probes/mounted/common/40grub2
|
||||
+++ os-prober/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/os-prober
|
||||
===================================================================
|
||||
--- os-prober.orig/os-prober
|
||||
+++ os-prober/os-prober
|
||||
@@ -79,6 +79,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 () {
|
||||
@@ -137,6 +140,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"
|
||||
@@ -155,7 +160,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/os-probes/common/50mounted-tests
|
||||
===================================================================
|
||||
--- os-prober.orig/os-probes/common/50mounted-tests
|
||||
+++ os-prober/os-probes/common/50mounted-tests
|
||||
@@ -19,7 +19,19 @@ do_unmount() {
|
||||
rmdir "$tmpmnt" || true
|
||||
}
|
||||
|
||||
-types="$(fs_type "$partition")"
|
||||
+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")"
|
||||
+fi
|
||||
+
|
||||
if [ "$types" = NOT-DETECTED ]; then
|
||||
debug "$1 type not recognised; skipping"
|
||||
exit 0
|
||||
@@ -66,6 +78,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/os-probes/mounted/common/90linux-distro
|
||||
===================================================================
|
||||
--- os-prober.orig/os-probes/mounted/common/90linux-distro
|
||||
+++ os-prober/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
|
||||
@@ -143,7 +145,11 @@ if (ls "$dir"/lib*/ld*.so* && [ -d "$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/README.btrfs
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ os-prober/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 <gene@czarc.net>
|
||||
+
|
92
os-prober-dont-load-all-fs-module-and-dont-test-mount.patch
Normal file
92
os-prober-dont-load-all-fs-module-and-dont-test-mount.patch
Normal file
|
@ -0,0 +1,92 @@
|
|||
Index: os-prober-1.76/os-probes/common/50mounted-tests
|
||||
===================================================================
|
||||
--- os-prober-1.76.orig/os-probes/common/50mounted-tests
|
||||
+++ os-prober-1.76/os-probes/common/50mounted-tests
|
||||
@@ -49,19 +49,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
|
||||
Index: os-prober-1.76/os-probes/init/common/10filesystems
|
||||
===================================================================
|
||||
--- os-prober-1.76.orig/os-probes/init/common/10filesystems
|
||||
+++ os-prober-1.76/os-probes/init/common/10filesystems
|
||||
@@ -1,39 +1,19 @@
|
||||
#!/bin/sh
|
||||
# Make sure filesystems are available.
|
||||
-set +e # ignore errors from modprobe
|
||||
-
|
||||
-FILESYSTEMS='ext2 ext3 ext4 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
|
||||
-
|
||||
- for fs in $FILESYSTEMS; do
|
||||
- case "$fs" in
|
||||
- fs-*)
|
||||
- ;;
|
||||
- *)
|
||||
- modprobe "$fs" 2>/dev/null | logger -t os-prober
|
||||
- ;;
|
||||
- esac
|
||||
- done
|
||||
-
|
||||
- # 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
|
||||
+set -e
|
||||
+
|
||||
+# 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
|
||||
+# 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.
|
84
os-prober-fix-btrfs-subvol-mounted-tests.patch
Normal file
84
os-prober-fix-btrfs-subvol-mounted-tests.patch
Normal file
|
@ -0,0 +1,84 @@
|
|||
Index: os-prober-1.76/os-probes/common/50mounted-tests
|
||||
===================================================================
|
||||
--- os-prober-1.76.orig/os-probes/common/50mounted-tests
|
||||
+++ os-prober-1.76/os-probes/common/50mounted-tests
|
||||
@@ -65,10 +65,40 @@ fi
|
||||
|
||||
mounted=
|
||||
|
||||
+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
|
||||
+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"
|
||||
+ do_unmount
|
||||
+ exit 0
|
||||
+ fi
|
||||
+ fi
|
||||
+ done
|
||||
+fi
|
||||
+do_unmount
|
||||
+
|
||||
# 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
|
||||
@@ -129,37 +159,8 @@ if [ "$types" = btrfs ]; then
|
||||
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
|
||||
- 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
|
||||
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"
|
||||
- do_unmount
|
||||
- exit 0
|
||||
- fi
|
||||
- fi
|
||||
- done
|
||||
-fi
|
||||
-do_unmount
|
||||
-
|
||||
# No tests found anything.
|
||||
exit 1
|
295
os-prober-linux-distro-avoid-expensive-ld-file-test.patch
Normal file
295
os-prober-linux-distro-avoid-expensive-ld-file-test.patch
Normal file
|
@ -0,0 +1,295 @@
|
|||
Index: os-prober/os-probes/mounted/common/90linux-distro
|
||||
===================================================================
|
||||
--- os-prober.orig/os-probes/mounted/common/90linux-distro
|
||||
+++ os-prober/os-probes/mounted/common/90linux-distro
|
||||
@@ -10,147 +10,133 @@ 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
|
||||
-# better. Make sure this test has a high number so that more accurate tests
|
||||
-# can come first.
|
||||
-# Unless volumes to checked are already mounted, they will be mounted using
|
||||
-# GRUB's own filesystems through FUSE. Since these ATM doesn't support
|
||||
-# 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* && [ -d "$dir/boot" ] || ls "$dir"/usr/lib*/ld*.so*) >/dev/null 2>/dev/null; then
|
||||
- if [ -e "$dir/etc/os-release" ]; then
|
||||
- short="$(grep ^NAME= "$dir/etc/os-release" | sed 's/^[^=]*=//; s/^['\''"]\(.*\)['\''"]$/\1/; s/\\\(.\)/\1/g; s/[[:space:]].*//')"
|
||||
- long="$(grep ^PRETTY_NAME= "$dir/etc/os-release" | sed 's/^[^=]*=//; s/^['\''"]\(.*\)['\''"]$/\1/; s/\\\(.\)/\1/g')"
|
||||
- elif [ -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/mageia-release" ]; then
|
||||
- short="Mageia"
|
||||
- long="$(cat "$dir/etc/mageia-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")"
|
||||
- elif [ -e "$dir/etc/4MLinux-version" ]; then
|
||||
- short="4MLinux"
|
||||
- long="4MLinux $(head -1 "$dir/etc/4MLinux-version")"
|
||||
- elif [ -e "$dir/etc/devuan_version" ]; then
|
||||
- short="Devuan"
|
||||
- long="$(printf "Devuan GNU/Linux (%s)\n" "$(cat "$dir/etc/devuan_version")")"
|
||||
- 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
|
||||
+if [ -e "$dir/etc/os-release" ]; then
|
||||
+ short="$(grep ^NAME= "$dir/etc/os-release" | sed 's/^[^=]*=//; s/^['\''"]\(.*\)['\''"]$/\1/; s/\\\(.\)/\1/g; s/[[:space:]].*//')"
|
||||
+ long="$(grep ^PRETTY_NAME= "$dir/etc/os-release" | sed 's/^[^=]*=//; s/^['\''"]\(.*\)['\''"]$/\1/; s/\\\(.\)/\1/g')"
|
||||
+elif [ -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/mageia-release" ]; then
|
||||
+ short="Mageia"
|
||||
+ long="$(cat "$dir/etc/mageia-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")"
|
||||
+elif [ -e "$dir/etc/4MLinux-version" ]; then
|
||||
+ short="4MLinux"
|
||||
+ long="4MLinux $(head -1 "$dir/etc/4MLinux-version")"
|
||||
+elif [ -e "$dir/etc/devuan_version" ]; then
|
||||
+ short="Devuan"
|
||||
+ long="$(printf "Devuan GNU/Linux (%s)\n" "$(cat "$dir/etc/devuan_version")")"
|
||||
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/os-prober
|
||||
===================================================================
|
||||
--- os-prober.orig/os-prober
|
||||
+++ os-prober/os-prober
|
||||
@@ -186,6 +186,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
|
24
os-prober-linux-distro-parse-os-release.patch
Normal file
24
os-prober-linux-distro-parse-os-release.patch
Normal file
|
@ -0,0 +1,24 @@
|
|||
Index: os-prober/os-probes/mounted/common/90linux-distro
|
||||
===================================================================
|
||||
--- os-prober.orig/os-probes/mounted/common/90linux-distro
|
||||
+++ os-prober/os-probes/mounted/common/90linux-distro
|
||||
@@ -10,7 +10,18 @@ type="$3"
|
||||
uuid="$4"
|
||||
subvol="$5"
|
||||
|
||||
-if [ -e "$dir/etc/os-release" ]; then
|
||||
+if [ -L "$dir/etc/os-release" ]; then
|
||||
+ RELPATH=$(readlink -f "$dir/etc/os-release")
|
||||
+ if readlink "$dir/etc/os-release" | grep -q '^/'; then
|
||||
+ RELPATH="$dir$RELPATH"
|
||||
+ fi
|
||||
+ if [ -f "$RELPATH" ]; then
|
||||
+ short="$(grep ^NAME= "$RELPATH" | sed 's/^[^=]*=//; s/^['\''"]\(.*\)['\''"]$/\1/; s/\\\(.\)/\1/g; s/[[:space:]].*//')"
|
||||
+ long="$(grep ^PRETTY_NAME= "$RELPATH" | sed 's/^[^=]*=//; s/^['\''"]\(.*\)['\''"]$/\1/; s/\\\(.\)/\1/g')"
|
||||
+ else
|
||||
+ exit 1
|
||||
+ fi
|
||||
+elif [ -e "$dir/etc/os-release" ]; then
|
||||
short="$(grep ^NAME= "$dir/etc/os-release" | sed 's/^[^=]*=//; s/^['\''"]\(.*\)['\''"]$/\1/; s/\\\(.\)/\1/g; s/[[:space:]].*//')"
|
||||
long="$(grep ^PRETTY_NAME= "$dir/etc/os-release" | sed 's/^[^=]*=//; s/^['\''"]\(.*\)['\''"]$/\1/; s/\\\(.\)/\1/g')"
|
||||
elif [ -e "$dir/etc/debian_version" ]; then
|
29
os-prober-linux-secure-boot.patch
Normal file
29
os-prober-linux-secure-boot.patch
Normal file
|
@ -0,0 +1,29 @@
|
|||
From: Andrey Borzenkov <arvidjaar@gmail.com>
|
||||
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
|
30
os-prober-make-btrfsprogs-optional.patch
Normal file
30
os-prober-make-btrfsprogs-optional.patch
Normal file
|
@ -0,0 +1,30 @@
|
|||
Index: os-prober-1.76/os-probes/common/50mounted-tests
|
||||
===================================================================
|
||||
--- os-prober-1.76.orig/os-probes/common/50mounted-tests
|
||||
+++ os-prober-1.76/os-probes/common/50mounted-tests
|
||||
@@ -151,11 +151,20 @@ if [ "$types" = btrfs ]; then
|
||||
rmdir "$tmpmnt" || true
|
||||
exit 1
|
||||
fi
|
||||
- # besides regular subvols, get ro and snapshot so thet can be excluded
|
||||
- subvols=$(btrfs subvolume list -a "$tmpmnt" | cut -d ' ' -f 9 | sed -e s!^\<FS_TREE\>/!!)
|
||||
- rosubvols=$(btrfs subvolume list -r -a "$tmpmnt" | cut -d ' ' -f 9 | sed -e s!^\<FS_TREE\>/!!)
|
||||
- sssubvols=$(btrfs subvolume list -s -a "$tmpmnt" | cut -d ' ' -f 14 | sed -e s!^\<FS_TREE\>/!!)
|
||||
- defaultvol=$(btrfs subvolume get-default "$tmpmnt" | cut -d ' ' -f 9)
|
||||
+
|
||||
+ if type btrfs >/dev/null 2>&1; then
|
||||
+ # besides regular subvols, get ro and snapshot so thet can be excluded
|
||||
+ subvols=$(btrfs subvolume list -a "$tmpmnt" | cut -d ' ' -f 9 | sed -e s!^\<FS_TREE\>/!!)
|
||||
+ rosubvols=$(btrfs subvolume list -r -a "$tmpmnt" | cut -d ' ' -f 9 | sed -e s!^\<FS_TREE\>/!!)
|
||||
+ sssubvols=$(btrfs subvolume list -s -a "$tmpmnt" | cut -d ' ' -f 14 | sed -e s!^\<FS_TREE\>/!!)
|
||||
+ defaultvol=$(btrfs subvolume get-default "$tmpmnt" | cut -d ' ' -f 9)
|
||||
+ else
|
||||
+ subvols=""
|
||||
+ rosubvols=""
|
||||
+ sssubvols=""
|
||||
+ defaultvol=""
|
||||
+ fi
|
||||
+
|
||||
if ! umount "$tmpmnt"; then
|
||||
warn "failed to umount btrfs volume on $tmpmnt"
|
||||
rmdir "$tmpmnt" || true
|
32
os-prober-multiple-initrd.patch
Normal file
32
os-prober-multiple-initrd.patch
Normal file
|
@ -0,0 +1,32 @@
|
|||
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
|
||||
@@ -19,11 +19,11 @@ entry_result () {
|
||||
# if path is not relative to subvolume make it relative
|
||||
kernel=${kernel#${bsv}}
|
||||
kernelfile=$kernel
|
||||
- initrd=${initrd#${bsv}}
|
||||
+ initrd=`echo $initrd | sed -e "s!^${bsv}!!" -e "s!\\(\\s\\)${bsv}!\\1!g"`
|
||||
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}
|
||||
+ initrd=`echo $initrd | sed -e "s!\\(\\S\\+\\)!${bsv}\\1!g"`
|
||||
fi
|
||||
# assumed: rootsv != bootsv if rootsv isn't ancestor of bootsv
|
||||
[ "$partition" != "$bootpart" -o "$rootsv" != "$bootsv" ] && kernelfile="/boot${kernelfile}"
|
||||
@@ -105,10 +105,11 @@ parse_grub_menu () {
|
||||
fi
|
||||
;;
|
||||
initrd|initrdefi|initrd16)
|
||||
- initrd="$(echo "$2" | sed 's/(.*)//')"
|
||||
+ shift
|
||||
+ initrd="$(echo "$@" | sed 's/(\S*)//g')"
|
||||
# Initrd same.
|
||||
if [ "$partition" != "$bootpart" -a "$type" != "btrfs" ]; then
|
||||
- initrd="/boot$initrd"
|
||||
+ initrd=`echo $initrd | sed -e 's!\(\S\+\)!/boot\1!g'`
|
||||
fi
|
||||
;;
|
||||
"}")
|
10
os-prober-newnsdirfix.patch
Normal file
10
os-prober-newnsdirfix.patch
Normal file
|
@ -0,0 +1,10 @@
|
|||
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
|
26
os-prober-probe-MD-devices.patch
Normal file
26
os-prober-probe-MD-devices.patch
Normal file
|
@ -0,0 +1,26 @@
|
|||
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
|
42
os-prober-skip-part-on-multipath.patch
Normal file
42
os-prober-skip-part-on-multipath.patch
Normal file
|
@ -0,0 +1,42 @@
|
|||
Index: os-prober-1.61/os-prober
|
||||
===================================================================
|
||||
--- os-prober-1.61.orig/os-prober
|
||||
+++ os-prober-1.61/os-prober
|
||||
@@ -23,6 +23,28 @@
|
||||
fi
|
||||
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 () {
|
||||
os_name="$(uname -s)"
|
||||
@@ -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"
|
276
os-prober-use-tmp-over-var-lib-for-transient-files.patch
Normal file
276
os-prober-use-tmp-over-var-lib-for-transient-files.patch
Normal file
|
@ -0,0 +1,276 @@
|
|||
From 2ed7c3ae98aa671d504eba254fdd89ea26fe15c8 Mon Sep 17 00:00:00 2001
|
||||
From: Michael Chang <mchang@suse.com>
|
||||
Date: Thu, 7 Mar 2019 16:31:19 +0800
|
||||
Subject: [PATCH] Use /tmp over /var/lib for transient files
|
||||
|
||||
Create transient mount point in directory /tmp rather than /var/lib
|
||||
which is not available during transactional update. Also clean up the
|
||||
count_last_label function for not relying on /var/lib/os-prober/labels
|
||||
file for the caculation.
|
||||
|
||||
https://en.opensuse.org/openSUSE:Packaging_for_transactional-updates
|
||||
|
||||
v2:
|
||||
- Fix accidental deletion of btrfs subvolume (boo#1130669).
|
||||
- Fix detection of btrfs boot subvolume if its /etc/fstab entry contains
|
||||
leading slash for subvol= mount option.
|
||||
|
||||
---
|
||||
common.sh | 37 ++++++++++++++------------------
|
||||
linux-boot-prober | 2 +-
|
||||
linux-boot-probes/common/50mounted-tests | 2 +-
|
||||
os-prober | 3 ---
|
||||
os-probes/common/50mounted-tests | 2 +-
|
||||
5 files changed, 19 insertions(+), 27 deletions(-)
|
||||
|
||||
Index: os-prober-1.76/common.sh
|
||||
===================================================================
|
||||
--- os-prober-1.76.orig/common.sh
|
||||
+++ os-prober-1.76/common.sh
|
||||
@@ -21,31 +21,26 @@ require_tmpdir() {
|
||||
fi
|
||||
}
|
||||
|
||||
-count_for() {
|
||||
- _labelprefix="$1"
|
||||
- _result=$(grep "^${_labelprefix} " /var/lib/os-prober/labels 2>/dev/null || true)
|
||||
-
|
||||
- if [ -z "$_result" ]; then
|
||||
- return
|
||||
- else
|
||||
- echo "$_result" | cut -d' ' -f2
|
||||
- fi
|
||||
-}
|
||||
-
|
||||
+OS_PROBER_LABELS=""
|
||||
count_next_label() {
|
||||
- require_tmpdir
|
||||
-
|
||||
_labelprefix="$1"
|
||||
- _cfor="$(count_for "${_labelprefix}")"
|
||||
-
|
||||
- if [ -z "$_cfor" ]; then
|
||||
- echo "${_labelprefix} 1" >> /var/lib/os-prober/labels
|
||||
+ _count=""
|
||||
+ _labels=""
|
||||
+ for i in $OS_PROBER_LABELS; do
|
||||
+ _label="`echo $i | cut -d: -f1`"
|
||||
+ if [ x"$_labelprefix" = x"$_label" ]; then
|
||||
+ _count=`echo $i | cut -d: -f2`
|
||||
+ _labels="$_labels $_label:`expr $_count + 1`"
|
||||
+ else
|
||||
+ _labels="$_labels $i"
|
||||
+ fi
|
||||
+ done
|
||||
+ if [ -z "$_count" ]; then
|
||||
+ OS_PROBER_LABELS="$OS_PROBER_LABELS $_labelprefix:1"
|
||||
else
|
||||
- sed "s/^${_labelprefix} ${_cfor}/${_labelprefix} $(($_cfor + 1))/" /var/lib/os-prober/labels > "$OS_PROBER_TMP/os-prober.tmp"
|
||||
- mv "$OS_PROBER_TMP/os-prober.tmp" /var/lib/os-prober/labels
|
||||
+ OS_PROBER_LABELS="$_labels"
|
||||
fi
|
||||
-
|
||||
- echo "${_labelprefix}${_cfor}"
|
||||
+ echo "${_labelprefix}${_count}"
|
||||
}
|
||||
|
||||
progname=
|
||||
Index: os-prober-1.76/linux-boot-prober
|
||||
===================================================================
|
||||
--- os-prober-1.76.orig/linux-boot-prober
|
||||
+++ os-prober-1.76/linux-boot-prober
|
||||
@@ -7,11 +7,6 @@ newns "$@"
|
||||
require_tmpdir
|
||||
ERR="n"
|
||||
|
||||
-tmpmnt=/var/lib/os-prober/mount
|
||||
-if [ ! -d "$tmpmnt" ]; then
|
||||
- mkdir "$tmpmnt"
|
||||
-fi
|
||||
-
|
||||
mounted=
|
||||
bootmnt=
|
||||
bootsv=
|
||||
@@ -45,23 +40,21 @@ if [ "x$ERR" != xn ]; then
|
||||
fi
|
||||
|
||||
if [ "$type" = btrfs ]; then
|
||||
+ tmpmnt="$(mktemp -d /tmp/linux-boot-prober.XXXXXX)"
|
||||
# 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
|
||||
@@ -74,8 +67,6 @@ if [ "$type" = btrfs ]; then
|
||||
|
||||
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
|
||||
rmdir "$tmpmnt" 2>/dev/null
|
||||
exit 1
|
||||
fi
|
||||
@@ -83,8 +74,6 @@ if [ "$type" = btrfs ]; then
|
||||
# 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
|
||||
@@ -103,27 +92,34 @@ if [ "$type" = btrfs ]; then
|
||||
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=//" )
|
||||
+ bootsv=$(echo "$bootmnt" | cut -d ' ' -f 4 | sed -n 's!\(^subvol=\|.*,subvol=\)\([^,]\+\).*!\2!p')
|
||||
+ if [ -z "$bootsv" ]; then
|
||||
+ warn "no subvolume in entry: $bootmnt"
|
||||
+ umount "$tmpmnt" 2>/dev/null
|
||||
+ rmdir "$tmpmnt" 2>/dev/null
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ bootuuid=$(echo "$bootmnt" | cut -d ' ' -f 1 | sed -n 's/UUID=\("\(.*\)"\|\(.*\)\)/\2\3/p')
|
||||
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)
|
||||
+ bootpart=$(grep " btrfs " /proc/self/mountinfo | grep " `echo /$bootsv | tr -s /` " | cut -d ' ' -f 10)
|
||||
+ if [ -z "$bootpart" ]; then
|
||||
+ warn "no bootpart for $bootsv in /proc/self/mountinfo"
|
||||
+ fi
|
||||
else
|
||||
# non-btrfs partition or logical volume
|
||||
linux_mount_boot $partition $tmpmnt
|
||||
Index: os-prober-1.76/linux-boot-probes/common/50mounted-tests
|
||||
===================================================================
|
||||
--- os-prober-1.76.orig/linux-boot-probes/common/50mounted-tests
|
||||
+++ os-prober-1.76/linux-boot-probes/common/50mounted-tests
|
||||
@@ -42,10 +42,7 @@ elif [ -z "$types" ]; then
|
||||
types="$(grep -v nodev /proc/filesystems)"
|
||||
fi
|
||||
|
||||
-tmpmnt=/var/lib/os-prober/mount
|
||||
-if [ ! -d "$tmpmnt" ]; then
|
||||
- mkdir "$tmpmnt"
|
||||
-fi
|
||||
+tmpmnt="$(mktemp -d /tmp/linux-boot-probes-50mounted-tests.XXXXXX)"
|
||||
|
||||
mounted=
|
||||
if type grub2-mount >/dev/null 2>&1 && \
|
||||
Index: os-prober-1.76/os-prober
|
||||
===================================================================
|
||||
--- os-prober-1.76.orig/os-prober
|
||||
+++ os-prober-1.76/os-prober
|
||||
@@ -141,9 +141,6 @@ parse_proc_mdstat () {
|
||||
done
|
||||
}
|
||||
|
||||
-# Needed for idempotency
|
||||
-rm -f /var/lib/os-prober/labels
|
||||
-
|
||||
for prog in /usr/lib/os-probes/init/*; do
|
||||
if [ -x "$prog" ] && [ -f "$prog" ]; then
|
||||
"$prog" || true
|
||||
Index: os-prober-1.76/os-probes/common/50mounted-tests
|
||||
===================================================================
|
||||
--- os-prober-1.76.orig/os-probes/common/50mounted-tests
|
||||
+++ os-prober-1.76/os-probes/common/50mounted-tests
|
||||
@@ -58,10 +58,7 @@ elif [ -z "$types" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
-tmpmnt=/var/lib/os-prober/mount
|
||||
-if [ ! -d "$tmpmnt" ]; then
|
||||
- mkdir "$tmpmnt"
|
||||
-fi
|
||||
+tmpmnt="$(mktemp -d /tmp/os-probes-50mounted-tests.XXXXXX)"
|
||||
|
||||
mounted=
|
||||
|
||||
@@ -105,7 +102,7 @@ probe_subvol ()
|
||||
local UUID=$3
|
||||
local tmpmnt=$4
|
||||
|
||||
- mounted=
|
||||
+ local mounted=
|
||||
mpoint="$(grep btrfs /proc/self/mountinfo | grep "$partition " | grep "/$subvol " | cut -d ' ' -f 5)"
|
||||
ret=1
|
||||
|
||||
@@ -115,13 +112,18 @@ probe_subvol ()
|
||||
|
||||
if [ -n "$mpoint" ]; then
|
||||
if [ "x$mpoint" = "x/" ]; then
|
||||
- continue # this is the root for the running system
|
||||
+ return 1
|
||||
fi
|
||||
- mounted=1
|
||||
else
|
||||
# again, do not mount btrfs ro
|
||||
- mount -t btrfs $opts -U "$UUID" "$tmpmnt"
|
||||
- mpoint="$tmpmnt"
|
||||
+ if mount -t btrfs $opts -U "$UUID" "$tmpmnt" 2>/dev/null; then
|
||||
+ debug "btrfs volume $UUID mounted with $opt"
|
||||
+ mpoint="$tmpmnt"
|
||||
+ mounted=1
|
||||
+ else
|
||||
+ warn "cannot mount btrfs volume $UUID with $opt"
|
||||
+ return 1
|
||||
+ fi
|
||||
fi
|
||||
test="/usr/lib/os-probes/mounted/90linux-distro"
|
||||
if [ -f "$test" ] && [ -x "$test" ]; then
|
||||
@@ -131,7 +133,7 @@ probe_subvol ()
|
||||
ret=0
|
||||
fi
|
||||
fi
|
||||
- if [ -z "$mounted" ]; then
|
||||
+ if [ "$mounted" ]; then
|
||||
if ! umount "$tmpmnt"; then
|
||||
warn "failed to umount $tmpmnt"
|
||||
fi
|
||||
Index: os-prober-1.76/linux-boot-probes/mounted/common/40grub2
|
||||
===================================================================
|
||||
--- os-prober-1.76.orig/linux-boot-probes/mounted/common/40grub2
|
||||
+++ os-prober-1.76/linux-boot-probes/mounted/common/40grub2
|
||||
@@ -15,7 +15,7 @@ found_item=0
|
||||
|
||||
entry_result () {
|
||||
if [ "x$type" = "xbtrfs" ]; then
|
||||
- bsv=${bootsv:+/}${bootsv}
|
||||
+ bsv=`echo ${bootsv:+/}${bootsv} | tr -s /`
|
||||
# if path is not relative to subvolume make it relative
|
||||
kernel=${kernel#${bsv}}
|
||||
kernelfile=$kernel
|
255
os-prober.changes
Normal file
255
os-prober.changes
Normal file
|
@ -0,0 +1,255 @@
|
|||
* Tue Apr 23 2019 mchang@suse.com
|
||||
- Fix accidental deletion of btrfs subvolume (boo#1130669)
|
||||
* os-prober-use-tmp-over-var-lib-for-transient-files.patch
|
||||
* Tue Mar 12 2019 mchang@suse.com
|
||||
- Update URL to current development project in Debian Salsa server.
|
||||
- Update the Source0 to use local compressed archive since the remote URL is
|
||||
not reliable to access, causing trouble to the factory-auto checker reporting
|
||||
error as not valid one.
|
||||
* os-prober.spec
|
||||
* Thu Mar 7 2019 mchang@suse.com
|
||||
- os-prober isn't compatible with transactional update (boo#1125729)
|
||||
* os-prober-use-tmp-over-var-lib-for-transient-files.patch
|
||||
* Tue Dec 11 2018 mchang@suse.com
|
||||
- Don't hard require btrfsprogs by downgrading it to suggests (boo#1118279)
|
||||
* os-prober-make-btrfsprogs-optional.patch
|
||||
* Wed Oct 31 2018 mchang@suse.com
|
||||
- Fix missing grub-probe command that caused linux-boot-probe to abort
|
||||
prematurely. It is a mistake while rebasing patch to 1.76 (bsc#1113615)
|
||||
* os-prober-1.49-grub2-mount.patch
|
||||
* Mon Oct 8 2018 mchang@suse.com
|
||||
- Version bump to 1.76:
|
||||
* Fix check on ID_PART_ENTRY_SCHEME, to look for "dos" instead of "msdos"
|
||||
* Remove code using device mapper
|
||||
* This also removes the dependency on dmsetup
|
||||
- Rediff
|
||||
* os-prober-1.49-grub2-mount.patch
|
||||
* os-prober-accept-ESP-on-IMSM.patch
|
||||
* os-prober-dont-load-all-fs-module-and-dont-test-mount.patch
|
||||
* os-prober-fix-btrfs-subvol-mounted-tests.patch
|
||||
* Tue Jul 31 2018 mchang@suse.com
|
||||
- UEFI Grub does not insert Arch Linux entry correctly (boo#1101942)
|
||||
* os-prober-multiple-initrd.patch
|
||||
* Thu Jun 14 2018 josef.moellers@suse.com
|
||||
- Rather than Recommend lvm2 merely Suggest it.
|
||||
[bsc#1026766, os-prober.spec]
|
||||
* Mon Feb 26 2018 mchang@suse.com
|
||||
- Use blkid to bailout udevinfo for db not imported in chroot
|
||||
environment (bsc#1076779)
|
||||
* os-prober-05efi-blkid.patch
|
||||
* Fri Feb 23 2018 mchang@suse.com
|
||||
- revert os-prober-05efi-udevinfo.patch as it messed up with strings
|
||||
that could be named differently in which even with non ascil characters.
|
||||
* Wed Jan 31 2018 mchang@suse.com
|
||||
- Fix Windows not listed in grub menu after install or upgrade (bsc#1076779)
|
||||
* os-prober-05efi-udevinfo.patch
|
||||
* Wed Mar 1 2017 mchang@suse.com
|
||||
- Fix btrfs 1.74 regression in detection btrfs, the do_unmount has to be
|
||||
skipped for btrfs as it removes tmp mount point of which btrfs is making
|
||||
use (bsc#1024196)
|
||||
* modify os-prober-btrfs-absolute-subvol.patch
|
||||
* rediff os-prober-btrfs-always-detect-default.patch
|
||||
* Fri Feb 10 2017 mchang@suse.com
|
||||
- Version bump to 1.74:
|
||||
* Add support for Mageia
|
||||
* Improve logging of mounting and setting partitions to ro/rw
|
||||
* Use a read-only device-mapper entry if possible rather than setting the
|
||||
underlying device to read-only.
|
||||
Note that this introduces a dependency on dmsetup on Linux architectures.
|
||||
* Remove the "blockdev --setro" code path entirely, since the read-only
|
||||
device-mapper arrangement supersedes it and should be safer
|
||||
* Make the yaboot parser more tolerant about the syntax of "append" options
|
||||
* Disable debugging if OS_PROBER_DISABLE_DEBUG is set
|
||||
* Replace basename/dirname with shell string processing
|
||||
* Fix typos in README
|
||||
* Add Devuan detection
|
||||
* Work harder to avoid trying to mount extended partitions
|
||||
* Drop " (loader)" suffixes on Microsoft operating systems
|
||||
* Add support for 4MLinux
|
||||
* Use HTTPS for Vcs-* URLs, and link to cgit rather than gitweb.
|
||||
- Rediff
|
||||
* os-prober-1.49-grub2-mount.patch
|
||||
* os-prober-EFI-openSUSEfy.patch
|
||||
* os-prober-btrfs-always-detect-default.patch
|
||||
* os-prober-btrfsfix.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-distro-parse-os-release.patch
|
||||
- Remove patches; fixed on upstream release
|
||||
* os-prober-call-dmraid-once.patch
|
||||
* os-prober-1.49-skip-LVM2_member.patch
|
||||
* Tue Nov 15 2016 mchang@suse.com
|
||||
- The wildcard test for ld.so is inaccurate, slow and sometimes hangs a
|
||||
long time with grub2-mount. Disable it becuase it does quite opposite
|
||||
it was intended to do, that is having an inital quick filter for non
|
||||
linux partition to speed things up. (bsc#1008444)
|
||||
* modified os-prober-linux-distro-avoid-expensive-ld-file-test.patch
|
||||
* refresh os-prober-linux-distro-parse-os-release.patch
|
||||
* Tue Oct 4 2016 mchang@suse.com
|
||||
- Handle /etc/os-release symlink (bsc#997465)
|
||||
* refresh os-prober-linux-distro-parse-os-release.patch
|
||||
* Wed Sep 14 2016 mchang@suse.com
|
||||
- Parse /etc/os-release for openSUSE Tumbleweed (bsc#997465)
|
||||
* os-prober-linux-distro-parse-os-release.patch
|
||||
* Thu Dec 17 2015 mchang@suse.com
|
||||
- The ld file tests cost too much as it transversed all files in
|
||||
the given wildcard directory and path, we should avoid when not
|
||||
necessary. (bsc#953987)
|
||||
* added os-prober-linux-distro-avoid-expensive-ld-file-test.patch
|
||||
- Fix missing linux16/initrd16 parsing in entry result
|
||||
- Fix kernelfile path if separate boot partition on btrfs
|
||||
* modified Improve-btrfs-handling-on-os-probing-for-grub2.patch
|
||||
- fix os-prober failed to detect os in btrfs root tree (bsc#957018)
|
||||
* added os-prober-btrfs-always-detect-default.patch
|
||||
* Tue Nov 10 2015 p.drouand@gmail.com
|
||||
- Update to version 1.70
|
||||
* Fix hurd-any support: Test for /servers instead of /servers/exec
|
||||
to avoid starting an translator in the mounted system. Also,
|
||||
/hurd/init might be phased out at some point (Closes: #802053).
|
||||
- Remove patches; fixed on upstream release
|
||||
* os-prober-grep-for-windows-bcd-file.patch
|
||||
* os-prober-properly-detect-Windows-10.patch
|
||||
* Mon Nov 9 2015 lnussel@suse.de
|
||||
- detect os on default subvolume in snapshot (bsc#954225)
|
||||
(os-prober-btrfs-snapshot-detection.patch)
|
||||
* Thu Oct 1 2015 mchang@suse.com
|
||||
- replace os-prober-grep-for-windows-bcd-file.patch by upstream's version
|
||||
* modified os-prober-grep-for-windows-bcd-file.patch
|
||||
- include patch from upstream to fix os-prober is missing support for
|
||||
Windows 10 (bsc#947487)
|
||||
* added os-prober-properly-detect-Windows-10.patch
|
||||
* Sun Aug 2 2015 arvidjaar@gmail.com
|
||||
- add os-prober-40grub-check-grub2.patch
|
||||
* also skip legacy grub if /boot/grub2/grub.cfg is present, not only
|
||||
/boot/grub/grub.cfg
|
||||
* Thu Jun 18 2015 mchang@suse.com
|
||||
- add os-prober-btrfs-absolute-subvol.patch
|
||||
* fix os-prober mount error, no such file or directory (bsc#931955)
|
||||
* Mon Jun 1 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 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 2015 mchang@suse.com
|
||||
- os-prober-btrfsfix-trim-leading-subvol.patch
|
||||
* fix os-prober fails to detect other SLES12 installation (bsc#892364)
|
||||
* Mon Jan 26 2015 mchang@suse.com
|
||||
- add os-prober-grep-for-windows-bcd-file.patch
|
||||
* fix os-prober misinterprets Windows 8 to be Vista (bsc#910654)
|
||||
* Sun Dec 14 2014 tchvatal@suse.com
|
||||
- Version bujmp to 1.65:
|
||||
* use latest in debian to be up par patch wise
|
||||
* Drop reiserfs, it's no longer supported.
|
||||
- we actually still support it as we patch this class away
|
||||
anyway, but still they have it in their changes...
|
||||
* Add ppc64el support. Closes: #752416.
|
||||
* Recognise the new ignore_uefi flag from partman-efi.
|
||||
- Refresh all patches to still apply:
|
||||
* os-prober-1.49-grub2-mount.patch
|
||||
* os-prober-call-dmraid-once.patch
|
||||
* os-prober-dont-load-all-fs-module-and-dont-test-mount.patch
|
||||
- Always delete all the .orig files as sometimes even upstream
|
||||
put them to tarball :)
|
||||
* Tue Aug 19 2014 mchang@suse.com
|
||||
- requires util-linux-systemd (bnc#892337)
|
||||
* Fri Jun 20 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 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 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 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 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 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 2013 mchang@suse.com
|
||||
- add require btrfsprogs
|
||||
* Sun Aug 18 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 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 2013 arvidjaar@gmail.com
|
||||
- add os-prober-linux-secure-boot.patch (bnc#810912)
|
||||
* recognize linuxefi/initrdefi too
|
||||
* Fri Mar 22 2013 arvidjaar@gmail.com
|
||||
- add os-prober-probe-MD-devices.patch (bnc#811006)
|
||||
* probe also Linux MD devices
|
||||
* Sun Mar 3 2013 arvidjaar@gmail.com
|
||||
- 05efi - accept FUSE as valid filesystem too (bnc#807190)
|
||||
* Fri Feb 8 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 2013 arvidjaar@gmail.com
|
||||
- os-prober-1.49-grub2-mount.patch (bnc#767272)
|
||||
* In openSUSE grub-mount is called grub2-mount
|
||||
* Sat Jan 19 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 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 2013 arvidjaar@gmail.com
|
||||
- add os-prober-1.49-fix-grub2.cfg-parsing.patch (bnc#796919)
|
||||
* Fri Jan 4 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 2011 aj@suse.de
|
||||
- Clarify license.
|
||||
* Thu Dec 8 2011 aj@suse.de
|
||||
- Update to 1.49:
|
||||
* MeeGo detection support
|
||||
* Bugfixes
|
||||
* Thu Dec 8 2011 coolo@suse.com
|
||||
- this seems to be "GPL" as it was understood 2004, so guessing
|
||||
GPL-2.0+
|
||||
* Fri Sep 30 2011 uli@suse.com
|
||||
- cross-build fix: use %%__cc macro
|
||||
* Tue Jul 12 2011 aj@suse.de
|
||||
- Create new package.
|
162
os-prober.spec
Normal file
162
os-prober.spec
Normal file
|
@ -0,0 +1,162 @@
|
|||
#
|
||||
# spec file for package os-prober
|
||||
#
|
||||
# Copyright (c) 2022-2023 ZhuningOS
|
||||
#
|
||||
|
||||
|
||||
Name: os-prober
|
||||
Version: 1.76
|
||||
Release: 150100.4.2.1
|
||||
Summary: Probes disks on the system for installed operating systems
|
||||
License: GPL-2.0-or-later
|
||||
Group: System/Boot
|
||||
Url: https://salsa.debian.org/installer-team/os-prober
|
||||
Source0: %{name}_%{version}.tar.xz
|
||||
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: 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 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
|
||||
# PATCH-FIX-OPENSUSE: Leap does not recognize Tumbleweed any more (bsc#997465)
|
||||
Patch24: os-prober-linux-distro-parse-os-release.patch
|
||||
# PATCH-FIX-OPENSUSE: Windows 10 is not listed in the grub menu (bsc#1076779)
|
||||
Patch25: os-prober-05efi-blkid.patch
|
||||
# PATCH-FIX-OPENSUSE: UEFI Grub does not insert Arch Linux entry correctly (boo#1101942)
|
||||
Patch26: os-prober-multiple-initrd.patch
|
||||
# PATCH-FIX-OPENSUSE: os-prober unconditionally pulls btrfsprogs (boo#1118279)
|
||||
Patch27: os-prober-make-btrfsprogs-optional.patch
|
||||
# PATCH-FIX-OPENSUSE: os-prober isn't compatible with transactional update (boo#1125729)
|
||||
# PATCH-FIX-OPENSUSE: os-prober deletes subvolume on btrfs disk (boo#1130669)
|
||||
Patch28: os-prober-use-tmp-over-var-lib-for-transient-files.patch
|
||||
Requires: /bin/grep
|
||||
Requires: /bin/sed
|
||||
Requires: /sbin/modprobe
|
||||
Requires: coreutils
|
||||
Requires: udev
|
||||
Requires: util-linux
|
||||
Recommends: dmraid
|
||||
Suggests: lvm2
|
||||
Suggests: btrfsprogs
|
||||
%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
|
||||
cp %{SOURCE1} .
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
%patch3 -p1
|
||||
%patch5 -p1
|
||||
%patch7 -p1
|
||||
%patch8 -p1
|
||||
%patch9 -p1
|
||||
%patch10 -p1
|
||||
%patch11 -p1
|
||||
%patch12 -p1
|
||||
%patch13 -p1
|
||||
%patch14 -p1
|
||||
%patch17 -p1
|
||||
%patch18 -p1
|
||||
%patch19 -p1
|
||||
%patch21 -p1
|
||||
%patch22 -p1
|
||||
%patch23 -p1
|
||||
%patch24 -p1
|
||||
%patch25 -p1
|
||||
%patch26 -p1
|
||||
%patch27 -p1
|
||||
%patch28 -p1
|
||||
find . -name \*.orig -delete
|
||||
|
||||
%build
|
||||
make %{?_smp_mflags} CC="gcc" CFLAGS="%{optflags}"
|
||||
|
||||
%install
|
||||
install -m 0755 -d %{buildroot}%{_bindir}
|
||||
# See also boo#1125729, we no longer use /var/lib/os-prober for runtime
|
||||
# temporary files, but to keep compatible with upstream runtime we still keep
|
||||
# it in place.
|
||||
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
|
Loading…
Add table
Reference in a new issue