public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: sys-boot/os-prober/, sys-boot/os-prober/files/
@ 2017-12-26 12:53 Pacho Ramos
  0 siblings, 0 replies; 10+ messages in thread
From: Pacho Ramos @ 2017-12-26 12:53 UTC (permalink / raw
  To: gentoo-commits

commit:     de6cdf76e3813b4cf1e916f28c1a8ad2cf9d190e
Author:     Pacho Ramos <pacho <AT> gentoo <DOT> org>
AuthorDate: Tue Dec 26 12:52:14 2017 +0000
Commit:     Pacho Ramos <pacho <AT> gentoo <DOT> org>
CommitDate: Tue Dec 26 12:53:02 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=de6cdf76

sys-boot/os-prober: grub-mount is needed (#607518), support Exherbo (#518658)

Package-Manager: Portage-2.3.19, Repoman-2.3.6

 .../os-prober/files/os-prober-1.76-exherbo.patch   | 26 +++++++
 sys-boot/os-prober/os-prober-1.76-r1.ebuild        | 86 ++++++++++++++++++++++
 2 files changed, 112 insertions(+)

diff --git a/sys-boot/os-prober/files/os-prober-1.76-exherbo.patch b/sys-boot/os-prober/files/os-prober-1.76-exherbo.patch
new file mode 100644
index 00000000000..6ef83dca223
--- /dev/null
+++ b/sys-boot/os-prober/files/os-prober-1.76-exherbo.patch
@@ -0,0 +1,26 @@
+From 09fefdb360b69c2de03a2f1c881db87f924d3c76 Mon Sep 17 00:00:00 2001
+From: Timo Gurr <timo.gurr@gmail.com>
+Date: Mon, 20 Feb 2017 17:33:14 +0100
+Subject: [PATCH] Add Exherbo Linux detection
+
+---
+ os-probes/mounted/common/90linux-distro | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/os-probes/mounted/common/90linux-distro b/os-probes/mounted/common/90linux-distro
+index badfbb1..41a5553 100755
+--- a/os-probes/mounted/common/90linux-distro
++++ b/os-probes/mounted/common/90linux-distro
+@@ -137,6 +137,9 @@ if (ls "$dir"/lib*/ld*.so* && [ -d "$dir/boot" ] || ls "$dir"/usr/lib*/ld*.so*)
+ 	elif [ -e "$dir/etc/devuan_version" ]; then
+ 		short="Devuan"
+ 		long="$(printf "Devuan GNU/Linux (%s)\n" "$(cat "$dir/etc/devuan_version")")"
++	elif [ -e "$dir/etc/exherbo-release" ]; then
++		short="Exherbo"
++		long="Exherbo Linux"
+ 	else
+ 		short="Linux"
+ 		long="unknown Linux distribution"
+-- 
+2.11.1
+

diff --git a/sys-boot/os-prober/os-prober-1.76-r1.ebuild b/sys-boot/os-prober/os-prober-1.76-r1.ebuild
new file mode 100644
index 00000000000..1baceb5af89
--- /dev/null
+++ b/sys-boot/os-prober/os-prober-1.76-r1.ebuild
@@ -0,0 +1,86 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+inherit readme.gentoo-r1 toolchain-funcs
+
+DESCRIPTION="Utility to detect other OSs on a set of drives"
+HOMEPAGE="https://packages.debian.org/source/sid/os-prober"
+SRC_URI="mirror://debian/pool/main/${PN::1}/${PN}/${PN}_${PV}.tar.xz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+# grub-mount needed per bug #607518
+RDEPEND="sys-boot/grub:2[mount]"
+DEPEND=""
+
+# bug 594250
+QA_MULTILIB_PATHS="usr/lib/os-prober/.*"
+
+PATCHES=( "${FILESDIR}"/${PN}-1.76-exherbo.patch )
+
+DOC_CONTENTS="
+	If you intend for os-prober to detect versions of Windows installed on
+	NTFS-formatted partitions, your system must be capable of reading the
+	NTFS filesystem. One way to do this is by installing sys-fs/ntfs3g
+"
+
+src_prepare() {
+	default
+	# use default GNU rules
+	rm Makefile || die 'rm Makefile failed'
+}
+
+src_compile() {
+	tc-export CC
+	emake newns
+}
+
+src_install() {
+	dobin os-prober linux-boot-prober
+
+	# Note: as no shared libraries are installed, /usr/lib is correct
+	exeinto /usr/lib/os-prober
+	doexe newns
+
+	insinto /usr/share/os-prober
+	doins common.sh
+
+	keepdir /var/lib/os-prober
+
+	local debarch=${ARCH%-*} dir
+
+	case ${debarch} in
+		amd64)		debarch=x86 ;;
+		ppc|ppc64)	debarch=powerpc ;;
+	esac
+
+	for dir in os-probes{,/mounted,/init} linux-boot-probes{,/mounted}; do
+		exeinto /usr/lib/$dir
+		doexe $dir/common/*
+		if [[ -d $dir/$debarch ]]; then
+			doexe $dir/$debarch/*
+		fi
+		if [[ -d $dir/$debarch/efi ]]; then
+			exeinto /usr/lib/$dir/efi
+			doexe $dir/$debarch/efi/*
+		fi
+	done
+
+	if use amd64 || use x86; then
+		exeinto /usr/lib/os-probes/mounted
+		doexe os-probes/mounted/powerpc/20macosx
+	fi
+
+	einstalldocs
+	dodoc debian/changelog
+
+	readme.gentoo_create_doc
+}
+
+pkg_postinst() {
+	readme.gentoo_print_elog
+}


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-boot/os-prober/, sys-boot/os-prober/files/
@ 2021-10-08 11:12 Ben Kohler
  0 siblings, 0 replies; 10+ messages in thread
From: Ben Kohler @ 2021-10-08 11:12 UTC (permalink / raw
  To: gentoo-commits

commit:     5023585e4f13834627b835125d7c6f9dee62f21a
Author:     Peter Levine <plevine457 <AT> gmail <DOT> com>
AuthorDate: Fri Oct  8 01:31:47 2021 +0000
Commit:     Ben Kohler <bkohler <AT> gentoo <DOT> org>
CommitDate: Fri Oct  8 11:12:19 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5023585e

sys-boot/os-prober: return boot instead of root if both are mounted

Fixes a corner-case in which the root partition is returned instead of
the boot partition, when both are mounted.

Package-Manager: Portage-3.0.26, Repoman-3.0.3
Signed-off-by: Peter Levine <plevine457 <AT> gmail.com>
Signed-off-by: Ben Kohler <bkohler <AT> gentoo.org>

 .../os-prober-1.79-mounted-boot-partition-fix.patch     | 17 +++++++++++++++++
 sys-boot/os-prober/os-prober-9999.ebuild                |  1 +
 2 files changed, 18 insertions(+)

diff --git a/sys-boot/os-prober/files/os-prober-1.79-mounted-boot-partition-fix.patch b/sys-boot/os-prober/files/os-prober-1.79-mounted-boot-partition-fix.patch
new file mode 100644
index 00000000000..1be8c810ddf
--- /dev/null
+++ b/sys-boot/os-prober/files/os-prober-1.79-mounted-boot-partition-fix.patch
@@ -0,0 +1,17 @@
+Fixes the problem of the root partition being returned instead of the boot
+partition when both are already mounted somewhere.
+
+Bug: https://bugs.debian.org/699840
+     https://bugzilla.redhat.com/906886
+
+--- a/linux-boot-prober
++++ b/linux-boot-prober
+@@ -167,7 +167,7 @@ else
+ 			bootpart="${mountboot%% *}"
+ 			bootmounted="${mountboot#* }"
+ 		else
+-			bootpart="$partition"
++			bootpart="$(grep " $mpoint/boot " "$OS_PROBER_TMP/mounted-map" | head -n1 | cut -d " " -f 4)"
+ 			bootmounted=0
+ 		fi
+ 		for test in /usr/lib/linux-boot-probes/mounted/*; do

diff --git a/sys-boot/os-prober/os-prober-9999.ebuild b/sys-boot/os-prober/os-prober-9999.ebuild
index 392bf080566..59539158759 100644
--- a/sys-boot/os-prober/os-prober-9999.ebuild
+++ b/sys-boot/os-prober/os-prober-9999.ebuild
@@ -29,6 +29,7 @@ PATCHES=(
 	"${FILESDIR}"/${PN}-1.79-mdraid-detection.patch
 	"${FILESDIR}"/${PN}-1.79-btrfs-subvolume-detection.patch
 	"${FILESDIR}"/${PN}-1.79-use-fstab-name.patch
+	"${FILESDIR}"/${PN}-1.79-mounted-boot-partition-fix.patch
 )
 
 DOC_CONTENTS="


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-boot/os-prober/, sys-boot/os-prober/files/
@ 2021-10-08 11:12 Ben Kohler
  0 siblings, 0 replies; 10+ messages in thread
From: Ben Kohler @ 2021-10-08 11:12 UTC (permalink / raw
  To: gentoo-commits

commit:     c305cbb85b681269a94554866be0e3738ed4111d
Author:     Peter Levine <plevine457 <AT> gmail <DOT> com>
AuthorDate: Fri Oct  8 01:06:15 2021 +0000
Commit:     Ben Kohler <bkohler <AT> gentoo <DOT> org>
CommitDate: Fri Oct  8 11:12:15 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c305cbb8

sys-boot/os-prober: fix detection on software-raid devices

Fixes detection of OSes installed on /dev/md* devices (not linked to
/dev/mapper/*).

Package-Manager: Portage-3.0.26, Repoman-3.0.3
Signed-off-by: Peter Levine <plevine457 <AT> gmail.com>
Signed-off-by: Ben Kohler <bkohler <AT> gentoo.org>

 .../files/os-prober-1.79-mdraid-detection.patch    | 28 ++++++++++++++++++++++
 sys-boot/os-prober/os-prober-9999.ebuild           |  1 +
 2 files changed, 29 insertions(+)

diff --git a/sys-boot/os-prober/files/os-prober-1.79-mdraid-detection.patch b/sys-boot/os-prober/files/os-prober-1.79-mdraid-detection.patch
new file mode 100644
index 00000000000..15b9de5117a
--- /dev/null
+++ b/sys-boot/os-prober/files/os-prober-1.79-mdraid-detection.patch
@@ -0,0 +1,28 @@
+Fixes OS detection on mdraid devices
+
+Bug: https://bugs.debian.org/648251
+     https://bugzilla.redhat.com/752402
+
+--- a/os-prober
++++ b/os-prober
+@@ -64,6 +64,11 @@ partitions () {
+ 		exit 0
+ 	fi
+ 
++	# Add MD RAID devices
++	if [ -f /proc/mdstat ] ; then
++		awk '/^md/ {printf "/dev/"$1"\n"}' /proc/mdstat
++	fi
++
+ 	# Also detect OSes on LVM volumes (assumes LVM is active)
+ 	if type lvs >/dev/null 2>&1; then
+ 		echo "$(LVM_SUPPRESS_FD_WARNINGS=1 log_output lvs --noheadings --separator : -o vg_name,lv_name |
+@@ -123,7 +128,7 @@ if [ -f /proc/swaps ]; then
+ fi
+ : >"$OS_PROBER_TMP/raided-map"
+ if [ -f /proc/mdstat ] ; then
+-	grep "^md" /proc/mdstat | parse_proc_mdstat >"$OS_PROBER_TMP/raided-map" || true
++	grep "^md" /proc/mdstat | cut -d: -f2- | parse_proc_mdstat >"$OS_PROBER_TMP/raided-map" || true
+ fi
+ 
+ for partition in $(partitions); do

diff --git a/sys-boot/os-prober/os-prober-9999.ebuild b/sys-boot/os-prober/os-prober-9999.ebuild
index 2b0ace332d0..4feb1e2b320 100644
--- a/sys-boot/os-prober/os-prober-9999.ebuild
+++ b/sys-boot/os-prober/os-prober-9999.ebuild
@@ -26,6 +26,7 @@ RDEPEND="sys-boot/grub:2[mount]"
 QA_MULTILIB_PATHS="usr/lib/os-prober/.*"
 
 PATCHES=(
+	"${FILESDIR}"/${PN}-1.79-mdraid-detection.patch
 	"${FILESDIR}"/${PN}-1.78-btrfsfix.patch
 )
 


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-boot/os-prober/, sys-boot/os-prober/files/
@ 2021-10-08 11:12 Ben Kohler
  0 siblings, 0 replies; 10+ messages in thread
From: Ben Kohler @ 2021-10-08 11:12 UTC (permalink / raw
  To: gentoo-commits

commit:     733c692eca0ad50591ccf11cfcf89e317291f35f
Author:     Peter Levine <plevine457 <AT> gmail <DOT> com>
AuthorDate: Fri Oct  8 01:13:01 2021 +0000
Commit:     Ben Kohler <bkohler <AT> gentoo <DOT> org>
CommitDate: Fri Oct  8 11:12:16 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=733c692e

sys-boot/os-prober: replace os-prober-1.78-btrfsfix.patch

Replace os-prober-1.78-btrfsfix.patch with changes from OpenSUSE's
os-prober-btrfs-always-detect-default.patch to fix OS detection issues.

Closes: https://bugs.gentoo.org/790434
Package-Manager: Portage-3.0.26, Repoman-3.0.3
Signed-off-by: Peter Levine <plevine457 <AT> gmail.com>
Signed-off-by: Ben Kohler <bkohler <AT> gentoo.org>

 .../os-prober-1.79-btrfs-subvolume-detection.patch | 505 +++++++++++++++++++++
 sys-boot/os-prober/os-prober-9999.ebuild           |   2 +-
 2 files changed, 506 insertions(+), 1 deletion(-)

diff --git a/sys-boot/os-prober/files/os-prober-1.79-btrfs-subvolume-detection.patch b/sys-boot/os-prober/files/os-prober-1.79-btrfs-subvolume-detection.patch
new file mode 100644
index 00000000000..14cd794530e
--- /dev/null
+++ b/sys-boot/os-prober/files/os-prober-1.79-btrfs-subvolume-detection.patch
@@ -0,0 +1,505 @@
+Fixes detection of multiple linux installations on different subvolumes of the
+same partition.  Also contains changes from
+https://build.opensuse.org/package/view_file/openSUSE:Factory/os-prober/os-prober-btrfs-always-detect-default.patch
+to fix https://bugs.gentoo.org/790434.
+
+Bug: https://bugs.gentoo.org/790434
+     https://bugs.debian.org/688336
+     https://bugzilla.redhat.com/888341
+
+--- a/common.sh
++++ b/common.sh
+@@ -155,6 +155,7 @@
+ 	done
+ }
+ 
++# add forth parameter to pickup btrfs subvol info
+ parsefstab () {
+ 	while read -r line; do
+ 		case "$line" in
+@@ -165,12 +166,22 @@
+ 				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'
+--- a/linux-boot-prober
++++ b/linux-boot-prober
+@@ -5,16 +5,148 @@
+ 
+ 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 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 [ -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
++			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
+@@ -22,8 +154,8 @@
+ 
+ if ! grep -q "^$mapped " "$OS_PROBER_TMP/mounted-map"; then
+ 	for test in /usr/lib/linux-boot-probes/*; do
+-		debug "running $test"
+ 		if [ -x $test ] && [ -f $test ]; then
++			debug "running $test"
+ 			if $test "$partition"; then
+ 				debug "linux detected by $test"
+ 				break
+--- a/linux-boot-probes/mounted/common/40grub2
++++ b/linux-boot-probes/mounted/common/40grub2
+@@ -2,17 +2,30 @@
+ . /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 "$partition" = "$bootpart" ]; then
++		# trim off the leading subvol
++		kernelfile=$(echo "$kernel" | cut -d '/' -f 2- | cut -d '/' -f 2-)
++		if [ "x$rootsv" != "x$bootsv" ]; then
++		   kernelfile="/boot/$kernelfile"
++		fi
++	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
+@@ -108,9 +121,9 @@
+     [ "$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/grub.cfg" ]; then
++elif [ -e "$mpoint/boot/grub/grub.cfg" ]; then
+ 	debug "parsing grub.cfg"
+-	parse_grub_menu "$mpoint" "$partition" "$bootpart" < "$mpoint/boot/grub2/grub.cfg"
++	parse_grub_menu "$mpoint" "$partition" "$bootpart" < "$mpoint/boot/grub/grub.cfg"
+ fi
+ 
+ if [ "$found_item" = 0 ]; then
+--- a/os-prober
++++ b/os-prober
+@@ -76,9 +76,12 @@
+ 
+ 	# Also detect OSes on LVM volumes (assumes LVM is active)
+ 	if type lvs >/dev/null 2>&1; then
+-		echo "$(LVM_SUPPRESS_FD_WARNINGS=1 log_output lvs --noheadings --separator : -o vg_name,lv_name |
++		echo "$(LVM_SUPPRESS_FD_WARNINGS=1 log_output lvs --noheadings --separator : -o vg_name,lv_name 2>/dev/null |
+ 			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 'TYPE="btrfs"' | cut -d ':' -f 1
+ }
+ 
+ parse_proc_swaps () {
+@@ -136,6 +139,8 @@
+ 	grep "^md" /proc/mdstat | cut -d: -f2- | 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"
+@@ -154,7 +159,26 @@
+ 		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"
+--- a/os-probes/common/50mounted-tests
++++ b/os-probes/common/50mounted-tests
+@@ -14,19 +14,31 @@
+ 	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")" || types=NOT-DETECTED
++fi
++
+ if [ "$types" = NOT-DETECTED ]; then
+ 	debug "$1 type not recognised; skipping"
+-	exit 0
++	exit 1
+ elif [ "$types" = swap ]; then
+ 	debug "$1 is a swap partition; skipping"
+-	exit 0
++	exit 1
+ elif [ "$types" = crypto_LUKS ]; then
+ 	debug "$1 is a LUKS partition; skipping"
+-	exit 0
++	exit 1
+ elif [ "$types" = LVM2_member ]; then
+ 	debug "$1 is an LVM member; skipping"
+-	exit 0
++	exit 1
+ elif [ "$types" = ntfs ]; then
+ 	if type ntfs-3g >/dev/null 2>&1; then
+ 		types='ntfs-3g ntfs'
+@@ -35,7 +47,7 @@
+ 	if type cryptsetup >/dev/null 2>&1 && \
+ 	   cryptsetup luksDump "$partition" >/dev/null 2>&1; then
+ 		debug "$1 is a LUKS partition; skipping"
+-		exit 0
++		exit 1
+ 	fi
+ 	for type in $(grep -v nodev /proc/filesystems); do
+ 		# hfsplus filesystems are mountable as hfs. Try hfs last so
+@@ -58,6 +70,127 @@
+ fi
+ 
+ mounted=
++
++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
++	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
++
++	found=
++	mounted=
++
++	mpoint="$(grep btrfs /proc/self/mountinfo | grep "$partition " | cut -d ' ' -f 5)"
++	if [ -n "$mpoint" -a "x$mpoint" = "x/" ]; then
++		debug "This is the root for the running system" #running system must be done elsewhere
++	else
++	    #partition was not root of running system, so lets look for bootable subvols
++	    if [ -n "$mpoint" ] ; then
++		mounted=1  #partition was already mounted,so lets not unmount it when done
++	    else
++		# again, do not mount btrfs ro
++		mount -t btrfs -U "$UUID" "$tmpmnt"
++		mpoint="$tmpmnt"
++	    fi
++
++	    test="/usr/libexec/os-probes/mounted/90linux-distro"
++	    if [ -f "$test" ] && [ -x "$test" ]; then
++		debug "running subtest $test"
++		if "$test" "$partition" "$mpoint" btrfs "UUID=$UUID"; then
++		    debug "os found by subtest $test on $partition"
++		    found=1
++		fi
++	    fi
++	    if [ -z "$mounted" ]; then
++		if ! umount "$tmpmnt"; then
++		    warn "failed to umount $tmpmnt"
++		fi
++	    fi
++	fi
++	found=
++	# 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
++		debug "begin btrfs processing for $UUID subvol=$subvol"
++		if probe_subvol "$subvol" "$partition" "$UUID" "$tmpmnt"; then
++			found=1
++		fi
++	done
++	rmdir "$tmpmnt" || true
++	if [ "$found" ]; then
++		exit 0
++	else
++		exit 1
++	fi
++fi
++
+ if type grub-mount >/dev/null 2>&1 && \
+    type grub-probe >/dev/null 2>&1 && \
+    grub-mount "$partition" "$tmpmnt" 2>/dev/null; then
+--- a/os-probes/mounted/common/90linux-distro
++++ b/os-probes/mounted/common/90linux-distro
+@@ -7,6 +7,8 @@
+ 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 @@
+ 	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

diff --git a/sys-boot/os-prober/os-prober-9999.ebuild b/sys-boot/os-prober/os-prober-9999.ebuild
index 4feb1e2b320..5bd9e3b714c 100644
--- a/sys-boot/os-prober/os-prober-9999.ebuild
+++ b/sys-boot/os-prober/os-prober-9999.ebuild
@@ -27,7 +27,7 @@ QA_MULTILIB_PATHS="usr/lib/os-prober/.*"
 
 PATCHES=(
 	"${FILESDIR}"/${PN}-1.79-mdraid-detection.patch
-	"${FILESDIR}"/${PN}-1.78-btrfsfix.patch
+	"${FILESDIR}"/${PN}-1.79-btrfs-subvolume-detection.patch
 )
 
 DOC_CONTENTS="


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-boot/os-prober/, sys-boot/os-prober/files/
@ 2021-10-08 11:12 Ben Kohler
  0 siblings, 0 replies; 10+ messages in thread
From: Ben Kohler @ 2021-10-08 11:12 UTC (permalink / raw
  To: gentoo-commits

commit:     84564ed5e8df1bf6240aa2b5401562ff81e27081
Author:     Peter Levine <plevine457 <AT> gmail <DOT> com>
AuthorDate: Fri Oct  8 01:46:36 2021 +0000
Commit:     Ben Kohler <bkohler <AT> gentoo <DOT> org>
CommitDate: Fri Oct  8 11:12:21 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=84564ed5

sys-boot/os-prober: fix os-prober in chroot and no mounted /run/udev

When /run/udev isn't mounted or udev isn't available, fallback to blkid.

Bug: https://bugs.gentoo.org/761475
Package-Manager: Portage-3.0.26, Repoman-3.0.3
Signed-off-by: Peter Levine <plevine457 <AT> gmail.com>
Signed-off-by: Ben Kohler <bkohler <AT> gentoo.org>

 .../os-prober-1.79-efi-chroot-blkid-fallback.patch | 24 ++++++++++++++++++++++
 sys-boot/os-prober/os-prober-9999.ebuild           |  3 +--
 2 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/sys-boot/os-prober/files/os-prober-1.79-efi-chroot-blkid-fallback.patch b/sys-boot/os-prober/files/os-prober-1.79-efi-chroot-blkid-fallback.patch
new file mode 100644
index 00000000000..b5b90b2214d
--- /dev/null
+++ b/sys-boot/os-prober/files/os-prober-1.79-efi-chroot-blkid-fallback.patch
@@ -0,0 +1,24 @@
+Fixes missing entries when os-prober is run in a chroot environment by falling back
+to blkid if udev isn't available or if /run/udev isn't bind mounted. Modified from
+https://build.opensuse.org/package/view_file/Base:System/os-prober/os-prober-05efi-blkid.patch?rev=103
+
+Bug: https://bugs.gentoo.org/761475
+     https://bugzilla.opensuse.org/1076779
+
+--- a/os-probes/mounted/x86/05efi
++++ b/os-probes/mounted/x86/05efi
+@@ -46,6 +46,14 @@ if type udevinfo > /dev/null 2>&1; then
+ 	fi
+ 
+ 	eval "$(udevinfo -q property -n "$partition" | grep -E '^ID_PART_ENTRY_(TYPE|SCHEME)=')"
++
++	# 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"
+ 

diff --git a/sys-boot/os-prober/os-prober-9999.ebuild b/sys-boot/os-prober/os-prober-9999.ebuild
index 4c80110b806..c854d403e4f 100644
--- a/sys-boot/os-prober/os-prober-9999.ebuild
+++ b/sys-boot/os-prober/os-prober-9999.ebuild
@@ -31,14 +31,13 @@ PATCHES=(
 	"${FILESDIR}"/${PN}-1.79-use-fstab-name.patch
 	"${FILESDIR}"/${PN}-1.79-mounted-boot-partition-fix.patch
 	"${FILESDIR}"/${PN}-1.79-fix-busy-umount-message.patch
+	"${FILESDIR}"/${PN}-1.79-efi-chroot-blkid-fallback.patch
 )
 
 DOC_CONTENTS="
 	If you intend for os-prober to detect versions of Windows installed on
 	NTFS-formatted partitions, your system must be capable of reading the
 	NTFS filesystem. One way to do this is by installing sys-fs/ntfs3g.
-	Also, in a chroot environment, it is necessary to bind mount /run/udev
-	(see https://wiki.gentoo.org/wiki/GRUB2#os-prober_and_UEFI_in_chroot).
 
 	NOTE: Since sys-boot/grub-2.06-rc1, grub-mkconfig disables os-prober by default.
 	To enable it, add GRUB_DISABLE_OS_PROBER=false to /etc/default/grub.


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-boot/os-prober/, sys-boot/os-prober/files/
@ 2021-10-08 11:12 Ben Kohler
  0 siblings, 0 replies; 10+ messages in thread
From: Ben Kohler @ 2021-10-08 11:12 UTC (permalink / raw
  To: gentoo-commits

commit:     8c241e87363c2550d0d8b629353e9167573ab29c
Author:     Peter Levine <plevine457 <AT> gmail <DOT> com>
AuthorDate: Fri Oct  8 01:39:50 2021 +0000
Commit:     Ben Kohler <bkohler <AT> gentoo <DOT> org>
CommitDate: Fri Oct  8 11:12:20 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8c241e87

sys-boot/os-prober: fix error message from umount delay

Sometimes, umount may take time to complete.  Fix corner-case of
"umount: /var/lib/os-prober/mount: target is busy."

Package-Manager: Portage-3.0.26, Repoman-3.0.3
Signed-off-by: Peter Levine <plevine457 <AT> gmail.com>
Signed-off-by: Ben Kohler <bkohler <AT> gentoo.org>

 .../os-prober-1.79-fix-busy-umount-message.patch    | 21 +++++++++++++++++++++
 sys-boot/os-prober/os-prober-9999.ebuild            |  1 +
 2 files changed, 22 insertions(+)

diff --git a/sys-boot/os-prober/files/os-prober-1.79-fix-busy-umount-message.patch b/sys-boot/os-prober/files/os-prober-1.79-fix-busy-umount-message.patch
new file mode 100644
index 00000000000..a9859f5005a
--- /dev/null
+++ b/sys-boot/os-prober/files/os-prober-1.79-fix-busy-umount-message.patch
@@ -0,0 +1,21 @@
+Fixes errors like "umount: /var/lib/os-prober/mount: target is busy."
+which can appear in some corner-cases.
+
+Bug: https://bugzilla.redhat.com/903906
+
+--- a/common.sh
++++ b/common.sh
+@@ -336,3 +336,13 @@ linux_mount_boot () {
+ 
+ 	mountboot="$bootpart $mounted"
+ }
++
++umount_exec=$(which umount)
++umount() {
++	if ! $umount_exec $@ 2> /dev/null; then
++		error "umount error, retrying after 1 sec"
++		sleep 1
++		$umount_exec $@
++	fi
++}
++

diff --git a/sys-boot/os-prober/os-prober-9999.ebuild b/sys-boot/os-prober/os-prober-9999.ebuild
index 59539158759..4c80110b806 100644
--- a/sys-boot/os-prober/os-prober-9999.ebuild
+++ b/sys-boot/os-prober/os-prober-9999.ebuild
@@ -30,6 +30,7 @@ PATCHES=(
 	"${FILESDIR}"/${PN}-1.79-btrfs-subvolume-detection.patch
 	"${FILESDIR}"/${PN}-1.79-use-fstab-name.patch
 	"${FILESDIR}"/${PN}-1.79-mounted-boot-partition-fix.patch
+	"${FILESDIR}"/${PN}-1.79-fix-busy-umount-message.patch
 )
 
 DOC_CONTENTS="


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-boot/os-prober/, sys-boot/os-prober/files/
@ 2023-02-16 13:55 Ben Kohler
  0 siblings, 0 replies; 10+ messages in thread
From: Ben Kohler @ 2023-02-16 13:55 UTC (permalink / raw
  To: gentoo-commits

commit:     e0b708394fc3447613233aaa15e79a35f6b36144
Author:     Ben Kohler <bkohler <AT> gentoo <DOT> org>
AuthorDate: Thu Feb 16 13:54:23 2023 +0000
Commit:     Ben Kohler <bkohler <AT> gentoo <DOT> org>
CommitDate: Thu Feb 16 13:55:18 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e0b70839

sys-boot/os-prober: add patch for duplicate current-OS detection

Bug: https://bugs.gentoo.org/830655

Signed-off-by: Ben Kohler <bkohler <AT> gentoo.org>

 .../files/os-prober-1.81-boot-detected-twice.patch |  46 +++++++++
 sys-boot/os-prober/os-prober-1.81-r1.ebuild        | 103 +++++++++++++++++++++
 2 files changed, 149 insertions(+)

diff --git a/sys-boot/os-prober/files/os-prober-1.81-boot-detected-twice.patch b/sys-boot/os-prober/files/os-prober-1.81-boot-detected-twice.patch
new file mode 100644
index 000000000000..b06b31d0077e
--- /dev/null
+++ b/sys-boot/os-prober/files/os-prober-1.81-boot-detected-twice.patch
@@ -0,0 +1,46 @@
+diff -urN o/common.sh os-prober-1.81/common.sh
+--- o/common.sh	2023-01-22 13:43:23.333123217 -0800
++++ os-prober-1.81/common.sh	2023-01-22 13:44:49.408153101 -0800
+@@ -326,3 +326,18 @@
+ 	fi
+ }
+ 
++list_mounts() {
++	if [ -f /proc/self/mountinfo ]; then
++		local x dev mount devs found
++		found=:
++		while read -r x x dev x mount x x fs x; do
++			if [ -L "/sys/dev/block/$dev" ]; then
++				devs="/dev/`readlink \"/sys/dev/block/$dev\" | rev | cut -d/ -f1 | rev`"
++				printf '%s %s %s\n' "$(mapdevfs "$devs")" "$mount" "$fs"
++				found="return 0"
++			fi
++		done < /proc/self/mountinfo
++		$found
++	fi
++	grep "^/dev/" /proc/mounts | parse_proc_mounts
++}
+diff -urN o/linux-boot-prober os-prober-1.81/linux-boot-prober
+--- o/linux-boot-prober	2023-01-22 13:43:23.334123229 -0800
++++ os-prober-1.81/linux-boot-prober	2023-01-22 13:43:34.897260733 -0800
+@@ -17,7 +17,7 @@
+ bootsv=
+ bootuuid=
+ 
+-grep "^/dev/" /proc/mounts | parse_proc_mounts >"$OS_PROBER_TMP/mounted-map" || true
++list_mounts >"$OS_PROBER_TMP/mounted-map" || true
+ 
+ if [ -z "$1" ]; then
+ 	ERR=y
+diff -urN o/os-prober os-prober-1.81/os-prober
+--- o/os-prober	2023-01-22 13:43:23.334123229 -0800
++++ os-prober-1.81/os-prober	2023-01-22 13:43:34.897260733 -0800
+@@ -128,7 +128,7 @@
+ 
+ # We need to properly canonicalize partitions with mount points and partitions
+ # used in RAID
+-grep "^/dev/" /proc/mounts | parse_proc_mounts >"$OS_PROBER_TMP/mounted-map" || true
++list_mounts >"$OS_PROBER_TMP/mounted-map" || true
+ : >"$OS_PROBER_TMP/swaps-map"
+ if [ -f /proc/swaps ]; then
+ 	grep "^/dev/" /proc/swaps | parse_proc_swaps >"$OS_PROBER_TMP/swaps-map" || true

diff --git a/sys-boot/os-prober/os-prober-1.81-r1.ebuild b/sys-boot/os-prober/os-prober-1.81-r1.ebuild
new file mode 100644
index 000000000000..924b7251237a
--- /dev/null
+++ b/sys-boot/os-prober/os-prober-1.81-r1.ebuild
@@ -0,0 +1,103 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+inherit readme.gentoo-r1 toolchain-funcs
+
+DESCRIPTION="Utility to detect other OSs on a set of drives"
+HOMEPAGE="https://salsa.debian.org/installer-team/os-prober"
+
+if [[ ${PV} == 9999 ]]; then
+	inherit git-r3
+	EGIT_REPO_URI="https://salsa.debian.org/installer-team/${PN}.git"
+else
+	SRC_URI="mirror://debian/pool/main/${PN::1}/${PN}/${PN}_${PV}.tar.xz"
+	KEYWORDS="~amd64 ~x86"
+fi
+
+LICENSE="GPL-3"
+SLOT="0"
+
+# grub-mount needed per bug #607518
+RDEPEND="sys-boot/grub:2[mount]"
+
+# bug 594250
+QA_MULTILIB_PATHS="usr/lib/os-prober/.*"
+
+PATCHES=(
+	"${FILESDIR}"/${PN}-1.79-mdraid-detection.patch
+	"${FILESDIR}"/${PN}-1.79-btrfs-subvolume-detection.patch
+	"${FILESDIR}"/${PN}-1.79-use-fstab-name.patch
+	"${FILESDIR}"/${PN}-1.79-mounted-boot-partition-fix.patch
+	"${FILESDIR}"/${PN}-1.79-fix-busy-umount-message.patch
+	"${FILESDIR}"/${PN}-1.79-efi-chroot-blkid-fallback.patch
+	"${FILESDIR}"/${PN}-1.81-boot-detected-twice.patch
+)
+
+DOC_CONTENTS="
+	If you intend for os-prober to detect versions of Windows installed on
+	NTFS-formatted partitions, your system must be capable of reading the
+	NTFS filesystem. One way to do this is by installing sys-fs/ntfs3g.
+
+	NOTE: Since sys-boot/grub-2.06-rc1, grub-mkconfig disables os-prober by default.
+	To enable it, add GRUB_DISABLE_OS_PROBER=false to /etc/default/grub.
+"
+
+src_prepare() {
+	default
+	# use default GNU rules
+	rm Makefile || die 'rm Makefile failed'
+}
+
+src_compile() {
+	tc-export CC
+	emake newns
+}
+
+src_install() {
+	dobin os-prober linux-boot-prober
+
+	# Note: as no shared libraries are installed, /usr/lib is correct
+	exeinto /usr/lib/os-prober
+	doexe newns
+
+	insinto /usr/share/os-prober
+	doins common.sh
+
+	keepdir /var/lib/os-prober
+
+	local debarch=${ARCH%-*} dir
+
+	case ${debarch} in
+		amd64)		debarch=x86 ;;
+		ppc|ppc64)	debarch=powerpc ;;
+	esac
+
+	for dir in os-probes{,/mounted,/init} linux-boot-probes{,/mounted}; do
+		exeinto /usr/lib/${dir}
+		doexe ${dir}/common/*
+		if [[ -d ${dir}/${debarch} ]]; then
+			for exe in ${dir}/${debarch}/*; do
+				[[ ! -d "${exe}" ]] && doexe "${exe}"
+			done
+		fi
+		if [[ -d ${dir}/${debarch}/efi ]]; then
+			exeinto /usr/lib/${dir}/efi
+			doexe ${dir}/${debarch}/efi/*
+		fi
+	done
+
+	if use amd64 || use x86; then
+		exeinto /usr/lib/os-probes/mounted
+		doexe os-probes/mounted/powerpc/20macosx
+	fi
+
+	einstalldocs
+	dodoc debian/changelog
+
+	readme.gentoo_create_doc
+}
+
+pkg_postinst() {
+	readme.gentoo_print_elog
+}


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-boot/os-prober/, sys-boot/os-prober/files/
@ 2024-05-08 16:43 Ben Kohler
  0 siblings, 0 replies; 10+ messages in thread
From: Ben Kohler @ 2024-05-08 16:43 UTC (permalink / raw
  To: gentoo-commits

commit:     dd2aa3aeb97da6052c2645e12313cd7eec389715
Author:     Ben Kohler <bkohler <AT> gentoo <DOT> org>
AuthorDate: Wed May  8 16:40:29 2024 +0000
Commit:     Ben Kohler <bkohler <AT> gentoo <DOT> org>
CommitDate: Wed May  8 16:43:39 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dd2aa3ae

sys-boot/os-prober: new boot-detected-twice patch

This version adds a slightly adjusted patch which accounts for the fact
that mountinfo may have an extra optional field.  This does not account
for *more than one* optional field, but we can revisit this if such a
setup is found in the wild.

Bug: https://bugs.gentoo.org/897700
Signed-off-by: Ben Kohler <bkohler <AT> gentoo.org>

 .../os-prober-1.81-boot-detected-twice-v2.patch    |  57 ++++++++++++
 sys-boot/os-prober/os-prober-1.81-r2.ebuild        | 103 +++++++++++++++++++++
 2 files changed, 160 insertions(+)

diff --git a/sys-boot/os-prober/files/os-prober-1.81-boot-detected-twice-v2.patch b/sys-boot/os-prober/files/os-prober-1.81-boot-detected-twice-v2.patch
new file mode 100644
index 000000000000..41e661bae86f
--- /dev/null
+++ b/sys-boot/os-prober/files/os-prober-1.81-boot-detected-twice-v2.patch
@@ -0,0 +1,57 @@
+diff --git a/common.sh b/common.sh
+index cc7a335..820caea 100644
+--- a/common.sh
++++ b/common.sh
+@@ -326,3 +326,26 @@ umount() {
+ 	fi
+ }
+ 
++list_mounts() {
++	if [ -f /proc/self/mountinfo ]; then
++		local x dev mount devs found mountinfo_placeholders
++		found=:
++
++		# mountinfo may have 10 or 11 fields depending on mount namespaces
++		if [ $(head -n1 /proc/self/mountinfo | wc -w) == 10 ]; then
++			mountinfo_placeholders="x x"
++		else
++			mountinfo_placeholders="x x x"
++		fi
++
++		while read -r x x dev x mount ${mountinfo_placeholders} fs x; do
++			if [ -L "/sys/dev/block/$dev" ]; then
++				devs="/dev/`readlink \"/sys/dev/block/$dev\" | rev | cut -d/ -f1 | rev`"
++				printf '%s %s %s\n' "$(mapdevfs "$devs")" "$mount" "$fs"
++				found="return 0"
++			fi
++		done < /proc/self/mountinfo
++		$found
++	fi
++	grep "^/dev/" /proc/mounts | parse_proc_mounts
++}
+diff --git a/linux-boot-prober b/linux-boot-prober
+index bacf219..804d9fe 100755
+--- a/linux-boot-prober
++++ b/linux-boot-prober
+@@ -17,7 +17,7 @@ bootmnt=
+ bootsv=
+ bootuuid=
+ 
+-grep "^/dev/" /proc/mounts | parse_proc_mounts >"$OS_PROBER_TMP/mounted-map" || true
++list_mounts >"$OS_PROBER_TMP/mounted-map" || true
+ 
+ if [ -z "$1" ]; then
+ 	ERR=y
+diff --git a/os-prober b/os-prober
+index b76d85b..8b0c89b 100755
+--- a/os-prober
++++ b/os-prober
+@@ -128,7 +128,7 @@ done
+ 
+ # We need to properly canonicalize partitions with mount points and partitions
+ # used in RAID
+-grep "^/dev/" /proc/mounts | parse_proc_mounts >"$OS_PROBER_TMP/mounted-map" || true
++list_mounts >"$OS_PROBER_TMP/mounted-map" || true
+ : >"$OS_PROBER_TMP/swaps-map"
+ if [ -f /proc/swaps ]; then
+ 	grep "^/dev/" /proc/swaps | parse_proc_swaps >"$OS_PROBER_TMP/swaps-map" || true

diff --git a/sys-boot/os-prober/os-prober-1.81-r2.ebuild b/sys-boot/os-prober/os-prober-1.81-r2.ebuild
new file mode 100644
index 000000000000..21799edbec21
--- /dev/null
+++ b/sys-boot/os-prober/os-prober-1.81-r2.ebuild
@@ -0,0 +1,103 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+inherit readme.gentoo-r1 toolchain-funcs
+
+DESCRIPTION="Utility to detect other OSs on a set of drives"
+HOMEPAGE="https://salsa.debian.org/installer-team/os-prober"
+
+if [[ ${PV} == 9999 ]]; then
+	inherit git-r3
+	EGIT_REPO_URI="https://salsa.debian.org/installer-team/${PN}.git"
+else
+	SRC_URI="mirror://debian/pool/main/${PN::1}/${PN}/${PN}_${PV}.tar.xz"
+	KEYWORDS="~amd64 ~x86"
+fi
+
+LICENSE="GPL-3"
+SLOT="0"
+
+# grub-mount needed per bug #607518
+RDEPEND="sys-boot/grub:2[mount]"
+
+# bug 594250
+QA_MULTILIB_PATHS="usr/lib/os-prober/.*"
+
+PATCHES=(
+	"${FILESDIR}"/${PN}-1.79-mdraid-detection.patch
+	"${FILESDIR}"/${PN}-1.79-btrfs-subvolume-detection.patch
+	"${FILESDIR}"/${PN}-1.79-use-fstab-name.patch
+	"${FILESDIR}"/${PN}-1.79-mounted-boot-partition-fix.patch
+	"${FILESDIR}"/${PN}-1.79-fix-busy-umount-message.patch
+	"${FILESDIR}"/${PN}-1.79-efi-chroot-blkid-fallback.patch
+	"${FILESDIR}"/${PN}-1.81-boot-detected-twice-v2.patch
+)
+
+DOC_CONTENTS="
+	If you intend for os-prober to detect versions of Windows installed on
+	NTFS-formatted partitions, your system must be capable of reading the
+	NTFS filesystem. One way to do this is by installing sys-fs/ntfs3g.
+
+	NOTE: Since sys-boot/grub-2.06-rc1, grub-mkconfig disables os-prober by default.
+	To enable it, add GRUB_DISABLE_OS_PROBER=false to /etc/default/grub.
+"
+
+src_prepare() {
+	default
+	# use default GNU rules
+	rm Makefile || die 'rm Makefile failed'
+}
+
+src_compile() {
+	tc-export CC
+	emake newns
+}
+
+src_install() {
+	dobin os-prober linux-boot-prober
+
+	# Note: as no shared libraries are installed, /usr/lib is correct
+	exeinto /usr/lib/os-prober
+	doexe newns
+
+	insinto /usr/share/os-prober
+	doins common.sh
+
+	keepdir /var/lib/os-prober
+
+	local debarch=${ARCH%-*} dir
+
+	case ${debarch} in
+		amd64)		debarch=x86 ;;
+		ppc|ppc64)	debarch=powerpc ;;
+	esac
+
+	for dir in os-probes{,/mounted,/init} linux-boot-probes{,/mounted}; do
+		exeinto /usr/lib/${dir}
+		doexe ${dir}/common/*
+		if [[ -d ${dir}/${debarch} ]]; then
+			for exe in ${dir}/${debarch}/*; do
+				[[ ! -d "${exe}" ]] && doexe "${exe}"
+			done
+		fi
+		if [[ -d ${dir}/${debarch}/efi ]]; then
+			exeinto /usr/lib/${dir}/efi
+			doexe ${dir}/${debarch}/efi/*
+		fi
+	done
+
+	if use amd64 || use x86; then
+		exeinto /usr/lib/os-probes/mounted
+		doexe os-probes/mounted/powerpc/20macosx
+	fi
+
+	einstalldocs
+	dodoc debian/changelog
+
+	readme.gentoo_create_doc
+}
+
+pkg_postinst() {
+	readme.gentoo_print_elog
+}


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-boot/os-prober/, sys-boot/os-prober/files/
@ 2024-05-21 15:50 Ben Kohler
  0 siblings, 0 replies; 10+ messages in thread
From: Ben Kohler @ 2024-05-21 15:50 UTC (permalink / raw
  To: gentoo-commits

commit:     80f9bed892f17cb69eaab7ac9a1fa547384c4927
Author:     Enno Tensing <tenno <AT> suij <DOT> in>
AuthorDate: Fri May 17 18:08:41 2024 +0000
Commit:     Ben Kohler <bkohler <AT> gentoo <DOT> org>
CommitDate: Tue May 21 15:50:15 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=80f9bed8

sys-boot/os-prober: Make boot-detected-twice patch POSIX sh compliant

This versions modfies the patch added by -r2 to be POSIX sh compliant.
For this we just replace the '==' in line 15 with '-eq'.

Closes: https://bugs.gentoo.org/932098
Signed-off-by: Enno Tensing <tenno <AT> suij.in>
Closes: https://github.com/gentoo/gentoo/pull/36725
Signed-off-by: Ben Kohler <bkohler <AT> gentoo.org>

 .../os-prober-1.81-boot-detected-twice-v3.patch    |  57 ++++++++++++
 sys-boot/os-prober/os-prober-1.81-r3.ebuild        | 103 +++++++++++++++++++++
 2 files changed, 160 insertions(+)

diff --git a/sys-boot/os-prober/files/os-prober-1.81-boot-detected-twice-v3.patch b/sys-boot/os-prober/files/os-prober-1.81-boot-detected-twice-v3.patch
new file mode 100644
index 000000000000..58e592ae7e8e
--- /dev/null
+++ b/sys-boot/os-prober/files/os-prober-1.81-boot-detected-twice-v3.patch
@@ -0,0 +1,57 @@
+diff --git a/common.sh b/common.sh
+index cc7a335..820caea 100644
+--- a/common.sh
++++ b/common.sh
+@@ -326,3 +326,26 @@ umount() {
+ 	fi
+ }
+ 
++list_mounts() {
++	if [ -f /proc/self/mountinfo ]; then
++		local x dev mount devs found mountinfo_placeholders
++		found=:
++
++		# mountinfo may have 10 or 11 fields depending on mount namespaces
++		if [ $(head -n1 /proc/self/mountinfo | wc -w) -eq 10 ]; then
++			mountinfo_placeholders="x x"
++		else
++			mountinfo_placeholders="x x x"
++		fi
++
++		while read -r x x dev x mount ${mountinfo_placeholders} fs x; do
++			if [ -L "/sys/dev/block/$dev" ]; then
++				devs="/dev/`readlink \"/sys/dev/block/$dev\" | rev | cut -d/ -f1 | rev`"
++				printf '%s %s %s\n' "$(mapdevfs "$devs")" "$mount" "$fs"
++				found="return 0"
++			fi
++		done < /proc/self/mountinfo
++		$found
++	fi
++	grep "^/dev/" /proc/mounts | parse_proc_mounts
++}
+diff --git a/linux-boot-prober b/linux-boot-prober
+index bacf219..804d9fe 100755
+--- a/linux-boot-prober
++++ b/linux-boot-prober
+@@ -17,7 +17,7 @@ bootmnt=
+ bootsv=
+ bootuuid=
+ 
+-grep "^/dev/" /proc/mounts | parse_proc_mounts >"$OS_PROBER_TMP/mounted-map" || true
++list_mounts >"$OS_PROBER_TMP/mounted-map" || true
+ 
+ if [ -z "$1" ]; then
+ 	ERR=y
+diff --git a/os-prober b/os-prober
+index b76d85b..8b0c89b 100755
+--- a/os-prober
++++ b/os-prober
+@@ -128,7 +128,7 @@ done
+ 
+ # We need to properly canonicalize partitions with mount points and partitions
+ # used in RAID
+-grep "^/dev/" /proc/mounts | parse_proc_mounts >"$OS_PROBER_TMP/mounted-map" || true
++list_mounts >"$OS_PROBER_TMP/mounted-map" || true
+ : >"$OS_PROBER_TMP/swaps-map"
+ if [ -f /proc/swaps ]; then
+ 	grep "^/dev/" /proc/swaps | parse_proc_swaps >"$OS_PROBER_TMP/swaps-map" || true

diff --git a/sys-boot/os-prober/os-prober-1.81-r3.ebuild b/sys-boot/os-prober/os-prober-1.81-r3.ebuild
new file mode 100644
index 000000000000..7803b480fb27
--- /dev/null
+++ b/sys-boot/os-prober/os-prober-1.81-r3.ebuild
@@ -0,0 +1,103 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+inherit readme.gentoo-r1 toolchain-funcs
+
+DESCRIPTION="Utility to detect other OSs on a set of drives"
+HOMEPAGE="https://salsa.debian.org/installer-team/os-prober"
+
+if [[ ${PV} == 9999 ]]; then
+	inherit git-r3
+	EGIT_REPO_URI="https://salsa.debian.org/installer-team/${PN}.git"
+else
+	SRC_URI="mirror://debian/pool/main/${PN::1}/${PN}/${PN}_${PV}.tar.xz"
+	KEYWORDS="~amd64 ~x86"
+fi
+
+LICENSE="GPL-3"
+SLOT="0"
+
+# grub-mount needed per bug #607518
+RDEPEND="sys-boot/grub:2[mount]"
+
+# bug 594250
+QA_MULTILIB_PATHS="usr/lib/os-prober/.*"
+
+PATCHES=(
+	"${FILESDIR}"/${PN}-1.79-mdraid-detection.patch
+	"${FILESDIR}"/${PN}-1.79-btrfs-subvolume-detection.patch
+	"${FILESDIR}"/${PN}-1.79-use-fstab-name.patch
+	"${FILESDIR}"/${PN}-1.79-mounted-boot-partition-fix.patch
+	"${FILESDIR}"/${PN}-1.79-fix-busy-umount-message.patch
+	"${FILESDIR}"/${PN}-1.79-efi-chroot-blkid-fallback.patch
+	"${FILESDIR}"/${PN}-1.81-boot-detected-twice-v3.patch
+)
+
+DOC_CONTENTS="
+	If you intend for os-prober to detect versions of Windows installed on
+	NTFS-formatted partitions, your system must be capable of reading the
+	NTFS filesystem. One way to do this is by installing sys-fs/ntfs3g.
+
+	NOTE: Since sys-boot/grub-2.06-rc1, grub-mkconfig disables os-prober by default.
+	To enable it, add GRUB_DISABLE_OS_PROBER=false to /etc/default/grub.
+"
+
+src_prepare() {
+	default
+	# use default GNU rules
+	rm Makefile || die 'rm Makefile failed'
+}
+
+src_compile() {
+	tc-export CC
+	emake newns
+}
+
+src_install() {
+	dobin os-prober linux-boot-prober
+
+	# Note: as no shared libraries are installed, /usr/lib is correct
+	exeinto /usr/lib/os-prober
+	doexe newns
+
+	insinto /usr/share/os-prober
+	doins common.sh
+
+	keepdir /var/lib/os-prober
+
+	local debarch=${ARCH%-*} dir
+
+	case ${debarch} in
+		amd64)		debarch=x86 ;;
+		ppc|ppc64)	debarch=powerpc ;;
+	esac
+
+	for dir in os-probes{,/mounted,/init} linux-boot-probes{,/mounted}; do
+		exeinto /usr/lib/${dir}
+		doexe ${dir}/common/*
+		if [[ -d ${dir}/${debarch} ]]; then
+			for exe in ${dir}/${debarch}/*; do
+				[[ ! -d "${exe}" ]] && doexe "${exe}"
+			done
+		fi
+		if [[ -d ${dir}/${debarch}/efi ]]; then
+			exeinto /usr/lib/${dir}/efi
+			doexe ${dir}/${debarch}/efi/*
+		fi
+	done
+
+	if use amd64 || use x86; then
+		exeinto /usr/lib/os-probes/mounted
+		doexe os-probes/mounted/powerpc/20macosx
+	fi
+
+	einstalldocs
+	dodoc debian/changelog
+
+	readme.gentoo_create_doc
+}
+
+pkg_postinst() {
+	readme.gentoo_print_elog
+}


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-boot/os-prober/, sys-boot/os-prober/files/
@ 2024-06-14 14:18 Ben Kohler
  0 siblings, 0 replies; 10+ messages in thread
From: Ben Kohler @ 2024-06-14 14:18 UTC (permalink / raw
  To: gentoo-commits

commit:     239c87689a1bbac85b623f81a1ecb89859c4ce96
Author:     Ben Kohler <bkohler <AT> gentoo <DOT> org>
AuthorDate: Fri Jun 14 14:16:34 2024 +0000
Commit:     Ben Kohler <bkohler <AT> gentoo <DOT> org>
CommitDate: Fri Jun 14 14:16:34 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=239c8768

sys-boot/os-prober: drop 1.80, 1.81, 1.81-r1, 1.81-r2

Signed-off-by: Ben Kohler <bkohler <AT> gentoo.org>

 sys-boot/os-prober/Manifest                        |   1 -
 .../os-prober-1.81-boot-detected-twice-v2.patch    |  57 ------------
 .../files/os-prober-1.81-boot-detected-twice.patch |  46 ---------
 sys-boot/os-prober/os-prober-1.80.ebuild           | 102 --------------------
 sys-boot/os-prober/os-prober-1.81-r1.ebuild        | 103 ---------------------
 sys-boot/os-prober/os-prober-1.81-r2.ebuild        | 103 ---------------------
 sys-boot/os-prober/os-prober-1.81.ebuild           | 102 --------------------
 7 files changed, 514 deletions(-)

diff --git a/sys-boot/os-prober/Manifest b/sys-boot/os-prober/Manifest
index 82c24eab534c..cba10225f1fb 100644
--- a/sys-boot/os-prober/Manifest
+++ b/sys-boot/os-prober/Manifest
@@ -1,3 +1,2 @@
-DIST os-prober_1.80.tar.xz 27400 BLAKE2B 56883c7d3f4c5dde2904cffc77fdf6a2c1caf230f9e84197e8d976e446815838448bb42afd18d4c9526efac9907db3d2e77c6f54889011d2d03d284a44ff4cbd SHA512 51b4fefb784d5ecf34f5148157ef233e2979c4a679a54600144be473bb6ccaf263c9121701a1ecc7523c7e3bfc439a4e3a92a5eb92431ead99cbe666b0f0e6f5
 DIST os-prober_1.81.tar.xz 27448 BLAKE2B 0159870612d265c5e610e093a8839129aa9dc111a6f3abee65a6044b4c997ba65a69f70deca246bde53c1cf5314812312178e82c0893093d9f23ced3b0176f9d SHA512 ffb0e618f9e58a7a8e4a265d253bad4e168c220697216684acb38dbfa20680e552eb7c5f3d2186cd750c61a8929bf152527aa85c39318ed8b025a4ffffadde50
 DIST os-prober_1.82.tar.xz 27596 BLAKE2B 2d703cf91931fbdc89f1d2ca6b2ef87368a11fb685821f4864f826b143a92c22d5544d99f0843900012f7d9ae230d9eb858de3ee99f6df5ed488c5fd604b51df SHA512 7ab1825e3d771a9fba8cff3a72dd54371e0e467090ba9780e0074a54a3a8451da5f771d7a8c9b51a5bbb03ad315d1887764335d7aaae77c2a6c4de426c667990

diff --git a/sys-boot/os-prober/files/os-prober-1.81-boot-detected-twice-v2.patch b/sys-boot/os-prober/files/os-prober-1.81-boot-detected-twice-v2.patch
deleted file mode 100644
index 41e661bae86f..000000000000
--- a/sys-boot/os-prober/files/os-prober-1.81-boot-detected-twice-v2.patch
+++ /dev/null
@@ -1,57 +0,0 @@
-diff --git a/common.sh b/common.sh
-index cc7a335..820caea 100644
---- a/common.sh
-+++ b/common.sh
-@@ -326,3 +326,26 @@ umount() {
- 	fi
- }
- 
-+list_mounts() {
-+	if [ -f /proc/self/mountinfo ]; then
-+		local x dev mount devs found mountinfo_placeholders
-+		found=:
-+
-+		# mountinfo may have 10 or 11 fields depending on mount namespaces
-+		if [ $(head -n1 /proc/self/mountinfo | wc -w) == 10 ]; then
-+			mountinfo_placeholders="x x"
-+		else
-+			mountinfo_placeholders="x x x"
-+		fi
-+
-+		while read -r x x dev x mount ${mountinfo_placeholders} fs x; do
-+			if [ -L "/sys/dev/block/$dev" ]; then
-+				devs="/dev/`readlink \"/sys/dev/block/$dev\" | rev | cut -d/ -f1 | rev`"
-+				printf '%s %s %s\n' "$(mapdevfs "$devs")" "$mount" "$fs"
-+				found="return 0"
-+			fi
-+		done < /proc/self/mountinfo
-+		$found
-+	fi
-+	grep "^/dev/" /proc/mounts | parse_proc_mounts
-+}
-diff --git a/linux-boot-prober b/linux-boot-prober
-index bacf219..804d9fe 100755
---- a/linux-boot-prober
-+++ b/linux-boot-prober
-@@ -17,7 +17,7 @@ bootmnt=
- bootsv=
- bootuuid=
- 
--grep "^/dev/" /proc/mounts | parse_proc_mounts >"$OS_PROBER_TMP/mounted-map" || true
-+list_mounts >"$OS_PROBER_TMP/mounted-map" || true
- 
- if [ -z "$1" ]; then
- 	ERR=y
-diff --git a/os-prober b/os-prober
-index b76d85b..8b0c89b 100755
---- a/os-prober
-+++ b/os-prober
-@@ -128,7 +128,7 @@ done
- 
- # We need to properly canonicalize partitions with mount points and partitions
- # used in RAID
--grep "^/dev/" /proc/mounts | parse_proc_mounts >"$OS_PROBER_TMP/mounted-map" || true
-+list_mounts >"$OS_PROBER_TMP/mounted-map" || true
- : >"$OS_PROBER_TMP/swaps-map"
- if [ -f /proc/swaps ]; then
- 	grep "^/dev/" /proc/swaps | parse_proc_swaps >"$OS_PROBER_TMP/swaps-map" || true

diff --git a/sys-boot/os-prober/files/os-prober-1.81-boot-detected-twice.patch b/sys-boot/os-prober/files/os-prober-1.81-boot-detected-twice.patch
deleted file mode 100644
index b06b31d0077e..000000000000
--- a/sys-boot/os-prober/files/os-prober-1.81-boot-detected-twice.patch
+++ /dev/null
@@ -1,46 +0,0 @@
-diff -urN o/common.sh os-prober-1.81/common.sh
---- o/common.sh	2023-01-22 13:43:23.333123217 -0800
-+++ os-prober-1.81/common.sh	2023-01-22 13:44:49.408153101 -0800
-@@ -326,3 +326,18 @@
- 	fi
- }
- 
-+list_mounts() {
-+	if [ -f /proc/self/mountinfo ]; then
-+		local x dev mount devs found
-+		found=:
-+		while read -r x x dev x mount x x fs x; do
-+			if [ -L "/sys/dev/block/$dev" ]; then
-+				devs="/dev/`readlink \"/sys/dev/block/$dev\" | rev | cut -d/ -f1 | rev`"
-+				printf '%s %s %s\n' "$(mapdevfs "$devs")" "$mount" "$fs"
-+				found="return 0"
-+			fi
-+		done < /proc/self/mountinfo
-+		$found
-+	fi
-+	grep "^/dev/" /proc/mounts | parse_proc_mounts
-+}
-diff -urN o/linux-boot-prober os-prober-1.81/linux-boot-prober
---- o/linux-boot-prober	2023-01-22 13:43:23.334123229 -0800
-+++ os-prober-1.81/linux-boot-prober	2023-01-22 13:43:34.897260733 -0800
-@@ -17,7 +17,7 @@
- bootsv=
- bootuuid=
- 
--grep "^/dev/" /proc/mounts | parse_proc_mounts >"$OS_PROBER_TMP/mounted-map" || true
-+list_mounts >"$OS_PROBER_TMP/mounted-map" || true
- 
- if [ -z "$1" ]; then
- 	ERR=y
-diff -urN o/os-prober os-prober-1.81/os-prober
---- o/os-prober	2023-01-22 13:43:23.334123229 -0800
-+++ os-prober-1.81/os-prober	2023-01-22 13:43:34.897260733 -0800
-@@ -128,7 +128,7 @@
- 
- # We need to properly canonicalize partitions with mount points and partitions
- # used in RAID
--grep "^/dev/" /proc/mounts | parse_proc_mounts >"$OS_PROBER_TMP/mounted-map" || true
-+list_mounts >"$OS_PROBER_TMP/mounted-map" || true
- : >"$OS_PROBER_TMP/swaps-map"
- if [ -f /proc/swaps ]; then
- 	grep "^/dev/" /proc/swaps | parse_proc_swaps >"$OS_PROBER_TMP/swaps-map" || true

diff --git a/sys-boot/os-prober/os-prober-1.80.ebuild b/sys-boot/os-prober/os-prober-1.80.ebuild
deleted file mode 100644
index 39b187859a6e..000000000000
--- a/sys-boot/os-prober/os-prober-1.80.ebuild
+++ /dev/null
@@ -1,102 +0,0 @@
-# Copyright 1999-2022 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-inherit readme.gentoo-r1 toolchain-funcs
-
-DESCRIPTION="Utility to detect other OSs on a set of drives"
-HOMEPAGE="https://salsa.debian.org/installer-team/os-prober"
-
-if [[ ${PV} == 9999 ]]; then
-	inherit git-r3
-	EGIT_REPO_URI="https://salsa.debian.org/installer-team/${PN}.git"
-else
-	SRC_URI="mirror://debian/pool/main/${PN::1}/${PN}/${PN}_${PV}.tar.xz"
-	KEYWORDS="amd64 x86"
-fi
-
-LICENSE="GPL-3"
-SLOT="0"
-
-# grub-mount needed per bug #607518
-RDEPEND="sys-boot/grub:2[mount]"
-
-# bug 594250
-QA_MULTILIB_PATHS="usr/lib/os-prober/.*"
-
-PATCHES=(
-	"${FILESDIR}"/${PN}-1.79-mdraid-detection.patch
-	"${FILESDIR}"/${PN}-1.79-btrfs-subvolume-detection.patch
-	"${FILESDIR}"/${PN}-1.79-use-fstab-name.patch
-	"${FILESDIR}"/${PN}-1.79-mounted-boot-partition-fix.patch
-	"${FILESDIR}"/${PN}-1.79-fix-busy-umount-message.patch
-	"${FILESDIR}"/${PN}-1.79-efi-chroot-blkid-fallback.patch
-)
-
-DOC_CONTENTS="
-	If you intend for os-prober to detect versions of Windows installed on
-	NTFS-formatted partitions, your system must be capable of reading the
-	NTFS filesystem. One way to do this is by installing sys-fs/ntfs3g.
-
-	NOTE: Since sys-boot/grub-2.06-rc1, grub-mkconfig disables os-prober by default.
-	To enable it, add GRUB_DISABLE_OS_PROBER=false to /etc/default/grub.
-"
-
-src_prepare() {
-	default
-	# use default GNU rules
-	rm Makefile || die 'rm Makefile failed'
-}
-
-src_compile() {
-	tc-export CC
-	emake newns
-}
-
-src_install() {
-	dobin os-prober linux-boot-prober
-
-	# Note: as no shared libraries are installed, /usr/lib is correct
-	exeinto /usr/lib/os-prober
-	doexe newns
-
-	insinto /usr/share/os-prober
-	doins common.sh
-
-	keepdir /var/lib/os-prober
-
-	local debarch=${ARCH%-*} dir
-
-	case ${debarch} in
-		amd64)		debarch=x86 ;;
-		ppc|ppc64)	debarch=powerpc ;;
-	esac
-
-	for dir in os-probes{,/mounted,/init} linux-boot-probes{,/mounted}; do
-		exeinto /usr/lib/${dir}
-		doexe ${dir}/common/*
-		if [[ -d ${dir}/${debarch} ]]; then
-			for exe in ${dir}/${debarch}/*; do
-				[[ ! -d "${exe}" ]] && doexe "${exe}"
-			done
-		fi
-		if [[ -d ${dir}/${debarch}/efi ]]; then
-			exeinto /usr/lib/${dir}/efi
-			doexe ${dir}/${debarch}/efi/*
-		fi
-	done
-
-	if use amd64 || use x86; then
-		exeinto /usr/lib/os-probes/mounted
-		doexe os-probes/mounted/powerpc/20macosx
-	fi
-
-	einstalldocs
-	dodoc debian/changelog
-
-	readme.gentoo_create_doc
-}
-
-pkg_postinst() {
-	readme.gentoo_print_elog
-}

diff --git a/sys-boot/os-prober/os-prober-1.81-r1.ebuild b/sys-boot/os-prober/os-prober-1.81-r1.ebuild
deleted file mode 100644
index 924b7251237a..000000000000
--- a/sys-boot/os-prober/os-prober-1.81-r1.ebuild
+++ /dev/null
@@ -1,103 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-inherit readme.gentoo-r1 toolchain-funcs
-
-DESCRIPTION="Utility to detect other OSs on a set of drives"
-HOMEPAGE="https://salsa.debian.org/installer-team/os-prober"
-
-if [[ ${PV} == 9999 ]]; then
-	inherit git-r3
-	EGIT_REPO_URI="https://salsa.debian.org/installer-team/${PN}.git"
-else
-	SRC_URI="mirror://debian/pool/main/${PN::1}/${PN}/${PN}_${PV}.tar.xz"
-	KEYWORDS="~amd64 ~x86"
-fi
-
-LICENSE="GPL-3"
-SLOT="0"
-
-# grub-mount needed per bug #607518
-RDEPEND="sys-boot/grub:2[mount]"
-
-# bug 594250
-QA_MULTILIB_PATHS="usr/lib/os-prober/.*"
-
-PATCHES=(
-	"${FILESDIR}"/${PN}-1.79-mdraid-detection.patch
-	"${FILESDIR}"/${PN}-1.79-btrfs-subvolume-detection.patch
-	"${FILESDIR}"/${PN}-1.79-use-fstab-name.patch
-	"${FILESDIR}"/${PN}-1.79-mounted-boot-partition-fix.patch
-	"${FILESDIR}"/${PN}-1.79-fix-busy-umount-message.patch
-	"${FILESDIR}"/${PN}-1.79-efi-chroot-blkid-fallback.patch
-	"${FILESDIR}"/${PN}-1.81-boot-detected-twice.patch
-)
-
-DOC_CONTENTS="
-	If you intend for os-prober to detect versions of Windows installed on
-	NTFS-formatted partitions, your system must be capable of reading the
-	NTFS filesystem. One way to do this is by installing sys-fs/ntfs3g.
-
-	NOTE: Since sys-boot/grub-2.06-rc1, grub-mkconfig disables os-prober by default.
-	To enable it, add GRUB_DISABLE_OS_PROBER=false to /etc/default/grub.
-"
-
-src_prepare() {
-	default
-	# use default GNU rules
-	rm Makefile || die 'rm Makefile failed'
-}
-
-src_compile() {
-	tc-export CC
-	emake newns
-}
-
-src_install() {
-	dobin os-prober linux-boot-prober
-
-	# Note: as no shared libraries are installed, /usr/lib is correct
-	exeinto /usr/lib/os-prober
-	doexe newns
-
-	insinto /usr/share/os-prober
-	doins common.sh
-
-	keepdir /var/lib/os-prober
-
-	local debarch=${ARCH%-*} dir
-
-	case ${debarch} in
-		amd64)		debarch=x86 ;;
-		ppc|ppc64)	debarch=powerpc ;;
-	esac
-
-	for dir in os-probes{,/mounted,/init} linux-boot-probes{,/mounted}; do
-		exeinto /usr/lib/${dir}
-		doexe ${dir}/common/*
-		if [[ -d ${dir}/${debarch} ]]; then
-			for exe in ${dir}/${debarch}/*; do
-				[[ ! -d "${exe}" ]] && doexe "${exe}"
-			done
-		fi
-		if [[ -d ${dir}/${debarch}/efi ]]; then
-			exeinto /usr/lib/${dir}/efi
-			doexe ${dir}/${debarch}/efi/*
-		fi
-	done
-
-	if use amd64 || use x86; then
-		exeinto /usr/lib/os-probes/mounted
-		doexe os-probes/mounted/powerpc/20macosx
-	fi
-
-	einstalldocs
-	dodoc debian/changelog
-
-	readme.gentoo_create_doc
-}
-
-pkg_postinst() {
-	readme.gentoo_print_elog
-}

diff --git a/sys-boot/os-prober/os-prober-1.81-r2.ebuild b/sys-boot/os-prober/os-prober-1.81-r2.ebuild
deleted file mode 100644
index 59252bb84f92..000000000000
--- a/sys-boot/os-prober/os-prober-1.81-r2.ebuild
+++ /dev/null
@@ -1,103 +0,0 @@
-# Copyright 1999-2024 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-inherit readme.gentoo-r1 toolchain-funcs
-
-DESCRIPTION="Utility to detect other OSs on a set of drives"
-HOMEPAGE="https://salsa.debian.org/installer-team/os-prober"
-
-if [[ ${PV} == 9999 ]]; then
-	inherit git-r3
-	EGIT_REPO_URI="https://salsa.debian.org/installer-team/${PN}.git"
-else
-	SRC_URI="mirror://debian/pool/main/${PN::1}/${PN}/${PN}_${PV}.tar.xz"
-	KEYWORDS="amd64 x86"
-fi
-
-LICENSE="GPL-3"
-SLOT="0"
-
-# grub-mount needed per bug #607518
-RDEPEND="sys-boot/grub:2[mount]"
-
-# bug 594250
-QA_MULTILIB_PATHS="usr/lib/os-prober/.*"
-
-PATCHES=(
-	"${FILESDIR}"/${PN}-1.79-mdraid-detection.patch
-	"${FILESDIR}"/${PN}-1.79-btrfs-subvolume-detection.patch
-	"${FILESDIR}"/${PN}-1.79-use-fstab-name.patch
-	"${FILESDIR}"/${PN}-1.79-mounted-boot-partition-fix.patch
-	"${FILESDIR}"/${PN}-1.79-fix-busy-umount-message.patch
-	"${FILESDIR}"/${PN}-1.79-efi-chroot-blkid-fallback.patch
-	"${FILESDIR}"/${PN}-1.81-boot-detected-twice-v2.patch
-)
-
-DOC_CONTENTS="
-	If you intend for os-prober to detect versions of Windows installed on
-	NTFS-formatted partitions, your system must be capable of reading the
-	NTFS filesystem. One way to do this is by installing sys-fs/ntfs3g.
-
-	NOTE: Since sys-boot/grub-2.06-rc1, grub-mkconfig disables os-prober by default.
-	To enable it, add GRUB_DISABLE_OS_PROBER=false to /etc/default/grub.
-"
-
-src_prepare() {
-	default
-	# use default GNU rules
-	rm Makefile || die 'rm Makefile failed'
-}
-
-src_compile() {
-	tc-export CC
-	emake newns
-}
-
-src_install() {
-	dobin os-prober linux-boot-prober
-
-	# Note: as no shared libraries are installed, /usr/lib is correct
-	exeinto /usr/lib/os-prober
-	doexe newns
-
-	insinto /usr/share/os-prober
-	doins common.sh
-
-	keepdir /var/lib/os-prober
-
-	local debarch=${ARCH%-*} dir
-
-	case ${debarch} in
-		amd64)		debarch=x86 ;;
-		ppc|ppc64)	debarch=powerpc ;;
-	esac
-
-	for dir in os-probes{,/mounted,/init} linux-boot-probes{,/mounted}; do
-		exeinto /usr/lib/${dir}
-		doexe ${dir}/common/*
-		if [[ -d ${dir}/${debarch} ]]; then
-			for exe in ${dir}/${debarch}/*; do
-				[[ ! -d "${exe}" ]] && doexe "${exe}"
-			done
-		fi
-		if [[ -d ${dir}/${debarch}/efi ]]; then
-			exeinto /usr/lib/${dir}/efi
-			doexe ${dir}/${debarch}/efi/*
-		fi
-	done
-
-	if use amd64 || use x86; then
-		exeinto /usr/lib/os-probes/mounted
-		doexe os-probes/mounted/powerpc/20macosx
-	fi
-
-	einstalldocs
-	dodoc debian/changelog
-
-	readme.gentoo_create_doc
-}
-
-pkg_postinst() {
-	readme.gentoo_print_elog
-}

diff --git a/sys-boot/os-prober/os-prober-1.81.ebuild b/sys-boot/os-prober/os-prober-1.81.ebuild
deleted file mode 100644
index 39b187859a6e..000000000000
--- a/sys-boot/os-prober/os-prober-1.81.ebuild
+++ /dev/null
@@ -1,102 +0,0 @@
-# Copyright 1999-2022 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-inherit readme.gentoo-r1 toolchain-funcs
-
-DESCRIPTION="Utility to detect other OSs on a set of drives"
-HOMEPAGE="https://salsa.debian.org/installer-team/os-prober"
-
-if [[ ${PV} == 9999 ]]; then
-	inherit git-r3
-	EGIT_REPO_URI="https://salsa.debian.org/installer-team/${PN}.git"
-else
-	SRC_URI="mirror://debian/pool/main/${PN::1}/${PN}/${PN}_${PV}.tar.xz"
-	KEYWORDS="amd64 x86"
-fi
-
-LICENSE="GPL-3"
-SLOT="0"
-
-# grub-mount needed per bug #607518
-RDEPEND="sys-boot/grub:2[mount]"
-
-# bug 594250
-QA_MULTILIB_PATHS="usr/lib/os-prober/.*"
-
-PATCHES=(
-	"${FILESDIR}"/${PN}-1.79-mdraid-detection.patch
-	"${FILESDIR}"/${PN}-1.79-btrfs-subvolume-detection.patch
-	"${FILESDIR}"/${PN}-1.79-use-fstab-name.patch
-	"${FILESDIR}"/${PN}-1.79-mounted-boot-partition-fix.patch
-	"${FILESDIR}"/${PN}-1.79-fix-busy-umount-message.patch
-	"${FILESDIR}"/${PN}-1.79-efi-chroot-blkid-fallback.patch
-)
-
-DOC_CONTENTS="
-	If you intend for os-prober to detect versions of Windows installed on
-	NTFS-formatted partitions, your system must be capable of reading the
-	NTFS filesystem. One way to do this is by installing sys-fs/ntfs3g.
-
-	NOTE: Since sys-boot/grub-2.06-rc1, grub-mkconfig disables os-prober by default.
-	To enable it, add GRUB_DISABLE_OS_PROBER=false to /etc/default/grub.
-"
-
-src_prepare() {
-	default
-	# use default GNU rules
-	rm Makefile || die 'rm Makefile failed'
-}
-
-src_compile() {
-	tc-export CC
-	emake newns
-}
-
-src_install() {
-	dobin os-prober linux-boot-prober
-
-	# Note: as no shared libraries are installed, /usr/lib is correct
-	exeinto /usr/lib/os-prober
-	doexe newns
-
-	insinto /usr/share/os-prober
-	doins common.sh
-
-	keepdir /var/lib/os-prober
-
-	local debarch=${ARCH%-*} dir
-
-	case ${debarch} in
-		amd64)		debarch=x86 ;;
-		ppc|ppc64)	debarch=powerpc ;;
-	esac
-
-	for dir in os-probes{,/mounted,/init} linux-boot-probes{,/mounted}; do
-		exeinto /usr/lib/${dir}
-		doexe ${dir}/common/*
-		if [[ -d ${dir}/${debarch} ]]; then
-			for exe in ${dir}/${debarch}/*; do
-				[[ ! -d "${exe}" ]] && doexe "${exe}"
-			done
-		fi
-		if [[ -d ${dir}/${debarch}/efi ]]; then
-			exeinto /usr/lib/${dir}/efi
-			doexe ${dir}/${debarch}/efi/*
-		fi
-	done
-
-	if use amd64 || use x86; then
-		exeinto /usr/lib/os-probes/mounted
-		doexe os-probes/mounted/powerpc/20macosx
-	fi
-
-	einstalldocs
-	dodoc debian/changelog
-
-	readme.gentoo_create_doc
-}
-
-pkg_postinst() {
-	readme.gentoo_print_elog
-}


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2024-06-14 14:18 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-08 11:12 [gentoo-commits] repo/gentoo:master commit in: sys-boot/os-prober/, sys-boot/os-prober/files/ Ben Kohler
  -- strict thread matches above, loose matches on Subject: below --
2024-06-14 14:18 Ben Kohler
2024-05-21 15:50 Ben Kohler
2024-05-08 16:43 Ben Kohler
2023-02-16 13:55 Ben Kohler
2021-10-08 11:12 Ben Kohler
2021-10-08 11:12 Ben Kohler
2021-10-08 11:12 Ben Kohler
2021-10-08 11:12 Ben Kohler
2017-12-26 12:53 Pacho Ramos

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox