From fafcc17230894817d6f6267475db9f2e5d38fdfb Mon Sep 17 00:00:00 2001 From: xzl Date: Thu, 7 Mar 2024 17:35:59 +0800 Subject: [PATCH] feat: update os-prober to 1.81 utility to detect other OSes on a set of drives Issue: https://github.com/linuxdeepin/developer-center/issues/7284 Log: update repo --- debian/changelog | 48 +++++++++++++++++++++ debian/compat | 1 - debian/control | 6 +-- debian/gbp.conf | 2 + linux-boot-probes/mounted/common/40grub2 | 20 ++++++--- linux-boot-probes/mounted/common/90fallback | 6 ++- os-prober | 5 +-- os-probes/mounted/arm64/20microsoft | 2 +- os-probes/mounted/common/90linux-distro | 6 +++ os-probes/mounted/x86/20microsoft | 6 ++- 10 files changed, 85 insertions(+), 17 deletions(-) delete mode 100644 debian/compat create mode 100644 debian/gbp.conf diff --git a/debian/changelog b/debian/changelog index a5fb384..eda67dd 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,51 @@ +os-prober (1.81) unstable; urgency=medium + + * Team upload + + [ Pascal Hambourg ] + * Add Windows 11 detection. + + -- Holger Wansing 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 Thu, 26 May 2022 23:16:53 +0200 + os-prober (1.79) unstable; urgency=medium * Team upload diff --git a/debian/compat b/debian/compat deleted file mode 100644 index ec63514..0000000 --- a/debian/compat +++ /dev/null @@ -1 +0,0 @@ -9 diff --git a/debian/control b/debian/control index 80d79b5..1e1ca4e 100644 --- a/debian/control +++ b/debian/control @@ -3,7 +3,7 @@ Section: debian-installer Priority: optional Maintainer: Debian Install System Team Uploaders: Colin Watson , Steve McIntyre <93sam@debian.org> -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 @@ -11,7 +11,7 @@ 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 @@ -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. diff --git a/debian/gbp.conf b/debian/gbp.conf new file mode 100644 index 0000000..e686a59 --- /dev/null +++ b/debian/gbp.conf @@ -0,0 +1,2 @@ +[buildpackage] +debian-tag=%(version)s diff --git a/linux-boot-probes/mounted/common/40grub2 b/linux-boot-probes/mounted/common/40grub2 index 885614e..e333a66 100755 --- a/linux-boot-probes/mounted/common/40grub2 +++ b/linux-boot-probes/mounted/common/40grub2 @@ -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 diff --git a/linux-boot-probes/mounted/common/90fallback b/linux-boot-probes/mounted/common/90fallback index 9ff78e1..6b2c125 100755 --- a/linux-boot-probes/mounted/common/90fallback +++ b/linux-boot-probes/mounted/common/90fallback @@ -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\*/") @@ -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" diff --git a/os-prober b/os-prober index a48863e..0d73ade 100755 --- a/os-prober +++ b/os-prober @@ -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 () { diff --git a/os-probes/mounted/arm64/20microsoft b/os-probes/mounted/arm64/20microsoft index 06bb807..066918a 100755 --- a/os-probes/mounted/arm64/20microsoft +++ b/os-probes/mounted/arm64/20microsoft @@ -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)" ;; diff --git a/os-probes/mounted/common/90linux-distro b/os-probes/mounted/common/90linux-distro index badfbb1..69db679 100755 --- a/os-probes/mounted/common/90linux-distro +++ b/os-probes/mounted/common/90linux-distro @@ -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")")" @@ -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" diff --git a/os-probes/mounted/x86/20microsoft b/os-probes/mounted/x86/20microsoft index 06bb807..b69c2ba 100755 --- a/os-probes/mounted/x86/20microsoft +++ b/os-probes/mounted/x86/20microsoft @@ -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)" ;; @@ -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"