Skip to content

Commit

Permalink
feat: update os-prober to 1.81
Browse files Browse the repository at this point in the history
utility to detect other OSes on a set of drives

Issue: linuxdeepin/developer-center#7284
Log: update repo
  • Loading branch information
xzl01 committed Mar 7, 2024
1 parent 5d1acfa commit fafcc17
Show file tree
Hide file tree
Showing 10 changed files with 85 additions and 17 deletions.
48 changes: 48 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,51 @@
os-prober (1.81) unstable; urgency=medium

* Team upload

[ Pascal Hambourg ]
* Add Windows 11 detection.

-- Holger Wansing <[email protected]> Mon, 18 Jul 2022 14:32:39 +0200

os-prober (1.80) unstable; urgency=medium

* Team upload

[ Samuel Thibault ]
* control: Enable mount dependency only on linux, enable freebsd-utils on
kfreebsd instead. (Closes: #1006590)

[ General Chaos ]
* Handle multiple initrd paths, as used in some distros

[ Gaël PORTAY ]
* Fix "os-prober: call dmraid -r *once*".

[ Timo Gurr ]
* Add Exherbo Linux detection (Closes: #755804)

[ Pascal Hambourg ]
* Sort Linux kernels in reverse version order if no boot loader config file
found (Closes: #741889)

[ Sergei Galkin ]
* Add ntfs3 for 5.15 kernel.

[ rakslice ]
* detect alpine initramfs files

[ Luke Shumaker ]
* Fall back to looking for /usr/lib/os-release.

[ Debian Janitor ]
* Bump debhelper from deprecated 9 to 13.
* Set debhelper-compat version in Build-Depends.
* Remove constraints unnecessary since buster:
+ Build-Depends: Drop versioned constraint on dpkg-dev.
+ os-prober-udeb: Drop versioned constraint on anna in Depends.

-- Holger Wansing <[email protected]> Thu, 26 May 2022 23:16:53 +0200

os-prober (1.79) unstable; urgency=medium

* Team upload
Expand Down
1 change: 0 additions & 1 deletion debian/compat

This file was deleted.

6 changes: 3 additions & 3 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ Section: debian-installer
Priority: optional
Maintainer: Debian Install System Team <[email protected]>
Uploaders: Colin Watson <[email protected]>, Steve McIntyre <[email protected]>
Build-Depends: debhelper (>= 9), dpkg-dev (>= 1.15.7)
Build-Depends: debhelper-compat (= 13)
Standards-Version: 3.9.4
Vcs-Browser: https://salsa.debian.org/installer-team/os-prober
Vcs-Git: https://salsa.debian.org/installer-team/os-prober.git

Package: os-prober-udeb
Package-Type: udeb
Architecture: any
Depends: ${misc:Depends}, ${shlibs:Depends}, di-utils-mapdevfs, anna (>= 1.16), grub-mount-udeb [linux-any kfreebsd-any]
Depends: ${misc:Depends}, ${shlibs:Depends}, di-utils-mapdevfs, anna, grub-mount-udeb [linux-any kfreebsd-any]
Provides: os-prober
Description: utility to detect other OSes on a set of drives
This package is to be used by boot loader installers to detect other OSes
Expand All @@ -21,7 +21,7 @@ Description: utility to detect other OSes on a set of drives
Package: os-prober
Architecture: any
Section: utils
Depends: ${shlibs:Depends}, ${misc:Depends}, grub-common [linux-any kfreebsd-any], mount
Depends: ${shlibs:Depends}, ${misc:Depends}, grub-common [linux-any kfreebsd-any], mount [linux-any], freebsd-utils [kfreebsd-any]
Description: utility to detect other OSes on a set of drives
This package detects other OSes available on a system and outputs the
results in a generic machine-readable format.
2 changes: 2 additions & 0 deletions debian/gbp.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[buildpackage]
debian-tag=%(version)s
20 changes: 15 additions & 5 deletions linux-boot-probes/mounted/common/40grub2
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,21 @@ parse_grub_menu () {
fi
;;
initrd)
initrd="$(echo "$2" | sed 's/(.*)//')"
# Initrd same.
if [ "$partition" != "$bootpart" ]; then
initrd="/boot$initrd"
fi
shift
initrd=""
for initrd_path in "$@"; do
# sed hack, as above
initrd_path="$(echo "$initrd_path" | sed 's/(.*)//')"
# Initrd same.
if [ "$partition" != "$bootpart" ]; then
initrd_path="/boot$initrd_path"
fi
if [ -z "$initrd" ]; then
initrd="$initrd_path"
else
initrd="$initrd $initrd_path"
fi
done
;;
"}")
entry_result
Expand Down
6 changes: 4 additions & 2 deletions linux-boot-probes/mounted/common/90fallback
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ for kernpat in /vmlinuz /vmlinux /boot/vmlinuz /boot/vmlinux "/boot/vmlinuz*" \
else
kernbootpart="$partition"
fi
for kernfile in $(eval ls "$mpoint$kernpat" 2>/dev/null); do
for kernfile in $(eval ls -vr "$mpoint$kernpat" 2>/dev/null); do
kernbasefile=$(echo "$kernfile" | sed "s!^$mpoint!!")
if [ -f "$kernfile" ] && [ ! -L "$kernfile" ]; then
initrdname=$(echo "$kernfile" | sed "s/vmlinu[zx]/initrd\*/")
Expand All @@ -34,8 +34,10 @@ for kernpat in /vmlinuz /vmlinux /boot/vmlinuz /boot/vmlinux "/boot/vmlinuz*" \
initrdname3=$(echo "$kernfile" | sed "s/vmlinu[zx]/initramfs\*/" | sed 's/$/.img/')
# And Gentoo's also
initrdname4=$(echo "$kernfile" | sed "s/kernel/initramfs\*/")
# Also Alpine
initrdname5=$(echo "$kernfile" | sed "s/vmlinu[zx]/initramfs\*/")
foundinitrd=0
for initrd in $(eval ls "$initrdname" "$initrdname1" "$initrdname2" "$initrdname3" "$initrdname4" 2>/dev/null); do
for initrd in $(eval ls "$initrdname" "$initrdname1" "$initrdname2" "$initrdname3" "$initrdname4" "$initrdname5" 2>/dev/null); do
if [ "$initrd" != "$kernfile" ] && [ -f "$initrd" ] && [ ! -L "$initrd" ]; then
initrd=$(echo "$initrd" | sed "s!^$mpoint!!")
result "$partition:$kernbootpart::$kernbasefile:$initrd:root=$mappedpartition"
Expand Down
5 changes: 2 additions & 3 deletions os-prober
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ log_output () {
}

: >"$OS_PROBER_TMP/dmraid-map"
DMRAID=$(type dmraid >/dev/null 2>&1 || true)
if [ "$DMRAID" ]; then
dmraid -r -c >"$OS_PROBER_TMP/dmraid-map"
if type dmraid >/dev/null 2>&1; then
dmraid -r -c >"$OS_PROBER_TMP/dmraid-map" || true
fi

on_sataraid () {
Expand Down
2 changes: 1 addition & 1 deletion os-probes/mounted/arm64/20microsoft
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ fi

# Weed out stuff that doesn't apply to us
case "$type" in
ntfs|ntfs-3g) debug "$1 is a NTFS partition" ;;
ntfs3|ntfs|ntfs-3g) debug "$1 is a NTFS partition" ;;
vfat) debug "$1 is a FAT32 partition" ;;
msdos) debug "$1 is a FAT16 partition" ;;
fat) debug "$1 is a FAT partition (mounted by GRUB)" ;;
Expand Down
6 changes: 6 additions & 0 deletions os-probes/mounted/common/90linux-distro
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ if (ls "$dir"/lib*/ld*.so* && [ -d "$dir/boot" ] || ls "$dir"/usr/lib*/ld*.so*)
if [ -e "$dir/etc/os-release" ]; then
short="$(grep ^NAME= "$dir/etc/os-release" | sed 's/^[^=]*=//; s/^['\''"]\(.*\)['\''"]$/\1/; s/\\\(.\)/\1/g; s/[[:space:]].*//')"
long="$(grep ^PRETTY_NAME= "$dir/etc/os-release" | sed 's/^[^=]*=//; s/^['\''"]\(.*\)['\''"]$/\1/; s/\\\(.\)/\1/g')"
elif [ -e "$dir/usr/lib/os-release" ]; then
short="$(grep ^NAME= "$dir/usr/lib/os-release" | sed 's/^[^=]*=//; s/^['\''"]\(.*\)['\''"]$/\1/; s/\\\(.\)/\1/g; s/[[:space:]].*//')"
long="$(grep ^PRETTY_NAME= "$dir/usr/lib/os-release" | sed 's/^[^=]*=//; s/^['\''"]\(.*\)['\''"]$/\1/; s/\\\(.\)/\1/g')"
elif [ -e "$dir/etc/debian_version" ]; then
short="Debian"
long="$(printf "Debian GNU/Linux (%s)\n" "$(cat "$dir/etc/debian_version")")"
Expand Down Expand Up @@ -137,6 +140,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"
Expand Down
6 changes: 4 additions & 2 deletions os-probes/mounted/x86/20microsoft
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ fi

# Weed out stuff that doesn't apply to us
case "$type" in
ntfs|ntfs-3g) debug "$1 is a NTFS partition" ;;
ntfs3|ntfs|ntfs-3g) debug "$1 is a NTFS partition" ;;
vfat) debug "$1 is a FAT32 partition" ;;
msdos) debug "$1 is a FAT16 partition" ;;
fat) debug "$1 is a FAT partition (mounted by GRUB)" ;;
Expand All @@ -31,7 +31,9 @@ if item_in_dir -q bootmgr "$2"; then
for boot in $(item_in_dir boot "$2"); do
bcd=$(item_in_dir bcd "$2/$boot")
if [ -n "$bcd" ]; then
if grep -aqs "W.i.n.d.o.w.s. .1.0" "$2/$boot/$bcd"; then
if grep -aqs "W.i.n.d.o.w.s. .1.1" "$2/$boot/$bcd"; then
long="Windows 11"
elif grep -aqs "W.i.n.d.o.w.s. .1.0" "$2/$boot/$bcd"; then
long="Windows 10"
elif grep -aqs "W.i.n.d.o.w.s. .8" "$2/$boot/$bcd"; then
long="Windows 8"
Expand Down

0 comments on commit fafcc17

Please sign in to comment.