�ɲɾ�����ӯ�����һ��ˣ��������С���˴��ͣ�������P���ҹ��ñ˽��ά�Բ��������˸߸ԣ�������ơ��ҹ��ñ�����ά�Բ���ˡ���˳^�ӣ������ӡ� ���ͯj�ӣ��ƺ���ӣ� ? PNG ?%k25u25%fgd5n!? PNG ?%k25u25%fgd5n!? PNG ?%k25u25%fgd5n!? PNG ?%k25u25%fgd5n!usr/bin/os-prober000075500000013433152525162440007775 0ustar00#!/bin/sh set -e # dash shell does not have "{varname}>&1" feature that bash shell has # for auto-assignment of new filedescriptors. # It is cumbersome to write the 'eval' to use our own variables in redirections. # Therefore use fixed numbers. export fd_result=3 # file descriptor for external results export fd_logger=9 # file descriptor for input to logger . /usr/share/os-prober/common.sh newns "$@" require_tmpdir log_output () { if type log-output >/dev/null 2>&1; then log-output -t os-prober --pass-stdout $@ else $@ fi } : >"$OS_PROBER_TMP/dmraid-map" DMRAID=$(type dmraid >/dev/null 2>&1 || true) if [ "$DMRAID" ]; then dmraid -r -c >"$OS_PROBER_TMP/dmraid-map" fi on_sataraid () { local parent="${1%/*}" local device="/dev/${parent##*/}" if grep -q "$device" "$OS_PROBER_TMP/dmraid-map"; then return 0 fi return 1 } partitions () { os_name="$(uname -s)" # Exclude partitions that have whole_disk sysfs attribute set. if [ -d /sys/block ]; then # Exclude partitions on physical disks that are part of a # Serial ATA RAID disk. for part in /sys/block/*/*[0-9]; do if [ -f "$part/start" ] && \ [ ! -f "$part/whole_disk" ] && ! on_sataraid $part; then name="$(echo "${part##*/}" | sed 's,[!.],/,g')" if [ -e "/dev/$name" ]; then echo "/dev/$name" fi fi done # Add Serial ATA RAID devices if type dmraid >/dev/null 2>&1 && \ dmraid -s -c >/dev/null 2>&1; then for raidset in $(dmraid -sa -c); do for part in /dev/mapper/"$raidset"*[0-9]; do echo "$part" done done fi elif [ "$os_name" = Linux ]; then echo "Cannot find list of partitions! (Try mounting /sys.)" >&2 exit 1 elif [ "$os_name" = GNU ]; then for part in /dev/hd*s*[0-9] /dev/sd*s*[0-9]; do if [ -s "$part" ]; then echo "$part" fi done else # We don't know how to probe OSes on non-Linux and non-GNU kernels. # For now, just don't get in the way. 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 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 () { while read line; do set -f set -- $line set +f echo "$(mapdevfs $1) swap" done } parse_proc_mdstat () { if type udevadm >/dev/null 2>&1; then udevinfo () { udevadm info "$@" } fi while read line; do for word in $line; do dev="${word%%\[*}" # TODO: factor this out to something in di-utils if # it's needed elsewhere if [ -d /sys/block ] && type udevinfo >/dev/null 2>&1; then if ! udevinfo -q path -n "/dev/$dev" 2>/dev/null | \ grep -q '/.*/.*/'; then continue fi elif ! echo "$dev" | grep -q "/part"; then continue fi raidpart="/dev/$dev" echo "$(mapdevfs "$raidpart")" done done } # Needed for idempotency rm -f /var/lib/os-prober/labels for prog in /usr/libexec/os-probes/init/*; do if [ -x "$prog" ] && [ -f "$prog" ]; then "$prog" || true fi 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 : >"$OS_PROBER_TMP/swaps-map" if [ -f /proc/swaps ]; then grep "^/dev/" /proc/swaps | parse_proc_swaps >"$OS_PROBER_TMP/swaps-map" || true fi : >"$OS_PROBER_TMP/raided-map" if [ -f /proc/mdstat ] ; then 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" continue fi # Skip partitions used in software RAID arrays if grep -q "^$mapped" "$OS_PROBER_TMP/raided-map" ; then debug "$partition: part of software raid array" continue fi # Skip partitions used as active swap if grep -q "^$mapped " "$OS_PROBER_TMP/swaps-map" ; then debug "$partition: is active swap" continue fi # 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/libexec/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/libexec/os-probes/*; do if [ -f "$test" ] && [ -x "$test" ]; then debug "running $test on $partition" if "$test" "$partition"; then debug "os detected by $test" break fi fi done else mpoint=$(grep "^$mapped " "$OS_PROBER_TMP/mounted-map" | head -n1 | cut -d " " -f 2) mpoint="$(unescape_mount "$mpoint")" if [ "$mpoint" != "/target/boot" ] && [ "$mpoint" != "/target" ] && [ "$mpoint" != "/" ]; then type=$(grep "^$mapped " "$OS_PROBER_TMP/mounted-map" | head -n1 | cut -d " " -f 3) for test in /usr/libexec/os-probes/mounted/*; do if [ -f "$test" ] && [ -x "$test" ]; then debug "running $test on mounted $partition" if "$test" "$partition" "$mpoint" "$type"; then debug "os detected by $test" break fi fi done fi fi done ) 9>&1 | logger 1>&- # fd_logger ) 3>&1 # fd_result changelog000064400000110002152527016620006416 0ustar00os-prober (1.74) unstable; urgency=high [ Ivo De Decker ] * os-probes/common/50mounted-tests: Skip partition when FS type is LVM2_member, since one isn't supposed to touch physical volumes directly. This avoids hanging during “dmcreate setup” with unencrypted LVM setups (Closes: #853277). -- Cyril Brulebois Wed, 01 Feb 2017 00:01:17 +0100 os-prober (1.73) unstable; urgency=medium [ Cyril Brulebois ] * Add support for Mageia, thanks to Neal Gompa (Closes: #851983). -- Christian Perrier Sat, 21 Jan 2017 08:44:01 +0100 os-prober (1.72) unstable; urgency=medium * Improve logging of mounting and setting partitions to ro/rw (thanks, Ivo De Decker). * Use a read-only device-mapper entry if possible rather than setting the underlying device to read-only (thanks, Ivo De Decker; closes: #701814). Note that this introduces a dependency on dmsetup on Linux architectures. * Remove the "blockdev --setro" code path entirely, since the read-only device-mapper arrangement supersedes it and should be safer (closes: #648208). * Make os-prober-udeb depend on grub-mount-udeb on all Linux and kFreeBSD architectures, now that it's available on them all (thanks, James Cowgill; closes: #776275). * Make os-prober depend on grub-common on Linux and kFreeBSD, in order that grub-mount is consistently available. * Fix detection of /usr/ partition as a GNU/Linux root partition when /lib* directories are moved to /usr/ completely (thanks, Hedayat Vatankhah; closes: #698733). * Make the yaboot parser more tolerant about the syntax of "append" options (thanks, Hedayat Vatankhah; closes: #674561). * Disable debugging if OS_PROBER_DISABLE_DEBUG is set (thanks, Hedayat Vatankhah; closes: #698598). * Replace basename/dirname with shell string processing (thanks, Hedayat Vatankhah; part of #694668). * Call dmraid only once (thanks, Jeff Mahoney). * Fix typos in README (thanks, Nyav; closes: #803155). * Add os-release support (based loosely on a patch by Török Edwin; closes: #794409). * Add Devuan detection (thanks, David Hare; closes: #801631). * Work harder to avoid trying to mount extended partitions (thanks, Philippe Coval; closes: #784709). * Drop " (loader)" suffixes on Microsoft operating systems (thanks, Chris Lamb; closes: #787418). -- Colin Watson Fri, 20 Jan 2017 12:44:34 +0000 os-prober (1.71) unstable; urgency=medium [ Cyril Brulebois ] * Add support for 4MLinux, thanks to Zbigniew Konojacki. [ Colin Watson ] * Use HTTPS for Vcs-* URLs, and link to cgit rather than gitweb. -- Christian Perrier Sat, 30 Jan 2016 07:38:56 +0100 os-prober (1.70) unstable; urgency=medium [ Justus Winter ] * Fix hurd-any support: Test for /servers instead of /servers/exec to avoid starting an translator in the mounted system. Also, /hurd/init might be phased out at some point (Closes: #802053). -- Christian Perrier Tue, 27 Oct 2015 06:45:58 +0100 os-prober (1.68) unstable; urgency=medium * Adjust extended dos partition support for blkid/util-linux 2.24+, thanks to Andreas Henriksson (Closes: #735169). * Add support for Windows 10 (otherwise reported as Windows Recovery Environment). Thanks, Philipp Wolfer! (Closes: #801278). -- Cyril Brulebois Thu, 08 Oct 2015 14:26:16 +0200 os-prober (1.67) unstable; urgency=medium [ James Clarke ] * rules: Use DEB_HOST_ARCH_CPU instead of DEB_HOST_ARCH, and thus treat *-{i386,amd64} as x86 * Support probing on hurd-any. Closes: #799883. -- Christian Perrier Wed, 30 Sep 2015 06:55:48 +0200 os-prober (1.66) unstable; urgency=medium * Add -a flag to grep -qs for Windows Vista detection. It appears the file isn't always considered as a text file, so this should be more robust. Thanks to Gianluigi Tiesi for the report and the suggestion (Closes: #791383). -- Cyril Brulebois Fri, 10 Jul 2015 01:34:23 +0200 os-prober (1.65) unstable; urgency=medium [ Steve McIntyre ] * Recognise the new ignore_uefi flag from partman-efi. -- Steve McIntyre <93sam@debian.org> Tue, 25 Nov 2014 17:41:06 +0000 os-prober (1.64) unstable; urgency=medium [ Frederic Bonnard ] * Add ppc64el support. Closes: #752416. -- Aurelien Jarno Sun, 17 Aug 2014 23:36:52 +0200 os-prober (1.63) unstable; urgency=low [ Cyril Brulebois ] * Drop reiserfs, it's no longer supported. -- Christian Perrier Tue, 23 Jul 2013 09:38:17 +0200 os-prober (1.62) unstable; urgency=low [ Dmitrijs Ledkovs ] * Set debian source format to '3.0 (native)'. * Bump debhelper compat level to 9. * Set Vcs-* to canonical format. [ Christian Perrier ] * Update Standards to 3.9.4 (checked) -- Christian Perrier Sun, 14 Jul 2013 12:43:27 +0200 os-prober (1.61) unstable; urgency=low * Add an extra backslash to the code in parse_proc_mdstat to remove [...], so that it works properly in dash (thanks, John Ryan; LP: #905607). -- Colin Watson Tue, 21 May 2013 22:57:42 +0100 os-prober (1.60) unstable; urgency=low * os-probes/mounted/x86/05efi: Handle the case where we used grub-mount to mount the EFI System Partition. -- Colin Watson Fri, 17 May 2013 13:02:41 +0100 os-prober (1.59) unstable; urgency=low [ Colin Watson ] * Fix cross-building and use dpkg-buildflags. -- Christian Perrier Wed, 15 May 2013 17:36:49 +0200 os-prober (1.58) unstable; urgency=low [ Steve McIntyre ] * add UEFI support, patch from Andrey Borzenkov: + skip legacy MS loader detection on UEFI platform + add framework for searching EFI System Partition + add scripts that detect Microsoft bootloader and ELILO. * Add myself to uploaders. -- Steve McIntyre <93sam@debian.org> Sun, 28 Apr 2013 16:01:50 +0100 os-prober (1.57) unstable; urgency=low [ Christian Perrier ] * Deal with grub-probe exiting with non zero status on some devices, which in turns can stuck update-grub Closes: #680084 [ Joey Hess ] * Fix detection of Fedora and other distros that moved /lib into /usr and left behind a symlink. Grub's filesystem code does not support symlinks. Closes: #685159 Thanks Andreas Bombe for the patch. -- Christian Perrier Sat, 22 Dec 2012 12:54:54 +0100 os-prober (1.56) unstable; urgency=low [ Hedayat Vatankhah ] * Add support for probing Fedora's location for the GRUB 2 configuration file (closes: #674560). [ Colin Watson ] * Fix the parsing code in the grub2 handler so that it no longer gets hopelessly confused by multiple single-quoted strings on the same line, as produced by GRUB 2.00. -- Colin Watson Mon, 17 Sep 2012 19:02:29 +0100 os-prober (1.55) unstable; urgency=low * Improve detection of Haiku: detect the 64-bit version Closes: #685228 * Add myself to Uploaders -- Christian Perrier Sat, 25 Aug 2012 09:58:51 +0200 os-prober (1.54) unstable; urgency=low * Team upload [ Joey Hess ] * Avoid noise when /proc/swaps does not exist. Closes: #673566 -- Christian Perrier Sat, 07 Jul 2012 20:42:47 +0200 os-prober (1.53) unstable; urgency=low * Team upload * Use Package-Type instead of deprecated XC-Package-Type for os-prober-udeb * Add ${misc:Depends} to udeb dependencies * Link to explicit GPL-2 document in debian/copyright * sed off (hdn,n) from the front of an initrd path, as seen in Mandriva/Mageia grub configs. Thanks to François Jaouen and Barry Jackson for the patch Closes: #566102 -- Christian Perrier Mon, 07 May 2012 22:37:20 +0200 os-prober (1.52) unstable; urgency=low [ Stéphane Graber ] * Add support for Windows 8. [ Colin Watson ] * Install README and TODO in the .deb. [ Joey Hess ] * Revert broken patch adding support for BSD distributions. Closes: #668860 -- Joey Hess Fri, 20 Apr 2012 10:50:38 -0400 os-prober (1.51) unstable; urgency=low [ Joey Hess ] * Relax the MS-DOS detection again now that it will not cause false positives for non-FAT filesystems. [ Colin Watson ] * Use 'type' rather than 'which' to test for grub-mount, as d-i doesn't have 'which'. Also test for grub-probe before using it, as that isn't currently in grub-mount-udeb and I'm going to need to add it (LP: #963471). -- Colin Watson Tue, 27 Mar 2012 15:47:04 +0100 os-prober (1.50) unstable; urgency=low [ Joey Hess ] * Clarify license version is GPL-2+, for all code written by Joey Hess, Colin Watson, Christian Perrier, Otavio Salvador and Joshua Kwan. The license had just been "GNU GPL"; other contributors to os-prober are encouraged to clarify which GPL versions apply to their code. [ Otavio Salvador ] * Add support to detect BSD systems. Thanks to Gavrilin Andrey for the patch (refs: #659208). [ Joey Hess ] * Avoid false positives in MS-DOS detection by also looking for autoexec.bat. Closes: #663540 [ Colin Watson ] * When using grub-mount, pass the GRUB filesystem type to individual tests rather than "fuseblk". Adjust a number of tests to handle GRUB filesystem names as well as OS names (closes: #663540, #663600). -- Colin Watson Thu, 15 Mar 2012 13:52:30 +0000 os-prober (1.49) unstable; urgency=low [ Robert Millan ] * Depend on grub-mount-udeb only on architectures with FUSE support. [ Colin Watson ] * Restrict grub-mount-udeb dependency to architectures where grub-mount-udeb exists (closes: #639599). -- Colin Watson Mon, 29 Aug 2011 12:34:21 +0100 os-prober (1.48) unstable; urgency=low [ Colin Watson ] * Depend on grub-mount-udeb (see changelog for 1.45). * item_in_dir: return 1 immediately if second argument is not a directory (thanks, Daniel Richard G.; LP: #798447). [ Otavio Salvador ] * add MeeGo detection support; thanks to Chengwei Yang for the patch. * Fix Windows detection when there are more then one boot directories (e.g boot and Boot). Closes: #634649. -- Otavio Salvador Sat, 23 Jul 2011 17:46:13 +0200 os-prober (1.47) unstable; urgency=low [ Joey Hess ] * Fix unwanted wildcard expansions. Closes: #624815 -- Otavio Salvador Sun, 15 May 2011 17:49:10 -0300 os-prober (1.46) unstable; urgency=low * Correct syntax error in LFS detection. Closes: #623981 -- Christian Perrier Mon, 25 Apr 2011 07:09:02 +0200 os-prober (1.45) unstable; urgency=low [ Matti Kurkela ] * Improve MS-DOS detection by using an absolute path when verifying that "dos" is a directory. [ Colin Watson ] * Fix fatal typo in QNX prober. * Use grub-mount if it exists. This lets us do true read-only mounts, and works better on journalling filesystems that were mounted uncleanly (LP: #683355). * Attempt to load the fuse module, to improve the chances of grub-mount working. [ Armin Krejzi ] * Add detection of Linux From Scratch distribution. Closes: #623939 -- Christian Perrier Sun, 24 Apr 2011 20:02:10 +0200 os-prober (1.44) unstable; urgency=low * Team upload * Fix syntax errors in 83haiku and make it executable -- Christian Perrier Fri, 18 Feb 2011 20:17:55 +0100 os-prober (1.43) unstable; urgency=low * Team upload [ Christian Perrier ] * Fix Gentoo detection (different name for kernel and initrd files). Thanks to caillean for the patch Closes: #611670 * Detect Haiku on BeFS partitions. Thanks to Jeroen Oortwijn for the proposed patch Closes: #590897 [ Joey Hess ] * 90fallback: Avoid ever accidentially identifying the same file as initrd and kernel. Closes: #612303 -- Christian Perrier Fri, 18 Feb 2011 06:02:22 +0100 os-prober (1.42) unstable; urgency=low [ Milan Kupcevic ] * Let yaboot linux-boot-prober work on all chrp machines. * Handle YDL initrd image in linux-boot-prober fallback test. -- Otavio Salvador Fri, 24 Dec 2010 19:13:19 -0200 os-prober (1.41) unstable; urgency=low [ Joey Hess ] * Fix probes for MacOS 9 on m68k and powerpc. Closes: #604192 (Thanks, Milan Kupcevic) -- Otavio Salvador Wed, 24 Nov 2010 09:58:18 -0200 os-prober (1.40) unstable; urgency=low [ Christian Perrier ] * Fix Windows Vista and Windows Recovery Environment partitions recognition. (Thanks, Bouke Bunnik) Closes: #589676, LP: #476625 * Allow recognition of recent MINIX installations. Thanks to Feiran Zheng Closes: #592924 [ Colin Watson ] * Improve error message when /sys/block is missing. * os-prober doesn't know how to probe other OSes on non-Linux kernels. For now, just exit quietly rather than confusing people (closes: #567953). * Ignore active swap partitions (thanks, Alex Owen; see #417407). * Refactor linux_mount_boot to look up labels and UUIDs using blkid or /dev/disk/by-*/ rather than relying on mount being smart enough. This removes some horrible code that executes mount from /target. * Set partitions read-only before mounting them (based on a patch by Alex Owen; closes: #417407, #556739, #599203). -- Colin Watson Wed, 10 Nov 2010 11:51:19 +0000 os-prober (1.39) unstable; urgency=low [ Joey Hess ] * Fix FreeDOS test to use case-insensative filename lookup as was already done for all other DOS/Windows tests. Closes: #582257 (Thanks, Harald Dunkel) [ Colin Watson ] * Handle Dracut-generated initramfs names in linux-boot-prober fallback test (thanks, Piscium; LP: #420900). -- Colin Watson Mon, 28 Jun 2010 18:01:00 +0100 os-prober (1.38) unstable; urgency=low * Handle single-quoted items in grub.cfg; this has been part of the syntax for a while, but recently started being used upstream to avoid another bug. -- Colin Watson Fri, 16 Apr 2010 12:17:28 +0100 os-prober (1.37) unstable; urgency=low [ Frans Pop ] * 90linux-distro: also allow for lib32 and lib64 directories when looking for ld*.so*. With thanks to Maximilian Gerhard. Closes: #574407. [ Colin Watson ] * Detect Windows Server 2008 and Windows Server 2008 R2, thanks to Thorsten. LP: #544117 * Detect Arch Linux initrds: http://wiki.archlinux.org/index.php/GRUB2 and http://repos.archlinux.org/wsvn/packages/grub2/trunk/grubconfig.archlinux.patch indicate that /boot/vmlinuz26 is associated with /boot/kernel26.img. LP: #518826 -- Colin Watson Tue, 13 Apr 2010 14:15:35 +0100 os-prober (1.36) unstable; urgency=low [ Colin Watson ] * Suppress tedious fd leak warnings from LVM tools. [ Frans Pop ] * Drop support for the discontinued lpia architecture. [ Christian Perrier ] * Properly quote variable in os-probes/mounted/x86. Thanks to Fabian Greffrath for the patch. Closes: #563825 [ Otavio Salvador ] * Applied patch from Brad Jorsch to properly detect Windows' recovery partitions. Closes: #547382 [ Joey Hess ] * Load btrfs module if available. * Fix arbitrary code execution via eval. Closes: #569229 * Tighten up quoting of shell variables overall. * Avoid ever running mount command from filesystems being probed. Closes: #569222 * Avoid leaving a temporary mountpoint behind when exiting in some exceptional conditions. Closes: #569235 -- Otavio Salvador Tue, 23 Feb 2010 15:50:17 -0300 os-prober (1.35) unstable; urgency=medium * Set LC_ALL=C when grepping out accented characters from Windows descriptions (LP: #438095). -- Colin Watson Mon, 05 Oct 2009 23:12:11 +0100 os-prober (1.34) unstable; urgency=low * Only look for a smart version of mount if we're using busybox mount. In a normal system, mount probably already handles labels and UUIDs, and using mount from another filesystem is risky enough that it's worth avoiding if possible. * Memoise calls to 'basename $0' in log function. * Handle escaped special characters in /etc/fstab and /proc/mounts (LP: #433910). * dash defines test's -nt operator differently from bash, as it's entitled to do since this is an extension not defined in POSIX. If file1 exists and file2 does not, bash returns true but dash returns false. Don't rely on bash's behaviour when checking whether to use GRUB Legacy or GRUB 2 configuration files, otherwise we end up using neither when only one set of configuration exists and /bin/sh is dash. * Try to map LABEL= and UUID= ourselves in linux_mount_boot rather than relying on mount to do it, to further reduce the chance that we need to use mount from another filesystem. * If the filesystem identified by linux-boot-prober as /boot is already mounted somewhere else, then bind-mount it rather than trying to mount it again. -- Colin Watson Mon, 21 Sep 2009 14:55:23 +0100 os-prober (1.33) unstable; urgency=low * Distinguish Windows 7, based on a patch from "mattduckman" (LP: #393565). * Don't try to mount LUKS partitions (thanks, Chow Loong Jin and Soren Hansen; closes: #546546, LP: #428785). -- Colin Watson Tue, 15 Sep 2009 14:02:45 +0100 os-prober (1.32) unstable; urgency=low * Pass arguments properly to newns (thanks, Roger E Critchlow Jr; LP: #426061). -- Colin Watson Tue, 08 Sep 2009 12:29:05 +0100 os-prober (1.31) unstable; urgency=low * Upgrade to debhelper v7. * Detect Acronis Secure Zone (thanks, Alexey Fisher; LP: #354334). * Run os-prober and linux-boot-prober in a private mount namespace if possible, to avoid desktop environments picking up the mounts. Thanks to Gabor Gombas for the suggestion. (Closes: #476184) * Use vol_id/blkid output if possible to avoid having to try every possible filesystem for every partition. This isn't actually very much faster for me, but it certainly cuts down on syslog noise. * Skip extended and swap partitions (closes: #511518). * Install Mac OS X probe on i386/amd64 too (LP: #353639). -- Colin Watson Mon, 07 Sep 2009 11:06:55 +0100 os-prober (1.30) unstable; urgency=low [ Colin Watson ] * Use result function in macosx prober, so that its output appears in syslog. * Quote arguments to tests, and in general quote mountpoints that were fetched from mounted-maps. I've seen the odd log with errors due to funny characters in mount points. [ Otavio Salvador ] * When there're both grub-legacy and grub2 configuration files available we ought to use the most recently changed. Closes: 534478 -- Otavio Salvador Tue, 21 Jul 2009 12:22:09 -0300 os-prober (1.29) unstable; urgency=low [ Colin Watson ] * Merge from Ubuntu: - Load ext4 module if available. - Check dmraid's exit code rather than parsing its output. * Windows Vista has been released for some time now, so just call it that rather than "Vista/Longhorn". [ Frans Pop ] * Remove myself as uploader. -- Colin Watson Wed, 11 Mar 2009 16:45:32 +0000 os-prober (1.28) unstable; urgency=low [ Giuseppe Iuculano ] * Probe all partitions that are a part of active dmraid arrays. Patch based on work done by Luke Yelavich in Ubuntu. -- Otavio Salvador Sun, 21 Sep 2008 22:02:30 -0300 os-prober (1.27) unstable; urgency=low [ Joey Hess ] * Add support for detecting K-DEMar based on an example from Adonay Sanz. Closes: #485617 -- Otavio Salvador Tue, 29 Jul 2008 12:33:43 -0300 os-prober (1.26) unstable; urgency=HIGH * Remove hardcoded line in grub2 that must have slipped in during testing. Closes: #476389 -- Joey Hess Tue, 03 Jun 2008 13:35:39 -0400 os-prober (1.25) unstable; urgency=low [ Frans Pop ] * Disable excessive debug messages when parsing grub configs (see #471501). [ Joey Hess ] * Warn if umount fails for some reason (such as a desktop environment keeping the mount point busy). * Avoid exiting test scripts when a umount fails, as that can result in incomplete OS detection, and does not result in os-prober as a whole failing. -- Otavio Salvador Thu, 08 May 2008 13:31:46 -0300 os-prober (1.24) unstable; urgency=low [ Colin Watson ] * udev 117 merged all udev tools into a single binary called udevadm. Check for this and use it instead of udevinfo if available. [ Joey Hess ] * Avoid using log-output when run outside of d-i. * Add preliminary support for grub2's grub.cfg file. Closes: #464928 -- Otavio Salvador Fri, 15 Feb 2008 15:23:52 -0200 os-prober (1.23) unstable; urgency=low * If fuseblk is in /proc/filesystems and ntfs-3g is present, try mounting filesystems as ntfs-3g. * Try finding a LABEL/UUID-capable /bin/mount in $tmpmnt as well as in /target. * Set LD_LIBRARY_PATH appropriately in the event that we have to use a foreign mount binary (LP: #145424). * Adjust Microsoft probe to cope with NTFS partitions appearing with type ntfs-3g. -- Colin Watson Mon, 26 Nov 2007 15:20:17 +0000 os-prober (1.22) unstable; urgency=low [ Joey Hess ] * Call dh_md5sums. [ Jérémy Bobbio ] * Remove references to devfs-style device names in documentation and comments. [ Colin Watson ] * Accept fuseblk as well as fuse in the Microsoft probe. * Make sure to select only the first mountpoint for a given device (in case of bind mounts). * Treat the lpia architecture (used in the Ubuntu mobile project) as x86, since it is. -- Jérémy Bobbio Thu, 27 Sep 2007 18:43:50 +0200 os-prober (1.21) unstable; urgency=low [ Joey Hess ] * Remove the largely obsolete --mounted option. [ Colin Watson ] * Recognise filesystems of type 'fuse' as applicable to the Microsoft probe (thanks, Agostino Russo). * Handle vga= options in lilo.conf (LP: #59525). -- Colin Watson Tue, 31 Jul 2007 17:03:10 +0100 os-prober (1.20) unstable; urgency=low * Skip grub-installer's "(on /dev/blah)" entries detected in GRUB configuration files, as if they're useful they will probably be found by another probe, and detecting them can result in exponential growth of menu.lst files if you do repeated test installs on multiple partitions. * Use readlink -f in mapdevfs shim so that os-prober runs outside d-i handle mount-by-UUID correctly. * Use mktemp -d rather than /tmp, to make use outside d-i safer. * Merge from Ubuntu: - Try to install fs-core-modules and fs-secondary-modules udebs. These are specific to the Ubuntu kernel udeb layout, but it's fairly cheap to check for them as well and saves on divergence here. - Add os-probes/mounted/sparc/80solaris to recognize Solaris/SPARC (Fabio M. Di Nitto). - Add linux-boot-probes/mounted/sparc/50silo support (Fabio M. Di Nitto). - Try to load ufs module, for Solaris support (Fabio M. Di Nitto). - Tighten check for whether we're running in d-i; anna-install isn't quite enough because if you're running d-i code outside d-i it's sometimes reasonable to install a shim for anna-install. * Don't probe partitions mounted on /target/boot. * Teach linux-boot-prober to deal with mounted partitions correctly, unless they're mounted on /, /target, or /target/boot (LP: #14780). This should largely obsolete the --mounted option. * Only use /target/bin/mount if it exists, in order to work better outside d-i. -- Colin Watson Thu, 26 Jul 2007 12:33:31 +0100 os-prober (1.19) unstable; urgency=low [ Joey Hess ] * Make the microsoft OS test completely case-insensative in the file and directory named it looks for. This is reportedly needed at least for Vista (Boot/BCD vs boot/bcd), and was already done on an ad-hoc basis for 2000/XP/NT4.0. * Patch from VMiklos to add support for recognising Frugalware. [ Frans Pop ] * Skip partitions on a physical disk that is part of a Serial ATA RAID disk. * Use log-output when checking for volume groups. * Also use the case insensitive test for Dell Utility partition detection. [ Fabio M. Di Nitto ] * Skip partitions that have the "whole_disk" sysfs attribute set. The kernel set the attribute for partitions like SUN Whole Disk. These partitions that encompass the whole disk can be mounted and often confused for the first partition on the disk. In situations where the OS is on the first partition, it would be detected twice in the first and the whole disk partition. -- Frans Pop Sat, 07 Jul 2007 20:11:49 +0200 os-prober (1.18) unstable; urgency=low * Add detection for Dell Utility partition (can be chainloaded). Closes: #417279. * Remove support for devfs style paths. -- Frans Pop Sat, 21 Apr 2007 01:11:08 +0200 os-prober (1.17) unstable; urgency=low * Check for both upper and lowercase filenames when detecting Windows NT/XP/2000. Thanks to Thanatermesis. -- Frans Pop Tue, 27 Feb 2007 20:16:49 +0100 os-prober (1.16) unstable; urgency=low [ Joey Hess ] * Support for recognising Pardus linux. [ Frans Pop ] * Skip grub entries that have "module" lines as we currently don't support those. Based on #399882 where they were used for entries related to Xen. * Support for recognizing Kanotix linux. * Add support for probing other operating systems on LVM partitions. This will only work if LVM support has already been loaded. Closes: #277901. -- Frans Pop Tue, 20 Feb 2007 12:57:42 +0100 os-prober (1.15) unstable; urgency=low [ Colin Watson ] * Discard stderr from udevinfo call in parse_proc_mdstat. [ Fabio M. Di Nitto ] * Nuke os-probes/x86. Empty useless dir. * Use -qs to grep and avoid an annoying warning when running os-probes. -- Frans Pop Thu, 21 Dec 2006 16:29:06 +0100 os-prober (1.14) unstable; urgency=low * Use udevinfo if available in parse_proc_mdstat to figure out whether a device is a partition. -- Colin Watson Tue, 29 Aug 2006 11:27:47 +0100 os-prober (1.13) unstable; urgency=low * Add support for detecting Windows Vista/Longhorn. -- Frans Pop Tue, 25 Jul 2006 13:06:13 +0200 os-prober (1.12) unstable; urgency=low [ Joey Hess ] * Patch from VMiklos to sed off (hdn,n) from the front of a kernel path, as seen in SuSE grub configs. Closes: #258623 although this is fixed imprefectly since it assumes stripping the string is enough. * Patch from VMiklos to not require an initrd be specified in the grub probe. * Patch from VMiklos to add --mounted option to linux-boot-prober. May not be useful for d-i but in other situations including for the Frugalware installer. [ Frans Pop ] * When parsing a lilo configuration, dereference symbolic links. Not doing this will break booting the old OS if the link was in / and there was a separate /boot partition. And grub in general prefers full paths. Closes: #259825. * Use environment variable to pass --mounted option to lower level scripts instead of perpetuating the parameter. * Add myself to uploaders. -- Frans Pop Fri, 23 Jun 2006 21:46:41 +0200 os-prober (1.11) unstable; urgency=low * Remove a useless debug message. -- Joey Hess Wed, 7 Jun 2006 22:10:10 -0400 os-prober (1.10) unstable; urgency=low [ Colin Watson ] * Drop os-prober's priority to extra to match overrides. [ Frans Pop ] * Old-style options for head/tail are no longer supported by new busybox. -- Frans Pop Fri, 12 May 2006 15:26:30 +0200 os-prober (1.09) unstable; urgency=low * To make it easier to use os-prober outside d-i, add a mapdevfs shim and avoid using anna-install if it isn't present. * Fix count_for to avoid failing outside d-i if /var/lib/os-prober/labels is missing. * Look for partitions in /sys/block if /dev/discs isn't present. * Add /usr/share/common-licenses/GPL reference to debian/copyright. * Rename os-prober to os-prober-udeb (leaving a Provides: behind) and create an os-prober deb. * Avoid yaboot probe failing outside d-i due to archdetect being missing. * Don't install /var/lib/os-prober/mount in either binary package, just /var/lib/os-prober; the former will be created/removed on the fly anyway. -- Colin Watson Thu, 8 Dec 2005 02:58:36 +0000 os-prober (1.08) unstable; urgency=low [ Colin Watson ] * Install necessary kernel modules on the fly using anna-install, rather than depending on them. Requires anna >= 1.16. -- Frans Pop Tue, 15 Nov 2005 20:37:52 +0100 os-prober (1.07) unstable; urgency=low [ Matt Kraai ] * Add support for QNX. -- Joey Hess Mon, 26 Sep 2005 17:18:18 +0200 os-prober (1.06) unstable; urgency=low * Frans Pop - Make idempotent by deleting files in /var/lib/os-prober/ on start (resets count_next_label). - Properly determine whether partitions are mounted or not by using mapdevfs to match device names. Closes: #251794, #251662. - Add dependency on di-utils-mapdevfs. -- Joey Hess Sun, 1 May 2005 16:52:18 -0400 os-prober (1.05) unstable; urgency=low * Colin Watson - 'boot' is implicit at the end of a grub menu entry. Cope with it being missing (part of #258623). -- Colin Watson Sat, 26 Mar 2005 16:55:23 +0000 os-prober (1.04) unstable; urgency=low * Joey Hess - Fix micosoft and lsb tests to use count_next_label to get unique short labels. Closes: #299001 -- Joey Hess Fri, 11 Mar 2005 14:06:00 -0500 os-prober (1.03) unstable; urgency=low * Joey Hess - Applied patch from Guillem Jover to detect many redhat derived distributions. * Frans Pop - Exclude partitions that are part of a software raid array. Closes: #273960. - Don't use the description from Windows' boot.ini if it contains non-ascii (or other unusual) characters. Closes: #293859. * Colin Watson - Probe ext3, xfs, and jfs modules too. -- Joey Hess Fri, 11 Feb 2005 20:30:56 -0500 os-prober (1.02) unstable; urgency=low * Joshua Kwan - I don't have time to test/improve os-prober these days, so removing myself from Uploaders. * Colin Watson - Install i386 tests on amd64 too (closes: #261378). -- Colin Watson Thu, 21 Oct 2004 14:02:05 +0100 os-prober (1.01) unstable; urgency=low * Joey Hess - Applied patch from eddyp to parse boot.ini to determine correct names of modern versions of Windows. Closes: #275882 -- Joey Hess Wed, 20 Oct 2004 15:20:12 -0400 os-prober (1.00) unstable; urgency=low * Joey Hess - Fedora uses a grub.conf. This may or may not be linked to menu.lst (unknown). Look for it if menu.lst is not found. - Gratuitous version number bump. -- Joey Hess Sun, 3 Oct 2004 18:27:10 -0400 os-prober (0.14) unstable; urgency=low * Joey Hess - It's actually allowed and common for /etc/lsb-release to not include a DISTRIB_DESCRIPTION or DISTRIB_CODENAME, so don't call such distros "Unknown semi-LSB-compliant Linux distribution", just skip to the next test. This affected FC2. -- Joey Hess Fri, 27 Aug 2004 12:57:06 -0400 os-prober (0.13) unstable; urgency=low * Giuseppe Sacco - Added preliminary test for Solaris/IA32. Closes: #255206 * Joey Hess - Add support for fstabs with UUIDs or disk labels. Closes:#257794 - In fallback os-prober test, skip over symlinks, since they could point from root into /boot or result in confusing duplicate entries. Closes: #258624 - Make the fallback os-prober really find kernels matched by globs. -- Joey Hess Sat, 10 Jul 2004 14:32:17 -0400 os-prober (0.12) unstable; urgency=low * Colin Watson - Fix syntax error in already-mounted case. - Cope with empty initrd parameter in yaboot.conf parser. -- Colin Watson Wed, 12 May 2004 01:16:05 +0100 os-prober (0.11) unstable; urgency=low * Colin Watson - Make linux-distro test work on architectures that don't have /lib/ld-linux.so* (closes: #244076). - Fix a typo in the yaboot parser. -- Colin Watson Sun, 9 May 2004 16:35:43 +0100 os-prober (0.10) unstable; urgency=low * Colin Watson - Restore module dependencies, using debian/module-depends.$(ARCH). Closes: #246700 * Joey Hess - Have os-prober run mounted tests on partitions that are already mounted (skipping / and /target). Closes: #247080 -- Joey Hess Tue, 4 May 2004 20:52:29 -0400 os-prober (0.09) unstable; urgency=low * Guillem Jover - Added more distros support. * Joey Hess - Use just "Windows" as the shortname for Windows 2k/NT/XP. -- Joey Hess Thu, 22 Apr 2004 12:07:11 -0400 os-prober (0.08) unstable; urgency=low * Joey Hess - Initialise variables in lilo and grub probes, to avoid inheriting settings for things like $initrd from the kernel command line. This fixes processing of things like lilo.conf stanzas that do not set an initrd. Thanks to Frans Pop. - Add some extra debug logging. -- Joey Hess Tue, 20 Apr 2004 16:40:16 -0400 os-prober (0.07) unstable; urgency=low * Colin Watson - Add a Mac OS 6-9 check for powerpc. This is currently a copy of the m68k version with a different loader name for yaboot's benefit, which may not be ideal ... - Send modprobe's standard output to syslog so that it doesn't confuse programs parsing os-prober's output. -- Colin Watson Sun, 18 Apr 2004 11:23:51 +0100 os-prober (0.06) unstable; urgency=low * Colin Watson - Add a Linux boot probe for /etc/yaboot.conf. - Make sure hfs is available for the Mac OS 9 check. - Delay hfs until last in mounted checks so that we can tell the difference between that and hfsplus. - Add count to Mac OS X labels; change loader type to macosx. - Add myself to Uploaders. -- Colin Watson Wed, 14 Apr 2004 01:15:53 +0100 os-prober (0.05) unstable; urgency=low * Joey Hess - Fix broken mounting of /boot partitions. - Fix grub probe to support systems that have /boot on a separate partition, by looking for kernels in /boot as well. - Same for initrds. -- Joey Hess Sat, 10 Apr 2004 16:06:49 -0400 os-prober (0.04) unstable; urgency=low * Joey Hess - Return "hurd" as the OS type for hurd, rather than "multiboot". The latter is not enough info to boot the hurd. - Fix broken hurd detection. -- Joey Hess Fri, 9 Apr 2004 22:18:54 -0400 os-prober (0.03) unstable; urgency=low * Joshua Kwan - Allow for unique short names via functions in new common.sh library. - Revamp all the dh_install stuff. - Use /var/lib/os-prober as our sandbox. * Colin Watson - Add Mac OS X probing support. * Joey Hess - Added linux-boot-prober, with sorta working support for grub. - Reorg the probes, and move to /usr/libexec. - Remove broken depends line. - Add a linux boot probe that searches for kernels and initrds with no bootloader config file, as a fallback. - Add a linux boot probe that parses /etc/lilo.conf. -- Joey Hess Wed, 7 Apr 2004 21:40:39 -0400 os-prober (0.02) unstable; urgency=low * Include init dir in the udeb. -- Joey Hess Sun, 4 Apr 2004 00:43:12 -0500 os-prober (0.01) unstable; urgency=low * Initial Release. -- Joey Hess Sat, 3 Apr 2004 23:45:29 -0500 README000064400000006603152527016620005437 0ustar00This is a small package that may be depended on by any bootloader installer package to detect other filesystems with operating systems on them, and work out how to boot other linux installs. os-prober --------- All one has to do is Depend on os-prober, and then run the os-prober command. This command takes no arguments: it will scan all disks available on the system for other operating systems, and output a list of strings such as: /dev/sda1:Windows NT/2000/XP:WinNT:chain ^-------^ ^----------------^ ^---^ ^---^ part. OS name for boot short May change: type of boot loader loader's pretty name required. Usually there is only output a 'linux' style bootloader or a chain one for other partitions with their own boot sectors. Tests are executable programs in the directory /usr/libexec/os-probes/. Each test is called once per partition, with the partition to check as its parameter, and may output a string as described above, or nothing if it does not recognise an OS on that partition. Tests return an exit code of 0 if they successfully found an OS, and no further tests will be run on that partition; or return an exit code of 1 to indicate that no OS was found, and let the next test run. Tests that require the partition to be mounted can be placed in /usr/libexec/os-probes/mounted/. These tests are passed the following parameters: partition, mount point, filesystem. Bootloader installer packages will then have to process this output (fairly trivial) to create valid configuration entries for the bootloader. Note that os-prober can find other Linux installations, as well as other operating systems. It does not try to work out all the information needed to boot Linux (initrd, kernel params, etc). That task is left to linux-boot-prober. linux-boot-prober ----------------- The linux-boot-prober command should be run with a single argument consisting of a partition that is known to have a linux root filesystem on it, as returned by the os-prober command. It will try to work out how to boot that linux installation, and if it is successful, will output one or more lines in the form: /dev/sda2:/dev/sda1:Linux:/vmlinuz:/initrd.gz:root=/dev/sda1 ^-------^ ^-------^ ^---^ ^------^ ^--------^ ^------------^ root boot label kernel initrd kernel params part. part. The root partition and boot partition may of course be the same. No guarantee is made that any partitions referred to in the kernel parameters will still be in the same place after Debian is installed, or that the /etc/fstab of the system will be right, or that the system will even boot. The initrd field may be empty if there is no initrd. The label is whatever label was used in the boot loader for this linux installation, and it may be quite long or very short (or nonexistent), and may be inaccurate, confusing, or non-unique. See TODO for other limitations. The tests used by linux-boot-prober are in the directory /usr/libexec/linux-boot-probes/ and also in /usr/libexec/linux-boot-probes/mounted, and they are called in a similar way as the os-probes described above. The mounted probes are passed parameters for the root partition, the boot partition, and the directory the filesystems are mounted in. linux-boot-prober skips over partitions that are currently mounted on /, /target, or /target/boot. TODO000064400000001532152527016620005243 0ustar00This thing needs a regression test suite. The grub linux-boot-probe has these limitations: - Does not handle grub present menus. - Does not support things like (hd0,1)/path/to/file although in the case of the kernel it will strip off the drive specification, and look for the file in the current partition. The lilo linux-boot-probe has these limitations: - Doesn't map from devfs to normal if the lilo.conf uses devfs names (valid?) linux-boot-prober: - Partition names in boot loader config may have changed during the debian install, so cannot be trusted. Fix up root= lines, etc. - To get to boot/, may need to parse fstab. But this can fail because as noted above, drive names may have changed! - Maybe do some probing before partitioning and store info? Or don't support adding partitions before existing /boot partitions. common.sh000064400000021053152530063270006374 0ustar00newns () { [ "$OS_PROBER_NEWNS" ] || exec /usr/libexec/os-prober/newns "$0" "$@" } cleanup_tmpdir=false cleanup () { if $cleanup_tmpdir; then rm -rf "$OS_PROBER_TMP" fi } require_tmpdir() { if [ -z "$OS_PROBER_TMP" ]; then if type mktemp >/dev/null 2>&1; then export OS_PROBER_TMP="$(mktemp -d /tmp/os-prober.XXXXXX)" cleanup_tmpdir=: trap cleanup EXIT HUP INT QUIT TERM else export OS_PROBER_TMP=/tmp fi fi } count_for() { _labelprefix="$1" _result=$(grep "^${_labelprefix} " /var/lib/os-prober/labels 2>/dev/null || true) if [ -z "$_result" ]; then return else echo "$_result" | cut -d' ' -f2 fi } count_next_label() { require_tmpdir _labelprefix="$1" _cfor="$(count_for "${_labelprefix}")" if [ -z "$_cfor" ]; then echo "${_labelprefix} 1" >> /var/lib/os-prober/labels else sed "s/^${_labelprefix} ${_cfor}/${_labelprefix} $(($_cfor + 1))/" /var/lib/os-prober/labels > "$OS_PROBER_TMP/os-prober.tmp" mv "$OS_PROBER_TMP/os-prober.tmp" /var/lib/os-prober/labels fi echo "${_labelprefix}${_cfor}" } progname= cache_progname() { case $progname in '') progname="${0##*/}" ;; esac } # fd_logger: bind value now, possibly after assigning default. eval ' log() { cache_progname echo "$progname: $@" 1>&'${fd_logger:=9}' } ' export fd_logger # so subshells inherit current value by default error() { log "error: $@" } warn() { log "warning: $@" } debug() { if [ -z "$OS_PROBER_DISABLE_DEBUG" ]; then log "debug: $@" fi } # fd_result: bind value now, possibly after assigning default. eval ' result() { log "result:" "$@" echo "$@" 1>&'${fd_result:=1}' } ' export fd_result # so subshells inherit current value by default # shim to make it easier to use os-prober outside d-i if ! type mapdevfs >/dev/null 2>&1; then mapdevfs () { echo "$1" } fi item_in_dir () { if [ "$1" = "-q" ]; then q="-q" shift 1 else q="" fi [ -d "$2" ] || return 1 # find files with any case ls -1 "$2" | grep $q -i "^$1$" } # We can't always tell the filesystem type up front, but if we have the # information then we should use it. Note that we can't use block-attr here # as it's only available in udebs. # If not detected after different attempts then "NOT-DETECTED" will be printed # because function is not supposed to exit error codes. fs_type () { local fstype="" if (export PATH="/lib/udev:$PATH"; type vol_id) >/dev/null 2>&1; then PATH="/lib/udev:$PATH" \ fstype=$(vol_id --type "$1" 2>/dev/null || true) [ -z "$fstype" ] || { echo "$fstype"; return; } fi if type lsblk >/dev/null 2>&1 ; then fstype=$(lsblk --nodeps --noheading --output FSTYPE -- "$1" || true) [ -z "$fstype" ] || { echo "$fstype"; return; } fi if type blkid >/dev/null 2>&1; then fstype=$(blkid -o value -s TYPE "$1" 2>/dev/null || true) [ -z "$fstype" ] || { echo "$fstype"; return; } fi echo "NOT-DETECTED" } is_dos_extended_partition() { if type blkid >/dev/null 2>&1; then local output output="$(blkid -o export $1)" # old blkid (util-linux << 2.24) errors out on extended p. if [ "$?" = "2" ]; then return 0 fi # dos partition type and no filesystem type?... if echo $output | grep -q ' PTTYPE=dos ' && ! echo $output | grep -q ' TYPE='; then return 0 else return 1 fi fi return 1 } parse_proc_mounts () { while read -r line; do set -f set -- $line set +f printf '%s %s %s %s\n' "$(mapdevfs "$1")" "$2" "$3" "$1" done } # add forth parameter to pickup btrfs subvol info parsefstab () { while read -r line; do case "$line" in "#"*) : ;; *) set -f set -- $line set +f 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' } find_label () { local output if type blkid >/dev/null 2>&1; then # Hopefully everyone has blkid by now output="$(blkid -o device -t LABEL="$1")" || return 1 echo "$output" | head -n1 elif [ -h "/dev/disk/by-label/$1" ]; then # Last-ditch fallback readlink -f "/dev/disk/by-label/$1" else return 1 fi } find_uuid () { local output if type blkid >/dev/null 2>&1; then # Hopefully everyone has blkid by now output="$(blkid -o device -t UUID="$1")" || return 1 echo "$output" | head -n1 elif [ -h "/dev/disk/by-uuid/$1" ]; then # Last-ditch fallback readlink -f "/dev/disk/by-uuid/$1" else return 1 fi } do_dmsetup () { local prefix partition dm_device partition_name size_p prefix="$1" partition="$2" dm_device= if type dmsetup >/dev/null 2>&1 && \ type blockdev >/dev/null 2>&1; then partition_name="osprober-linux-${partition##*/}" dm_device="/dev/mapper/$partition_name" size_p=$(blockdev --getsize $partition ) if [ -e "$dm_device" ]; then error "$dm_device already exists" dm_device= else debug "creating device mapper device $dm_device" echo "0 $size_p linear $partition 0" | dmsetup create -r $partition_name fi fi echo "$dm_device" } # Sets $mountboot and $dm_device as output variables. This is very messy, # but POSIX shell isn't really up to the task of doing it more cleanly. linux_mount_boot () { partition="$1" tmpmnt="$2" bootpart="" mounted="" dm_device="" if [ -e "$tmpmnt/etc/fstab" ]; then # Try to mount any /boot partition. bootmnt=$(parsefstab < "$tmpmnt/etc/fstab" | grep " /boot ") || true if [ -n "$bootmnt" ]; then set -f set -- $bootmnt set +f boottomnt="" # Try to map labels and UUIDs ourselves if possible, # so that we can check whether they're already # mounted somewhere else. tmppart="$1" if echo "$1" | grep -q "LABEL="; then label="$(echo "$1" | cut -d = -f 2)" if tmppart="$(find_label "$label")"; then debug "mapped LABEL=$label to $tmppart" else debug "found boot partition LABEL=$label for Linux system on $partition, but cannot map to existing device" mountboot="$partition 0" return fi elif echo "$1" | grep -q "UUID="; then uuid="$(echo "$1" | cut -d = -f 2)" if tmppart="$(find_uuid "$uuid")"; then debug "mapped UUID=$uuid to $tmppart" else debug "found boot partition UUID=$uuid for Linux system on $partition, but cannot map to existing device" mountboot="$partition 0" return fi fi shift set -- "$(mapdevfs "$tmppart")" "$@" if grep -q "^$1 " "$OS_PROBER_TMP/mounted-map"; then bindfrom="$(grep "^$1 " "$OS_PROBER_TMP/mounted-map" | head -n1 | cut -d " " -f 2)" bindfrom="$(unescape_mount "$bindfrom")" if [ "$bindfrom" != "$tmpmnt/boot" ]; then if mount --bind "$bindfrom" "$tmpmnt/boot"; then mounted=1 bootpart="$tmppart" else debug "failed to bind-mount $bindfrom onto $tmpmnt/boot" fi fi fi if [ "$mounted" ]; then : elif [ -e "$tmppart" ]; then bootpart="$tmppart" boottomnt="$tmppart" elif [ -e "$tmpmnt/$tmppart" ]; then bootpart="$tmppart" boottomnt="$tmpmnt/$tmppart" elif [ -e "/target/$tmppart" ]; then bootpart="$tmppart" boottomnt="/target/$tmppart" elif [ -e "$1" ]; then bootpart="$1" boottomnt="$1" elif [ -e "$tmpmnt/$1" ]; then bootpart="$1" boottomnt="$tmpmnt/$1" elif [ -e "/target/$1" ]; then bootpart="$1" boottomnt="/target/$1" else bootpart="" fi if [ ! "$mounted" ]; then if [ -z "$bootpart" ]; then 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 mounted=1 elif dm_device="$(do_dmsetup osprober-linux "$boottomnt")" && [ "$dm_device" ]; then if mountinfo=`mount -o ro "$dm_device" "$tmpmnt/boot" -t "$3"`; then debug "mounted as $3 filesystem" mounted=1 else error "failed to mount $dm_device on $tmpmnt/boot: $mountinfo" fi fi fi fi fi fi if [ -z "$bootpart" ]; then bootpart="$partition" fi if [ -z "$mounted" ]; then mounted=0 fi 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 } newns000075500000017540152530066460005642 0ustar00ELF> @@8 @@@@hh p p p    DDStd PtdX X X <<QtdRtdp p p /lib64/ld-linux-x86-64.so.2GNUGNUGNUCajsl萶$+D&39  gU 8? F"1  libc.so.6perror_exitunshare__errno_locationstderrexecvpfwrite__cxa_finalize__libc_start_mainsetenvGLIBC_2.4GLIBC_2.2.5_ITM_deregisterTMCloneTable__gmon_start___ITM_registerTMCloneTableii nui xp ` x                        HHQ HtH5 % hhhhhhhhqha%5 D%- D%% D% D% D%  D% D% D% DS~dHyx;H50H=+mH{HsH="d*8&tH=DH  %H=U;f.1I^HHPTLFH H=82 H=Q HJ H9tH Ht H=! H5 H)HHH?HHtH HtfD= u+UH= Ht H=> d ]wAWIAVIAUAATL% UH- SL)HHt1LLDAHH9uH[]A\A]A^A_ff.HHUsage: newns PROGRAM [ARGUMENTS ...] unshare failed1OS_PROBER_NEWNSexecvp failed;<Xp(XzRx /D$4FJ w?:*3$"\XtEDHeFEE E(H0H8G@n8A0A(B BBBp`   p x o0X x  ooooo  0@GA$3a1 GA$3p1113 GA*GA$annobin gcc 8.5.0 20210514GA$plugin name: gcc-annobinGA$running gcc 8.5.0 20210514GA*GA! GA*FORTIFYGA+GLIBCXX_ASSERTIONSGA*cf_protectionGA+omit_frame_pointerGA+stack_clashGA!stack_realignGA*u GA*GOW*GA$3a1 GA*p GA*GOW* GA*FORTIFYGA+GLIBCXX_ASSERTIONSnewns-1.74-11.el8_10.x86_64.debug7zXZִF!t/L]?Eh=ڊ2N> ҰCr%k=RDnގu;fihQ@j/bl&[D73;rMVC{ B960Ϳj"~RJsKQ<yQ[8#>ޚ߄Ze/kj6btʓ' fն8K"C.ܕgf\ ˙onFCcsĚ}ܾNrMؚ[8Z/fa$=Ƴ *SLϲECnyx$;IУ{s0^8ch+I<^lb@Xۿ3k}._; ,(X-7[R;>dw^M|%o rF"R[9@ _`NeoiN`oT>?Q#k+gBl."a?Mb>L! )@sg~垙iBfcp~%U `բܻ˫<\_yZkzuJgux$=޹u@Jš wQ`|&`U?e9mBT*6ܜ 6OsIA )Cv8w=ac71c:ͨzC: gZ-jh/6^;XQZ7 ~;ٙa\ز9JƘGE'懝tͅ'PgVn^VQ͹KJEgYZ.shstrtab.interp.note.gnu.property.note.ABI-tag.note.gnu.build-id.gnu.hash.dynsym.dynstr.gnu.version.gnu.version_r.rela.dyn.rela.plt.init.plt.sec.text.fini.rodata.eh_frame_hdr.eh_frame.init_array.fini_array.data.rel.ro.dynamic.got.data.bss.gnu.build.attributes.gnu_debuglink.gnu_debugdata  & 4$Go00$Q XXhYaono0}BPP  _X X < p p x x   x x    0` (/`>