Accepting request 179592 from home:arvidjaar:grub2-next
Companion to new grub2. Probably should not be accepted standalone, as it has at least one small patch that depends on new code in grub2. OBS-URL: https://build.opensuse.org/request/show/179592 OBS-URL: https://build.opensuse.org/package/show/Base:System/os-prober?expand=0&rev=27
This commit is contained in:
parent
fdc43a782b
commit
f4287cc9b1
71
05efi
71
05efi
@ -1,71 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Detects all UEFI bootloaders on EFI System Partition
|
||||
|
||||
. /usr/share/os-prober/common.sh
|
||||
|
||||
partition="$1"
|
||||
mpoint="$2"
|
||||
type="$3"
|
||||
|
||||
# This file is for UEFI platform only
|
||||
if [ ! -d /sys/firmware/efi ]; then
|
||||
debug "Not on UEFI platform"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Weed out stuff that doesn't apply to us
|
||||
case "$type" in
|
||||
vfat) debug "$1 is a FAT32 partition" ;;
|
||||
msdos) debug "$1 is a FAT16 partition" ;;
|
||||
fuse|fuseblk) debug "$1 is a FUSE partition" ;; # might be GRUB
|
||||
*) debug "$1 is $type partition: exiting"; exit 1 ;;
|
||||
esac
|
||||
|
||||
if type udevadm > /dev/null 2>&1; then
|
||||
udevinfo () {
|
||||
udevadm info "$@"
|
||||
}
|
||||
fi
|
||||
|
||||
if type udevinfo > /dev/null 2>&1; then
|
||||
# Skip virtual devices
|
||||
if udevinfo -q path -n $partition | grep -q /virtual/; then
|
||||
debug "$1 is virtual device: exiting"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
eval "$(udevinfo -q property -n "$partition" | grep -E '^ID_PART_ENTRY_(TYPE|SCHEME)=')"
|
||||
debug "$partition partition scheme is $ID_PART_ENTRY_SCHEME"
|
||||
debug "$partition partition type is $ID_PART_ENTRY_TYPE"
|
||||
|
||||
if [ -z "$ID_PART_ENTRY_TYPE" -o -z "$ID_PART_ENTRY_SCHEME" -o \
|
||||
\( "$ID_PART_ENTRY_SCHEME" != gpt -a "$ID_PART_ENTRY_SCHEME" != msdos \) -o \
|
||||
\( "$ID_PART_ENTRY_SCHEME" = gpt -a "$ID_PART_ENTRY_TYPE" != c12a7328-f81f-11d2-ba4b-00a0c93ec93b \) -o \
|
||||
\( "$ID_PART_ENTRY_SCHEME" = msdos -a "$ID_PART_ENTRY_TYPE" != 0xef \) ]; then
|
||||
debug "$partition is not a ESP partition: exiting"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
debug "udevinfo and udevadm missing - cannot check partition type"
|
||||
fi
|
||||
|
||||
efi=$(item_in_dir efi "$mpoint")
|
||||
if [ -z "$efi" ]; then
|
||||
debug "$mpoint does not have /EFI directory: exiting"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ret=1
|
||||
for test in /usr/lib/os-probes/mounted/efi/*; do
|
||||
debug "running subtest $test"
|
||||
if [ -f "$test" ] && [ -x "$test" ]; then
|
||||
entry=$("$test" "$mpoint/$efi")
|
||||
if [ -n "$entry" ]; then
|
||||
debug "bootloader $entry found by subtest $test"
|
||||
ret=0
|
||||
result "${partition}@/$efi/${entry}:efi"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
exit $ret
|
25
efi-10elilo
25
efi-10elilo
@ -1,25 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Detects ELILO bootloader on a EFI System Partition
|
||||
|
||||
. /usr/share/os-prober/common.sh
|
||||
|
||||
efi="$1"
|
||||
|
||||
found=
|
||||
|
||||
elilo=`find $1 -name "elilo.efi"`
|
||||
if [ -n "$elilo" ]; then
|
||||
bdir=`dirname $elilo`
|
||||
bdir=`basename $bdir`
|
||||
vendor=$(echo $bdir | sed 's|SuSE|SUSE|')
|
||||
long="${vendor} ELILO Boot Manager"
|
||||
short="ELILO"
|
||||
path=${bdir}/elilo.efi
|
||||
found=true
|
||||
fi
|
||||
|
||||
if [ -n "$found" ]; then
|
||||
label="$(count_next_label "$short")"
|
||||
result "${path}:${long}:${label}"
|
||||
fi
|
||||
exit 0
|
@ -1,28 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Detects Microsoft bootloader on a EFI System Partition
|
||||
|
||||
. /usr/share/os-prober/common.sh
|
||||
|
||||
efi="$1"
|
||||
|
||||
found=
|
||||
for microsoft in $(item_in_dir microsoft "$efi"); do
|
||||
for boot in $(item_in_dir boot "$efi/$microsoft"); do
|
||||
bcd=$(item_in_dir bcd "$efi/$microsoft/$boot")
|
||||
bootmgfw=$(item_in_dir bootmgfw.efi "$efi/$microsoft/$boot")
|
||||
if [ -n "$bcd" -a -n "$bootmgfw" ]; then
|
||||
long="Windows Boot Manager"
|
||||
short=Windows
|
||||
path="$microsoft/$boot/$bootmgfw"
|
||||
found=true
|
||||
break
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
|
||||
if [ -n "$found" ]; then
|
||||
label="$(count_next_label "$short")"
|
||||
result "${path}:${long}:${label}"
|
||||
fi
|
||||
exit 0
|
@ -5,123 +5,51 @@ References: bnc#796919
|
||||
Fix several problems in parsing of grub.cfg by
|
||||
linux-boot-probes/mounted/40grub2
|
||||
|
||||
1. It looked for /boot/grub/grub.cfg only. Make it check for
|
||||
/boot/grub2-efi/grub.cfg, /boot/grub2/grub.cfg, /boot/grub/grub.cfg in
|
||||
that order
|
||||
1. Look for /boot/grub2-efi/grub.cfg as well (openSUSE 12.2)
|
||||
|
||||
2. Parsing of menuentry was completely broken. It is (near to) impossible
|
||||
to parse full fledged shell quoted strings with a couple of sed expressions.
|
||||
Replace it with ``eval "set -- $line"'', which should handle quoting
|
||||
automatically. It still may fail for manually created grub.cfg though.
|
||||
|
||||
3. It checked for literal "(on /dev/.*)" to filter out menu entries
|
||||
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. Relax check and make it '(.* /dev/.*)'. It should
|
||||
work as long as grub.cfg was created by grub-mkconfig.
|
||||
Index: os-prober/linux-boot-probes/mounted/common/40grub2
|
||||
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.orig/linux-boot-probes/mounted/common/40grub2
|
||||
+++ os-prober/linux-boot-probes/mounted/common/40grub2
|
||||
@@ -34,33 +34,43 @@ parse_grub_menu () {
|
||||
title=""
|
||||
ignore_item=0
|
||||
|
||||
- while read line; do
|
||||
+ # grub.cfg is written in shell like language that can contain
|
||||
+ # arbitrary quoting. We need to extract second word according to
|
||||
+ # normal quoting rules. Unfortunately, sticking ``eval $line'' for
|
||||
+ # every line will try to interpret it according to shell
|
||||
+ # grammar and error out for something as simple as "xxx; then".
|
||||
+ # So the following is using it only on known cases.
|
||||
+ # FIXME: it will fail if ``menuentry'' is not the first word on line.
|
||||
+ # case patterns below include SPACE and TAB.
|
||||
+ while read -r line; do
|
||||
debug "parsing: $line"
|
||||
- set -f
|
||||
- set -- $line
|
||||
- set +f
|
||||
- case "$1" in
|
||||
- menuentry)
|
||||
+ line="$(printf "%s" "$line" | sed -e 's/^[[:space:]]*//')"
|
||||
+ case "$line" in
|
||||
+ menuentry[" "]*)
|
||||
--- 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
|
||||
- # The double-quoted string is the title.
|
||||
- title="$(echo "$@" | sed -n 's/[^"]*"\(.*\)".*/\1/p' | sed 's/://g')"
|
||||
- if [ -z "$title" ]; then
|
||||
- # ... or single-quoted? The
|
||||
- # unescaping here is odd because the
|
||||
- # 'set' above has already eaten
|
||||
- # backslash-escapes.
|
||||
- title="$(echo "$@" | sed -n "s/[^']*'\(.*\)'.*/\1/p" | sed "s/'''/'/; s/://g")"
|
||||
- fi
|
||||
+ set -f
|
||||
+ eval "set -- $line"
|
||||
+ set +f
|
||||
+ title="$2"
|
||||
if [ -z "$title" ]; then
|
||||
ignore_item=1
|
||||
- elif echo "$title" | grep -q '(on /dev/[^)]*)$'; then
|
||||
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
|
||||
+ elif echo "$title" | grep -q '(.* /dev/[^)]*)$'; then
|
||||
+ # 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 menu.lst"
|
||||
+ log "appears to be an automatic reference taken from another grub.cfg"
|
||||
ignore_item=1
|
||||
fi
|
||||
;;
|
||||
- linux)
|
||||
+ linux[" "]*)
|
||||
+ # And here we do NOT want to strip off
|
||||
+ # existing quting, which will be transferred
|
||||
+ # verbatim in new grub.cfg
|
||||
+ set -f
|
||||
+ set -- $line
|
||||
+ set +f
|
||||
# Hack alert: sed off any (hdn,n) but
|
||||
# assume the kernel is on the same
|
||||
# partition.
|
||||
@@ -73,7 +83,13 @@ parse_grub_menu () {
|
||||
kernel="/boot$kernel"
|
||||
fi
|
||||
;;
|
||||
- initrd)
|
||||
+ initrd[" "]*)
|
||||
+ # And here we do NOT want to strip off
|
||||
+ # existing quting, which will be transferred
|
||||
+ # verbatim in new grub.cfg
|
||||
+ set -f
|
||||
+ set -- $line
|
||||
+ set +f
|
||||
initrd="$(echo "$2" | sed 's/(.*)//')"
|
||||
# Initrd same.
|
||||
if [ "$partition" != "$bootpart" ]; then
|
||||
@@ -89,11 +105,20 @@ parse_grub_menu () {
|
||||
entry_result
|
||||
}
|
||||
|
||||
-if [ -e "$mpoint/boot/grub/grub.cfg" ] && \
|
||||
+grubcfg=
|
||||
+if [ -e "$mpoint/boot/grub2-efi/grub.cfg" ]; then
|
||||
+ grubcfg="$mpoint/boot/grub2-efi/grub.cfg"
|
||||
+elif [ -e "$mpoint/boot/grub2/grub.cfg" ]; then
|
||||
+ grubcfg="$mpoint/boot/grub2/grub.cfg"
|
||||
+elif [ -e "$mpoint/boot/grub/grub.cfg" ]; then
|
||||
+ grubcfg="$mpoint/boot/grub/grub.cfg"
|
||||
+fi
|
||||
+
|
||||
+if [ -n "$grubcfg" ] && \
|
||||
([ ! -e "$mpoint/boot/grub/menu.lst" ] || \
|
||||
- [ "$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"
|
||||
+ [ "$grubcfg" -nt "$mpoint/boot/grub/menu.lst" ]); then
|
||||
+ debug "parsing $grubcfg"
|
||||
+ parse_grub_menu "$mpoint" "$partition" "$bootpart" < "$grubcfg"
|
||||
fi
|
||||
|
||||
if [ "$found_item" = 0 ]; then
|
||||
@@ -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"
|
||||
|
@ -11,55 +11,10 @@ but cannot be performed.
|
||||
|
||||
This may likely fix bnc#767272
|
||||
|
||||
Index: os-prober/common.sh
|
||||
Index: os-prober-1.57/os-probes/init/common/10filesystems
|
||||
===================================================================
|
||||
--- os-prober.orig/common.sh
|
||||
+++ os-prober/common.sh
|
||||
@@ -259,8 +259,8 @@ linux_mount_boot () {
|
||||
debug "found boot partition $1 for linux system on $partition, but cannot map to existing device"
|
||||
else
|
||||
debug "found boot partition $bootpart for linux system on $partition"
|
||||
- if which grub-mount >/dev/null 2>&1 && \
|
||||
- grub-mount "$boottomnt" "$tmpmnt/boot" 2>/dev/null; then
|
||||
+ if which grub2-mount >/dev/null 2>&1 && \
|
||||
+ grub2-mount "$boottomnt" "$tmpmnt/boot" 2>/dev/null; then
|
||||
mounted=1
|
||||
else
|
||||
ro_partition "$boottomnt"
|
||||
Index: os-prober/linux-boot-probes/common/50mounted-tests
|
||||
===================================================================
|
||||
--- os-prober.orig/linux-boot-probes/common/50mounted-tests
|
||||
+++ os-prober/linux-boot-probes/common/50mounted-tests
|
||||
@@ -34,8 +34,8 @@ if [ ! -d "$tmpmnt" ]; then
|
||||
fi
|
||||
|
||||
mounted=
|
||||
-if which grub-mount >/dev/null 2>&1 && \
|
||||
- grub-mount "$partition" "$tmpmnt" 2>/dev/null; then
|
||||
+if which grub2-mount >/dev/null 2>&1 && \
|
||||
+ grub2-mount "$partition" "$tmpmnt" 2>/dev/null; then
|
||||
mounted=1
|
||||
type=fuseblk
|
||||
else
|
||||
Index: os-prober/os-probes/common/50mounted-tests
|
||||
===================================================================
|
||||
--- os-prober.orig/os-probes/common/50mounted-tests
|
||||
+++ os-prober/os-probes/common/50mounted-tests
|
||||
@@ -49,8 +49,8 @@ if [ ! -d "$tmpmnt" ]; then
|
||||
fi
|
||||
|
||||
mounted=
|
||||
-if which grub-mount >/dev/null 2>&1 && \
|
||||
- grub-mount "$partition" "$tmpmnt" 2>/dev/null; then
|
||||
+if which grub2-mount >/dev/null 2>&1 && \
|
||||
+ grub2-mount "$partition" "$tmpmnt" 2>/dev/null; then
|
||||
debug "mounted using GRUB"
|
||||
mounted=1
|
||||
type=fuseblk
|
||||
Index: os-prober/os-probes/init/common/10filesystems
|
||||
===================================================================
|
||||
--- os-prober.orig/os-probes/init/common/10filesystems
|
||||
+++ os-prober/os-probes/init/common/10filesystems
|
||||
--- os-prober-1.57.orig/os-probes/init/common/10filesystems
|
||||
+++ os-prober-1.57/os-probes/init/common/10filesystems
|
||||
@@ -3,7 +3,7 @@
|
||||
set +e # ignore errors from modprobe
|
||||
|
||||
@ -69,3 +24,58 @@ Index: os-prober/os-probes/init/common/10filesystems
|
||||
FILESYSTEMS="$FILESYSTEMS fuse"
|
||||
# The Ubuntu kernel udebs put a number of filesystem modules in
|
||||
# fs-{core,secondary}-modules. It's fairly cheap to check for these too.
|
||||
Index: os-prober-1.57/common.sh
|
||||
===================================================================
|
||||
--- os-prober-1.57.orig/common.sh
|
||||
+++ os-prober-1.57/common.sh
|
||||
@@ -259,8 +259,8 @@ linux_mount_boot () {
|
||||
debug "found boot partition $1 for linux system on $partition, but cannot map to existing device"
|
||||
else
|
||||
debug "found boot partition $bootpart for linux system on $partition"
|
||||
- if type grub-mount >/dev/null 2>&1 && \
|
||||
- grub-mount "$boottomnt" "$tmpmnt/boot" 2>/dev/null; then
|
||||
+ if type grub2-mount >/dev/null 2>&1 && \
|
||||
+ grub2-mount "$boottomnt" "$tmpmnt/boot" 2>/dev/null; then
|
||||
mounted=1
|
||||
else
|
||||
ro_partition "$boottomnt"
|
||||
Index: os-prober-1.57/linux-boot-probes/common/50mounted-tests
|
||||
===================================================================
|
||||
--- os-prober-1.57.orig/linux-boot-probes/common/50mounted-tests
|
||||
+++ os-prober-1.57/linux-boot-probes/common/50mounted-tests
|
||||
@@ -34,11 +34,11 @@ if [ ! -d "$tmpmnt" ]; then
|
||||
fi
|
||||
|
||||
mounted=
|
||||
-if type grub-mount >/dev/null 2>&1 && \
|
||||
- type grub-probe >/dev/null 2>&1 && \
|
||||
- grub-mount "$partition" "$tmpmnt" 2>/dev/null; then
|
||||
+if type grub2-mount >/dev/null 2>&1 && \
|
||||
+ type grub2-probe >/dev/null 2>&1 && \
|
||||
+ grub2-mount "$partition" "$tmpmnt" 2>/dev/null; then
|
||||
mounted=1
|
||||
- type="$(grub-probe -d "$partition" -t fs)"
|
||||
+ type="$(grub2-probe -d "$partition" -t fs)"
|
||||
[ "$type" ] || type=fuseblk
|
||||
else
|
||||
ro_partition "$partition"
|
||||
Index: os-prober-1.57/os-probes/common/50mounted-tests
|
||||
===================================================================
|
||||
--- os-prober-1.57.orig/os-probes/common/50mounted-tests
|
||||
+++ os-prober-1.57/os-probes/common/50mounted-tests
|
||||
@@ -49,11 +49,11 @@ if [ ! -d "$tmpmnt" ]; then
|
||||
fi
|
||||
|
||||
mounted=
|
||||
-if type grub-mount >/dev/null 2>&1 && \
|
||||
- type grub-probe >/dev/null 2>&1 && \
|
||||
- grub-mount "$partition" "$tmpmnt" 2>/dev/null; then
|
||||
+if type grub2-mount >/dev/null 2>&1 && \
|
||||
+ type grub2-probe >/dev/null 2>&1 && \
|
||||
+ grub2-mount "$partition" "$tmpmnt" 2>/dev/null; then
|
||||
mounted=1
|
||||
- type="$(grub-probe -d "$partition" -t fs)" || true
|
||||
+ type="$(grub2-probe -d "$partition" -t fs)" || true
|
||||
if [ "$type" ]; then
|
||||
debug "mounted using GRUB $type filesystem driver"
|
||||
else
|
||||
|
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-1.61/os-probes/mounted/x86/efi/10elilo
|
||||
===================================================================
|
||||
--- os-prober-1.61.orig/os-probes/mounted/x86/efi/10elilo
|
||||
+++ os-prober-1.61/os-probes/mounted/x86/efi/10elilo
|
||||
@@ -11,7 +11,8 @@ elilo=`find $1 -name "elilo.efi"`
|
||||
if [ -n "$elilo" ]; then
|
||||
bdir=`dirname $elilo`
|
||||
bdir=`basename $bdir`
|
||||
- long="ELILO Boot Manager"
|
||||
+ vendor=$(echo $bdir | sed 's|SuSE|SUSE|')
|
||||
+ long="${vendor} ELILO Boot Manager"
|
||||
short="ELILO"
|
||||
path=${bdir}/elilo.efi
|
||||
found=true
|
||||
Index: os-prober-1.61/os-probes/mounted/x86/05efi
|
||||
===================================================================
|
||||
--- os-prober-1.61.orig/os-probes/mounted/x86/05efi
|
||||
+++ os-prober-1.61/os-probes/mounted/x86/05efi
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/bin/sh
|
||||
-# Detects all Microsoft OSes on a collection of partitions.
|
||||
+# Detects all UEFI bootloaders on EFI System Partition
|
||||
|
||||
. /usr/share/os-prober/common.sh
|
||||
|
@ -1,8 +1,8 @@
|
||||
Index: os-prober/os-probes/mounted/common/90linux-distro
|
||||
Index: os-prober-1.57/os-probes/mounted/common/90linux-distro
|
||||
===================================================================
|
||||
--- os-prober.orig/os-probes/mounted/common/90linux-distro
|
||||
+++ os-prober/os-probes/mounted/common/90linux-distro
|
||||
@@ -80,7 +80,7 @@ if ls "$dir"/lib*/ld*.so* >/dev/null 2>/
|
||||
--- 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
|
||||
|
418
os-prober-btrfsfix.patch
Normal file
418
os-prober-btrfsfix.patch
Normal file
@ -0,0 +1,418 @@
|
||||
Index: os-prober-1.57/common.sh
|
||||
===================================================================
|
||||
--- os-prober-1.57.orig/common.sh
|
||||
+++ os-prober-1.57/common.sh
|
||||
@@ -125,6 +125,7 @@ parse_proc_mounts () {
|
||||
done
|
||||
}
|
||||
|
||||
+# add forth parameter to pickup btrfs subvol info
|
||||
parsefstab () {
|
||||
while read -r line; do
|
||||
case "$line" in
|
||||
@@ -135,12 +136,22 @@ parsefstab () {
|
||||
set -f
|
||||
set -- $line
|
||||
set +f
|
||||
- printf '%s %s %s\n' "$1" "$2" "$3"
|
||||
+ printf '%s %s %s %s\n' "$1" "$2" "$3" "$4"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
+#check_btrfs_mounted $bootsv $bootuuid)
|
||||
+check_btrfs_mounted () {
|
||||
+ bootsv="$1"
|
||||
+ bootuuid="$2"
|
||||
+ bootdev=$(blkid | grep "$bootuuid" | cut -d ':' -f 1)
|
||||
+ bindfrom=$(grep " btrfs " /proc/self/mountinfo |
|
||||
+ grep " $bootdev " | grep " /$bootsv " | cut -d ' ' -f 5)
|
||||
+ printf "%s" "$bindfrom"
|
||||
+}
|
||||
+
|
||||
unescape_mount () {
|
||||
printf %s "$1" | \
|
||||
sed 's/\\011/ /g; s/\\012/\n/g; s/\\040/ /g; s/\\134/\\/g'
|
||||
Index: os-prober-1.57/linux-boot-prober
|
||||
===================================================================
|
||||
--- os-prober-1.57.orig/linux-boot-prober
|
||||
+++ os-prober-1.57/linux-boot-prober
|
||||
@@ -5,16 +5,143 @@ set -e
|
||||
|
||||
newns "$@"
|
||||
require_tmpdir
|
||||
+ERR="n"
|
||||
+
|
||||
+tmpmnt=/var/lib/os-prober/mount
|
||||
+if [ ! -d "$tmpmnt" ]; then
|
||||
+ mkdir "$tmpmnt"
|
||||
+fi
|
||||
+
|
||||
+mounted=
|
||||
+bootmnt=
|
||||
+bootsv=
|
||||
+bootuuid=
|
||||
|
||||
grep "^/dev/" /proc/mounts | parse_proc_mounts >"$OS_PROBER_TMP/mounted-map" || true
|
||||
|
||||
-partition="$1"
|
||||
+if [ -z "$1" ]; then
|
||||
+ ERR=y
|
||||
+elif [ "$1" = btrfs -a -z "$2" ]; then
|
||||
+ ERR=y
|
||||
+elif [ "$1" = btrfs -a -z "$3" ]; then
|
||||
+ ERR=y
|
||||
+elif [ "$1" = btrfs ]; then
|
||||
+ type=btrfs
|
||||
+ echo "$2" | grep -q "^UUID=" || ERR=y
|
||||
+ echo "$3" | grep -q "^subvol=" || ERR=y
|
||||
+ export "$2"
|
||||
+ export "$3"
|
||||
+ partition=$(blkid | grep "$UUID" | cut -d ':' -f 1 | tr '\n' ' ' | cut -d ' ' -f 1)
|
||||
+ debug "btrfs: partition=$partition, UUID=$UUID, subvol=$subvol"
|
||||
+else
|
||||
+ partition="$1"
|
||||
+ type=other
|
||||
+fi
|
||||
|
||||
-if [ -z "$partition" ]; then
|
||||
+if [ "x$ERR" != xn ]; then
|
||||
echo "usage: linux-boot-prober partition" >&2
|
||||
+ echo " linux-boot-prober partition | btrfs UUID=<> subvol=<>" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
+if [ "$type" = btrfs ]; then
|
||||
+ # handle all of the btrfs stuff here
|
||||
+ if [ ! -e "/proc/self/mountinfo" ]; then
|
||||
+ warn "/proc/self/mountinfo does not exist, exiting"
|
||||
+ umount "$tmpmnt" 2>/dev/null
|
||||
+ rmdir "$tmpmnt" 2>/dev/null
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ mpoint=$(grep "btrfs" /proc/self/mountinfo | grep " /$subvol " | grep " $partition " | cut -d ' ' -f 5)
|
||||
+ if [ "$mpoint" = "/" ]; then
|
||||
+ warn "specifying active root not valid, exiting"
|
||||
+ umount "$tmpmnt" 2>/dev/null
|
||||
+ rmdir "$tmpmnt" 2>/dev/null
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ if [ "$mpoint" = "$tmpmnt" ]; then
|
||||
+ warn "btrfs subvol=$subvool, UUID=$UUID, already mounted on $tmpmnt **ERROR**"
|
||||
+ umount "$tmpmnt" 2>/dev/null
|
||||
+ rmdir "$tmpmnt" 2>/dev/null
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ if [ -z "$mpoint" ]; then
|
||||
+ # mount the btrfs root
|
||||
+ if ! mount -o subvol=$subvol -t btrfs -U $UUID "$tmpmnt" 2>/dev/null; then
|
||||
+ warn "error mounting btrfs subvol=$subvol UUID=$UUID"
|
||||
+ umount "$tmpmnt/boot" 2>/dev/null
|
||||
+ umount "$tmpmnt" 2>/dev/null
|
||||
+ rmdir "$tmpmnt" 2>/dev/null
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ else
|
||||
+ # bind-mount
|
||||
+ if ! mount -o bind "$mpoint" "$tmpmnt" 2>/dev/null; then
|
||||
+ warn "error mounting btrfs bindfrom=$mpoint subvol=$subvol UUID=$UUID"
|
||||
+ umount "$tmpmnt/boot" 2>/dev/null
|
||||
+ umount "$tmpmnt" 2>/dev/null
|
||||
+ rmdir "$tmpmnt" 2>/dev/null
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ fi
|
||||
+ debug "mounted btrfs $partition, subvol=$subvol on $tmpmnt"
|
||||
+ if [ ! -e "$tmpmnt/etc/fstab" ]; then
|
||||
+ warn "btrfs subvol=$subvol not root"
|
||||
+ umount "$tmpmnt" 2>/dev/null
|
||||
+ rmdir "$tmpmnt" 2>/dev/null
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ bootmnt=$(parsefstab < "$tmpmnt/etc/fstab" | grep " /boot ") || true
|
||||
+ if [ -z "$bootmnt" ]; then
|
||||
+ # /boot is part of the root
|
||||
+ bootpart="$partition"
|
||||
+ bootsv="$subvol"
|
||||
+ elif echo "$bootmnt" | cut -d ' ' -f 3 | grep -q "btrfs"; then
|
||||
+ # separate btrfs /boot subvolume
|
||||
+ bootsv=$(echo "$bootmnt" | cut -d ' ' -f 4 | grep "^subvol=" | sed "s/subvol=//" )
|
||||
+ bootuuid=$(echo "$bootmnt" | cut -d ' ' -f 1 | grep "^UUID=" | sed "s/UUID=//" )
|
||||
+ debug "mounting btrfs $tmpmnt/boot UUID=$bootuuid subvol=$bootsv"
|
||||
+ bindfrom=$(check_btrfs_mounted $bootsv $bootuuid)
|
||||
+ if [ -n "$bindfrom" ]; then
|
||||
+ # already mounted some place
|
||||
+ if ! mount -o bind $bindfrom "$tmpmnt/boot" 2>/dev/null; then
|
||||
+ warn "error bind mounting btrfs boot subvol=$bootsv, from=$bindfrom"
|
||||
+ umount "$tmpmnt/boot" 2>/dev/null
|
||||
+ umount "$tmpmnt" 2>/dev/null
|
||||
+ rmdir "$tmpmnt" 2>/dev/null
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ elif ! mount -o subvol=$bootsv -t btrfs -U $bootuuid "$tmpmnt/boot" 2>/dev/null; then
|
||||
+ warn "error mounting btrfs boot partition subvol=$bootsv, UUID=$bootuuid"
|
||||
+ umount "$tmpmnt/boot" 2>/dev/null
|
||||
+ umount "$tmpmnt" 2>/dev/null
|
||||
+ rmdir "$tmpmnt" 2>/dev/null
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ bootpart=$(grep " btrfs " /proc/self/mountinfo | grep " /$bootsv " | cut -d ' ' -f 10)
|
||||
+ else
|
||||
+ # non-btrfs partition or logical volume
|
||||
+ linux_mount_boot $partition $tmpmnt
|
||||
+ bootpart="${mountboot%% *}"
|
||||
+ bootsv=
|
||||
+ fi
|
||||
+
|
||||
+ test="/usr/lib/linux-boot-probes/mounted/40grub2"
|
||||
+ if [ -f $test ] && [ -x $test ]; then
|
||||
+ debug "running $test $partition $bootpart $tmpmnt $type $subvol $bootsv"
|
||||
+ if $test "$partition" "$bootpart" "$tmpmnt" "$type" "$subvol" "$bootsv"; then
|
||||
+ debug "$test succeeded"
|
||||
+ fi
|
||||
+ fi
|
||||
+ umount "$tmpmnt/boot" 2>/dev/null || true
|
||||
+ if ! umount "$tmpmnt" 2>/dev/null; then
|
||||
+ warn "problem umount $tmpmnt"
|
||||
+ fi
|
||||
+ rmdir "$tmpmnt" 2>/dev/null || true
|
||||
+
|
||||
+ exit 0
|
||||
+fi
|
||||
+
|
||||
if ! mapped="$(mapdevfs "$partition")"; then
|
||||
log "Device '$partition' does not exist; skipping"
|
||||
continue
|
||||
Index: os-prober-1.57/linux-boot-probes/mounted/common/40grub2
|
||||
===================================================================
|
||||
--- os-prober-1.57.orig/linux-boot-probes/mounted/common/40grub2
|
||||
+++ os-prober-1.57/linux-boot-probes/mounted/common/40grub2
|
||||
@@ -2,17 +2,27 @@
|
||||
. /usr/share/os-prober/common.sh
|
||||
set -e
|
||||
|
||||
+# add support for btrfs with no separate /boot
|
||||
+# that is, rootsv = bootsv
|
||||
partition="$1"
|
||||
bootpart="$2"
|
||||
mpoint="$3"
|
||||
type="$4"
|
||||
+rootsv="$5"
|
||||
+bootsv="$6"
|
||||
|
||||
found_item=0
|
||||
|
||||
entry_result () {
|
||||
+ if [ "x$type" = "xbtrfs" -a "$rootsv" = "$bootsv" ]; then
|
||||
+ # trim off the leading subvol
|
||||
+ kernelfile=$(echo "$kernel" | cut -d '/' -f 2- | cut -d '/' -f 2-)
|
||||
+ else
|
||||
+ kernelfile=$kernel
|
||||
+ fi
|
||||
if [ "$ignore_item" = 0 ] && \
|
||||
[ -n "$kernel" ] && \
|
||||
- [ -e "$mpoint/$kernel" ]; then
|
||||
+ [ -e "$mpoint/$kernelfile" ]; then
|
||||
result "$rootpart:$bootpart:$title:$kernel:$initrd:$parameters"
|
||||
found_item=1
|
||||
fi
|
||||
Index: os-prober-1.57/os-prober
|
||||
===================================================================
|
||||
--- os-prober-1.57.orig/os-prober
|
||||
+++ os-prober-1.57/os-prober
|
||||
@@ -67,6 +67,9 @@ partitions () {
|
||||
echo "$(LVM_SUPPRESS_FD_WARNINGS=1 log_output lvs --noheadings --separator : -o vg_name,lv_name |
|
||||
sed "s|-|--|g;s|^[[:space:]]*\(.*\):\(.*\)$|/dev/mapper/\1-\2|")"
|
||||
fi
|
||||
+
|
||||
+ # now lets make sure we got all of the btrfs partitions and disks
|
||||
+ blkid | grep btrfs | cut -d ':' -f 1
|
||||
}
|
||||
|
||||
parse_proc_swaps () {
|
||||
@@ -125,6 +128,8 @@ if [ -f /proc/mdstat ] ; then
|
||||
grep "^md" /proc/mdstat | parse_proc_mdstat >"$OS_PROBER_TMP/raided-map" || true
|
||||
fi
|
||||
|
||||
+: >"$OS_PROBER_TMP/btrfs-vols"
|
||||
+
|
||||
for partition in $(partitions); do
|
||||
if ! mapped="$(mapdevfs "$partition")"; then
|
||||
log "Device '$partition' does not exist; skipping"
|
||||
@@ -143,7 +148,26 @@ for partition in $(partitions); do
|
||||
continue
|
||||
fi
|
||||
|
||||
- if ! grep -q "^$mapped " "$OS_PROBER_TMP/mounted-map" ; then
|
||||
+ # do btrfs processing here; both mounted and unmounted will
|
||||
+ # be handled by 50mounted-tests so we can do a subvol only once.
|
||||
+ type=$(blkid -o value -s TYPE $mapped || true)
|
||||
+ if [ "$type" = btrfs ]; then
|
||||
+ uuid=$(blkid -o value -s UUID $mapped)
|
||||
+ if grep -q "^$uuid" "$OS_PROBER_TMP/btrfs-vols" ; then
|
||||
+ continue
|
||||
+ fi
|
||||
+ debug "btrfs volume uuid=$uuid partition=$partition"
|
||||
+ echo "$uuid" >>"$OS_PROBER_TMP/btrfs-vols"
|
||||
+ test="/usr/lib/os-probes/50mounted-tests"
|
||||
+ if [ -f "$test" ] && [ -x "$test" ]; then
|
||||
+ debug "running $test on btrfs $partition"
|
||||
+ if "$test" btrfs "$uuid" "$partition"; then
|
||||
+ debug "os detected by $test"
|
||||
+ continue
|
||||
+ fi
|
||||
+ fi
|
||||
+
|
||||
+ elif ! grep -q "^$mapped " "$OS_PROBER_TMP/mounted-map" ; then
|
||||
for test in /usr/lib/os-probes/*; do
|
||||
if [ -f "$test" ] && [ -x "$test" ]; then
|
||||
debug "running $test on $partition"
|
||||
Index: os-prober-1.57/os-probes/common/50mounted-tests
|
||||
===================================================================
|
||||
--- os-prober-1.57.orig/os-probes/common/50mounted-tests
|
||||
+++ os-prober-1.57/os-probes/common/50mounted-tests
|
||||
@@ -5,7 +5,19 @@ partition="$1"
|
||||
|
||||
. /usr/share/os-prober/common.sh
|
||||
|
||||
-types="$(fs_type "$partition")" || types=NOT-DETECTED
|
||||
+if [ "x$1" = xbtrfs ]; then
|
||||
+ types=btrfs
|
||||
+ if [ -z "$2" -o -z "$3" ]; then
|
||||
+ debug "missing btrfs parameters, exiting"
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ UUID="$2"
|
||||
+ BTRFSDEV="$3"
|
||||
+else
|
||||
+ partition="$1"
|
||||
+ types="$(fs_type "$partition")" || types=NOT-DETECTED
|
||||
+fi
|
||||
+
|
||||
if [ "$types" = NOT-DETECTED ]; then
|
||||
debug "$1 type not recognised; skipping"
|
||||
exit 0
|
||||
@@ -49,6 +61,76 @@ if [ ! -d "$tmpmnt" ]; then
|
||||
fi
|
||||
|
||||
mounted=
|
||||
+
|
||||
+# all btrfs processing here. Handle both unmounted and
|
||||
+# mounted subvolumes.
|
||||
+if [ "$types" = btrfs ]; then
|
||||
+ partition="$BTRFSDEV"
|
||||
+ debug "begin btrfs processing for $UUID"
|
||||
+ # note that the btrfs volume must not be mounted ro
|
||||
+ if mount -t btrfs -U "$UUID" "$tmpmnt" 2>/dev/null; then
|
||||
+ debug "btrfs volume $UUID mounted"
|
||||
+ else
|
||||
+ warn "cannot mount btrfs volume $UUID, exiting"
|
||||
+ rmdir "$tmpmnt" || true
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ # besides regular subvols, get ro and snapshot so thet can be excluded
|
||||
+ subvols=$(btrfs subvolume list "$tmpmnt" | cut -d ' ' -f 9)
|
||||
+ rosubvols=$(btrfs subvolume list -r "$tmpmnt" | cut -d ' ' -f 9)
|
||||
+ sssubvols=$(btrfs subvolume list -s "$tmpmnt" | cut -d ' ' -f 9)
|
||||
+ if ! umount "$tmpmnt"; then
|
||||
+ warn "failed to umount btrfs volume on $tmpmnt"
|
||||
+ rmdir "$tmpmnt" || true
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ if [ -z "$subvols" ]; then
|
||||
+ debug "no subvols found on btrfs volume $UUID"
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ found=
|
||||
+ for subvol in $subvols; do
|
||||
+ debug "begin btrfs processing for $UUID subvol=$subvol"
|
||||
+ if echo "$rosubvols" | grep -q -x "$subvol"; then
|
||||
+ continue
|
||||
+ fi
|
||||
+ if echo "$sssubvols" | grep -q -x "$subvol"; then
|
||||
+ continue
|
||||
+ fi
|
||||
+ mounted=
|
||||
+ mpoint="$(grep btrfs /proc/self/mountinfo | grep "$partition " | grep "/$subvol " | cut -d ' ' -f 5)"
|
||||
+ if [ -n "$mpoint" ]; then
|
||||
+ if [ "x$mpoint" = "x/" ]; then
|
||||
+ continue # this is the root for the running system
|
||||
+ fi
|
||||
+ mounted=1
|
||||
+ else
|
||||
+ # again, do not mount btrfs ro
|
||||
+ mount -t btrfs -o subvol="$subvol" -U "$UUID" "$tmpmnt"
|
||||
+ mpoint="$tmpmnt"
|
||||
+ fi
|
||||
+ test="/usr/lib/os-probes/mounted/90linux-distro"
|
||||
+ if [ -f "$test" ] && [ -x "$test" ]; then
|
||||
+ debug "running subtest $test"
|
||||
+ if "$test" "$partition" "$mpoint" btrfs "UUID=$UUID" "subvol=$subvol"; then
|
||||
+ debug "os found by subtest $test on subvol $subvol"
|
||||
+ found=1
|
||||
+ fi
|
||||
+ fi
|
||||
+ if [ -z "$mounted" ]; then
|
||||
+ if ! umount "$tmpmnt"; then
|
||||
+ warn "failed to umount $tmpmnt"
|
||||
+ fi
|
||||
+ fi
|
||||
+ done
|
||||
+ rmdir "$tmpmnt" || true
|
||||
+ if [ "$found" ]; then
|
||||
+ exit 0
|
||||
+ else
|
||||
+ exit 1
|
||||
+ fi
|
||||
+fi
|
||||
+
|
||||
if type grub2-mount >/dev/null 2>&1 && \
|
||||
type grub2-probe >/dev/null 2>&1 && \
|
||||
grub2-mount "$partition" "$tmpmnt" 2>/dev/null; then
|
||||
Index: os-prober-1.57/os-probes/mounted/common/90linux-distro
|
||||
===================================================================
|
||||
--- os-prober-1.57.orig/os-probes/mounted/common/90linux-distro
|
||||
+++ os-prober-1.57/os-probes/mounted/common/90linux-distro
|
||||
@@ -7,6 +7,8 @@ set -e
|
||||
partition="$1"
|
||||
dir="$2"
|
||||
type="$3"
|
||||
+uuid="$4"
|
||||
+subvol="$5"
|
||||
|
||||
# This test is inaccurate, but given separate / and /boot partitions and the
|
||||
# fact that only some architectures have ld-linux.so, I can't see anything
|
||||
@@ -131,7 +133,11 @@ if (ls "$dir"/lib*/ld*.so* || ls "$dir"/
|
||||
fi
|
||||
|
||||
label="$(count_next_label "$short")"
|
||||
- result "$partition:$long:$label:linux"
|
||||
+ if [ "x$type" = "xbtrfs" -a "x$uuid" != "x" -a "x$subvol" != "x" ]; then
|
||||
+ result "$partition:$long:$label:linux:$type:$uuid:$subvol"
|
||||
+ else
|
||||
+ result "$partition:$long:$label:linux"
|
||||
+ fi
|
||||
exit 0
|
||||
else
|
||||
exit 1
|
||||
Index: os-prober-1.57/README.btrfs
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ os-prober-1.57/README.btrfs
|
||||
@@ -0,0 +1,15 @@
|
||||
+BTRFS is a new filesystem which combines the filesystem with logical volume
|
||||
+management (subvolumes). For further information, see:
|
||||
+ https://btrfs.wiki.kernel.org/index.php/Main_Page
|
||||
+ https://btrfs.wiki.kernel.org/index.php/FAQ
|
||||
+
|
||||
+In order to support BTRFS, a number of changes were necessary to os-prober,
|
||||
+os-probes/common/50mounted-tests, os-probes/mounted/common/90linux-distro,
|
||||
+linux-boot-prober, and linux-boot-probes/common/50mounted-tests.
|
||||
+
|
||||
+The biggest impact will be to grub2 where there is additional information
|
||||
+output by os-prober and where, if a BTRFS subvolume is being used for root,
|
||||
+the parameters for linux-boot-prober have changed.
|
||||
+
|
||||
+Sun 30 Dec 2012 11:49:52 AM EST Gene Czarcinski <gene@czarc.net>
|
||||
+
|
@ -5,25 +5,25 @@ 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/linux-boot-probes/mounted/common/40grub2
|
||||
Index: os-prober-1.61/linux-boot-probes/mounted/common/40grub2
|
||||
===================================================================
|
||||
--- os-prober.orig/linux-boot-probes/mounted/common/40grub2
|
||||
+++ os-prober/linux-boot-probes/mounted/common/40grub2
|
||||
@@ -64,7 +64,7 @@ parse_grub_menu () {
|
||||
--- 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[" "]*)
|
||||
# And here we do NOT want to strip off
|
||||
# existing quting, which will be transferred
|
||||
# verbatim in new grub.cfg
|
||||
@@ -83,7 +83,7 @@ parse_grub_menu () {
|
||||
- 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[" "]*)
|
||||
# And here we do NOT want to strip off
|
||||
# existing quting, which will be transferred
|
||||
# verbatim in new grub.cfg
|
||||
- initrd)
|
||||
+ initrd|initrdefi)
|
||||
initrd="$(echo "$2" | sed 's/(.*)//')"
|
||||
# Initrd same.
|
||||
if [ "$partition" != "$bootpart" ]; then
|
||||
|
@ -1,7 +1,7 @@
|
||||
Index: os-prober/os-prober
|
||||
Index: os-prober-1.61/os-prober
|
||||
===================================================================
|
||||
--- os-prober.orig/os-prober
|
||||
+++ os-prober/os-prober
|
||||
--- os-prober-1.61.orig/os-prober
|
||||
+++ os-prober-1.61/os-prober
|
||||
@@ -39,6 +39,11 @@ partitions () {
|
||||
fi
|
||||
done
|
||||
@ -22,5 +22,5 @@ Index: os-prober/os-prober
|
||||
+ # Only add MD slaves to the list
|
||||
+ while read md line; do
|
||||
for word in $line; do
|
||||
dev="${word%%[*}"
|
||||
dev="${word%%\[*}"
|
||||
# TODO: factor this out to something in di-utils if
|
||||
|
@ -1,31 +0,0 @@
|
||||
From: Andrey Borzenkov <arvidjaar@gmail.com>
|
||||
Date: Fri Jan 4 09:46:56 UTC 2013
|
||||
Subject: skip legacy Microsoft bootloader on UEFI system
|
||||
|
||||
References: bnc#775610
|
||||
Patch-Mainline: no
|
||||
|
||||
Sometimes Windows installs both legacy BIOS and UEFI bootloaders.
|
||||
Attempt to chainload legacy bootloader on UEFI system fails. Skip
|
||||
adding legacy bootloader in this case.
|
||||
|
||||
TODO: this probably should be implemented as runtime check. But it
|
||||
does the right thing in majority of cases. If mixed legacy/UEFI
|
||||
boot will be used frequently, it can be revisited.
|
||||
Index: os-prober/os-probes/mounted/x86/20microsoft
|
||||
===================================================================
|
||||
--- os-prober.orig/os-probes/mounted/x86/20microsoft
|
||||
+++ os-prober/os-probes/mounted/x86/20microsoft
|
||||
@@ -7,6 +7,12 @@ partition="$1"
|
||||
mpoint="$2"
|
||||
type="$3"
|
||||
|
||||
+# This script looks for legacy BIOS bootloaders only. Skip if running UEFI
|
||||
+if [ -d /sys/firmware/efi ]; then
|
||||
+ debug "Skipping legacy bootloaders on UEFI system"
|
||||
+ exit 1
|
||||
+fi
|
||||
+
|
||||
# Weed out stuff that doesn't apply to us
|
||||
case "$type" in
|
||||
ntfs|ntfs-3g) debug "$1 is a NTFS partition" ;;
|
@ -1,22 +0,0 @@
|
||||
From: Andrey Borzenkov <arvidjaar@gmail.com>
|
||||
Subject: fix detection of distributions with /lib => /usr/lib symlink
|
||||
Upstream: yes
|
||||
|
||||
grub-mount does not implement symbolic links, so distributions
|
||||
that replaced /lib with /usr/lib were not detected. Check both
|
||||
/lib and /usr/lib. Patch taken from upstream version.
|
||||
|
||||
Affected is e.g. Fedora 18.
|
||||
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
|
||||
@@ -13,7 +13,7 @@ type="$3"
|
||||
# better. Make sure this test has a high number so that more accurate tests
|
||||
# can come first.
|
||||
# TODO: look for ld-linux.so on arches that have it
|
||||
-if ls "$dir"/lib*/ld*.so* >/dev/null 2>/dev/null; then
|
||||
+if (ls "$dir"/lib*/ld*.so* || ls "$dir"/usr/lib*/ld*.so*) >/dev/null 2>/dev/null; then
|
||||
if [ -e "$dir/etc/debian_version" ]; then
|
||||
short="Debian"
|
||||
long="$(printf "Debian GNU/Linux (%s)\n" "$(cat "$dir/etc/debian_version")")"
|
@ -1,3 +1,28 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri May 31 10:26:48 UTC 2013 - arvidjaar@gmail.com
|
||||
|
||||
- update to os-prober 1.61. Highlights:
|
||||
* Fix detection of Fedora and other distros that moved /lib into /usr
|
||||
* sed off (hdn,n) from the front of an initrd path
|
||||
* Add support to detect BSD systems
|
||||
* add support for probing EFI System Partition
|
||||
- rediff
|
||||
* os-prober-1.49-fix-grub2.cfg-parsing.patch - part implemented
|
||||
differenty upstream; added additional os-prober entries detection based
|
||||
on menu entry ID as suggested by Vladimir Serbienko
|
||||
* os-prober-1.49-grub2-mount.patch
|
||||
* os-prober-SUSE.patch
|
||||
* os-prober-linux-secure-boot.patch
|
||||
- drop upstream patches
|
||||
* os-prober-usr_lib-detection.patch
|
||||
* os-prober-skip-MS-legacy-on-UEFI.patch together with 05efi, efi-20microsoft,
|
||||
efi-10elilo
|
||||
- add
|
||||
* os-prober-btrfsfix.patch - support btrfs. Patch from Fedora with
|
||||
all unrelated changes cleaned out
|
||||
* os-prober-EFI-openSUSEfy.patch - cosmetic changes between our scripts
|
||||
and version adopted upstream
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Apr 5 16:33:28 UTC 2013 - arvidjaar@gmail.com
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
|
||||
Name: os-prober
|
||||
Version: 1.49
|
||||
Version: 1.61
|
||||
Release: 0
|
||||
Summary: Probes disks on the system for installed operating systems
|
||||
License: GPL-2.0+
|
||||
@ -26,28 +26,25 @@ Group: System/Boot
|
||||
Url: http://kitenet.net/~joey/code/os-prober/
|
||||
Source0: http://ftp.de.debian.org/debian/pool/main/o/os-prober/%{name}_%{version}.tar.gz
|
||||
Source1: COPYING-note.txt
|
||||
Source2: 05efi
|
||||
Source3: efi-20microsoft
|
||||
Source4: efi-10elilo
|
||||
# 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: Skip legacy Microsoft bootloader on UEFI [bnc#775610]
|
||||
Patch2: os-prober-skip-MS-legacy-on-UEFI.patch
|
||||
# PATCH-FIX-OPENSUSE: Fix parsing of grub.cfg [bnc#796919]
|
||||
Patch3: os-prober-1.49-fix-grub2.cfg-parsing.patch
|
||||
# PATCH-FIX-OPENSUSE: Do not try to mount LVM2 PV [bnc#798604]
|
||||
Patch4: os-prober-1.49-skip-LVM2_member.patch
|
||||
# PATCH-FIX-OPENSUSE: Use correct name for grub2-mount
|
||||
Patch5: os-prober-1.49-grub2-mount.patch
|
||||
# PATCH-FIX-OPENSUSE: Detect distributions which moved /lib to /usr/lib
|
||||
Patch6: os-prober-usr_lib-detection.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
|
||||
|
||||
Requires: /bin/grep
|
||||
Requires: /bin/sed
|
||||
@ -64,17 +61,17 @@ in a generic machine-readable format. Support for new OSes and Linux
|
||||
distributions can be added easily.
|
||||
|
||||
%prep
|
||||
%setup -q -n %{name}
|
||||
%setup -q -n %{name}-%{version}
|
||||
cp %SOURCE1 .
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
%patch5 -p1
|
||||
%patch6 -p1
|
||||
%patch7 -p1
|
||||
%patch8 -p1
|
||||
%patch9 -p1
|
||||
%patch10 -p1
|
||||
|
||||
%build
|
||||
make %{?_smp_mflags} CC="%__cc" CFLAGS="%{optflags}"
|
||||
@ -111,12 +108,6 @@ done
|
||||
if [ "$ARCH" = x86 ]; then
|
||||
install -m 755 -p os-probes/mounted/powerpc/20macosx \
|
||||
%{buildroot}%{_libexecdir}/os-probes/mounted
|
||||
install -m 755 -p %SOURCE2 %{buildroot}%{_libexecdir}/os-probes/mounted
|
||||
install -m 755 -d %{buildroot}%{_libexecdir}/os-probes/mounted/efi
|
||||
install -m 755 -p %SOURCE3 \
|
||||
%{buildroot}%{_libexecdir}/os-probes/mounted/efi/20microsoft
|
||||
install -m 755 -p %SOURCE4 \
|
||||
%{buildroot}%{_libexecdir}/os-probes/mounted/efi/10elilo
|
||||
fi
|
||||
|
||||
%files
|
||||
|
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:828118ee0792263179572f5a7669f20c787dd61e7bfb2954a34ea0d62f94fc14
|
||||
size 24422
|
3
os-prober_1.61.tar.gz
Normal file
3
os-prober_1.61.tar.gz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:2b83d037c38ca6393e1ead7d1548c59528c07b9fc1a1e07b4e1d07af03905f48
|
||||
size 28197
|
Loading…
Reference in New Issue
Block a user