os-prober-1.63ubuntu1/0000755000000000000000000000000012170177216011571 5ustar os-prober-1.63ubuntu1/TODO0000644000000000000000000000153211515765547012276 0ustar This 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. os-prober-1.63ubuntu1/common.sh0000644000000000000000000001441611734461321013421 0ustar newns () { [ "$OS_PROBER_NEWNS" ] || exec /usr/lib/os-prober/newns "$0" "$@" } cleanup_tmpdir=false cleanup_ro_partitions= cleanup () { local partition for partition in $cleanup_ro_partitions; do blockdev --setrw "$partition" done 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="$(basename "$0")" ;; esac } log() { cache_progname logger -t "$progname" "$@" } error() { log "error: $@" } warn() { log "warning: $@" } debug() { log "debug: $@" } result () { log "result:" "$@" echo "$@" } # shim to make it easier to use os-prober outside d-i if ! type mapdevfs >/dev/null 2>&1; then mapdevfs () { readlink -f "$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. fs_type () { if (export PATH="/lib/udev:$PATH"; type vol_id) >/dev/null 2>&1; then PATH="/lib/udev:$PATH" vol_id --type "$1" 2>/dev/null elif type blkid >/dev/null 2>&1; then blkid -o value -s TYPE "$1" 2>/dev/null else return 0 fi } parse_proc_mounts () { while read -r line; do set -f set -- $line set +f printf '%s %s %s\n' "$(mapdevfs "$1")" "$2" "$3" done } parsefstab () { while read -r line; do case "$line" in "#"*) : ;; *) set -f set -- $line set +f printf '%s %s %s\n' "$1" "$2" "$3" ;; esac done } unescape_mount () { printf %s "$1" | \ sed 's/\\011/ /g; s/\\012/\n/g; s/\\040/ /g; s/\\134/\\/g' } ro_partition () { if type blockdev >/dev/null 2>&1 && \ [ "$(blockdev --getro "$1")" = 0 ] && \ blockdev --setro "$1"; then cleanup_ro_partitions="${cleanup_ro_partitions:+$cleanup_ro_partitions }$1" trap cleanup EXIT HUP INT QUIT TERM fi } 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 } # Sets $mountboot as output variable. (We do this rather than requiring a # subshell so that we can run ro_partition without the cleanup trap firing # when the subshell exits.) linux_mount_boot () { partition="$1" tmpmnt="$2" bootpart="" mounted="" 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="$1" else debug "failed to bind-mount $bindfrom onto $tmpmnt/boot" fi fi fi if [ "$mounted" ]; then : 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 else ro_partition "$boottomnt" if mount -o ro "$boottomnt" "$tmpmnt/boot" -t "$3"; then mounted=1 else error "failed to mount $boottomnt on $tmpmnt/boot" fi fi fi fi fi fi if [ -z "$bootpart" ]; then bootpart="$partition" fi if [ -z "$mounted" ]; then mounted=0 fi mountboot="$bootpart $mounted" } os-prober-1.63ubuntu1/debian/0000755000000000000000000000000012277125546013022 5ustar os-prober-1.63ubuntu1/debian/os-prober.docs0000644000000000000000000000001411737440163015572 0ustar README TODO os-prober-1.63ubuntu1/debian/os-prober-udeb.install0000644000000000000000000000012611515765547017243 0ustar os-prober linux-boot-prober bin newns usr/lib/os-prober common.sh usr/share/os-prober os-prober-1.63ubuntu1/debian/os-prober.dirs0000777000000000000000000000000011515765547021327 2os-prober-udeb.dirsustar os-prober-1.63ubuntu1/debian/rules0000755000000000000000000000225312144725552014100 0ustar #! /usr/bin/make -f # debhelper rules for os-prober # (C) 2004 Joshua Kwan %: dh $@ ARCH=$(shell dpkg-architecture -qDEB_HOST_ARCH) ifneq (,$(findstring :$(ARCH):,:i386:amd64:)) ARCH=x86 endif DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE)) CC := gcc else CC := $(DEB_HOST_GNU_TYPE)-gcc endif export DEB_CFLAGS_MAINT_APPEND := -Os -Wall CFLAGS := $(shell dpkg-buildflags --get CPPFLAGS; dpkg-buildflags --get CFLAGS) LDFLAGS := $(shell dpkg-buildflags --get LDFLAGS) override_dh_auto_build: $(MAKE) CC=$(CC) CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" override_dh_install: dh_install for probes in os-probes os-probes/mounted os-probes/init \ linux-boot-probes linux-boot-probes/mounted; do \ dh_install $$probes/common/* usr/lib/$$probes; \ if [ -e "$$probes/$(ARCH)" ]; then \ dh_install $$probes/$(ARCH)/* usr/lib/$$probes; \ fi; \ done ifeq ($(ARCH),x86) dh_install os-probes/mounted/powerpc/20macosx usr/lib/os-probes/mounted endif cp -a debian/os-prober-udeb/usr/lib debian/os-prober/usr/ os-prober-1.63ubuntu1/debian/os-prober.install0000644000000000000000000000013211515765547016323 0ustar os-prober linux-boot-prober usr/bin newns usr/lib/os-prober common.sh usr/share/os-prober os-prober-1.63ubuntu1/debian/copyright0000644000000000000000000000073211752027630014747 0ustar The majority of code in os-prober is Copyright 2004-2011 by Joshua Kwan, Joey Hess, Christian Perrier, Colin Watson and Otavio Salvador. This is licensed $under the terms of the GNU GPL, either version 2 or, at your option, any later version. Some portions of os-prober by other contributors has an unclear license of "GNU GPL", with the version not specified. On Debian systems, a copy of the GNU General Public License is available in /usr/share/common-licenses/GPL-2. os-prober-1.63ubuntu1/debian/os-prober-udeb.dirs0000644000000000000000000000002211515765547016531 0ustar var/lib/os-prober os-prober-1.63ubuntu1/debian/source/0000755000000000000000000000000012170177216014313 5ustar os-prober-1.63ubuntu1/debian/source/format0000644000000000000000000000001512170177216015522 0ustar 3.0 (native) os-prober-1.63ubuntu1/debian/compat0000644000000000000000000000000212170177216014211 0ustar 9 os-prober-1.63ubuntu1/debian/control0000644000000000000000000000263312277125504014423 0ustar Source: os-prober Section: debian-installer Priority: optional Maintainer: Ubuntu Developers XSBC-Original-Maintainer: Debian Install System Team Uploaders: Colin Watson , Joey Hess , Christian Perrier , Steve McIntyre <93sam@debian.org> Build-Depends: debhelper (>= 9), dpkg-dev (>= 1.15.7) Standards-Version: 3.9.4 XS-Debian-Vcs-Browser: http://anonscm.debian.org/gitweb/?p=d-i/os-prober.git XS-Debian-Vcs-Git: git://anonscm.debian.org/d-i/os-prober.git Vcs-Bzr: http://bazaar.launchpad.net/~ubuntu-core-dev/os-prober/ubuntu Package: os-prober-udeb Package-Type: udeb Architecture: any Depends: ${misc:Depends}, ${shlibs:Depends}, di-utils-mapdevfs, anna (>= 1.16), grub-mount-udeb [i386 amd64 powerpc ppc64 sparc mipsel kfreebsd-i386 kfreebsd-amd64] 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 available on a system, in a generic format, which it can then adapt to its own configuration format. Package: os-prober Architecture: any Section: utils Priority: extra Depends: ${shlibs:Depends}, ${misc:Depends} 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. os-prober-1.63ubuntu1/debian/changelog0000644000000000000000000010765712277125537014714 0ustar os-prober (1.63ubuntu1) trusty; urgency=medium * Resynchronise with Debian. Remaining changes: - Mount btrfs subvolume @ when present to access a btrfs formatted rootfs. - When called with WINOSDATA, return the list of Windows partitions containing the system instead of only listing these containing the bootrecord. -- Colin Watson Thu, 13 Feb 2014 11:24:13 +0000 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.61ubuntu1) saucy; urgency=low * Resynchronise with Debian. Remaining changes: - Mount btrfs subvolume @ when present to access a btrfs formatted rootfs. - When called with WINOSDATA, return the list of Windows partitions containing the system instead of only listing these containing the bootrecord. -- Colin Watson Tue, 21 May 2013 23:03:55 +0100 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.59ubuntu2) saucy; urgency=low * Re-enable os-probes/mounted/x86/20microsoft on EFI systems if WINOSDATA is set. -- Colin Watson Mon, 20 May 2013 12:42:06 +0100 os-prober (1.59ubuntu1) saucy; urgency=low * Resynchronise with Debian (LP: #1178072). Remaining changes: - Mount btrfs subvolume @ when present to access a btrfs formatted rootfs. - When called with WINOSDATA, return the list of Windows partitions containing the system instead of only listing these containing the bootrecord. -- Matthew Fischer Wed, 08 May 2013 21:42:12 -0600 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.57ubuntu1) raring; urgency=low * Resynchronise with Debian (LP: #1038093). Remaining changes: - Mount btrfs subvolume @ when present to access a btrfs formatted rootfs. - When called with WINOSDATA, return the list of Windows partitions containing the system instead of only listing these containing the bootrecord. -- Dmitrijs Ledkovs Tue, 05 Feb 2013 11:25:43 +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.56ubuntu1) quantal; urgency=low * Resynchronise with Debian (LP: #1050774). Remaining changes: - Mount btrfs subvolume @ when present to access a btrfs formatted rootfs. - When called with WINOSDATA, return the list of Windows partitions containing the system instead of only listing these containing the bootrecord. -- Colin Watson Tue, 18 Sep 2012 00:05:11 +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.54ubuntu1) quantal; urgency=low * Resynchronise with Debian. Remaining changes: - Mount btrfs subvolume @ when present to access a btrfs formatted rootfs. - When called with WINOSDATA, return the list of Windows partitions containing the system instead of only listing these containing the bootrecord. (LP: #772470) -- Stéphane Graber Mon, 09 Jul 2012 10:54:52 -0400 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.52ubuntu1) quantal; urgency=low * Resynchronise with Debian. Remaining changes: - Mount btrfs subvolume @ when present to access a btrfs formatted rootfs. - When called with WINOSDATA, return the list of Windows partitions containing the system instead of only listing these containing the bootrecord. (LP: #772470) -- Stéphane Graber Wed, 02 May 2012 09:14:38 -0400 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.51ubuntu3) precise; urgency=low * When called with WINOSDATA, return the list of Windows partitions containing the system instead of only listing these containing the bootrecord. (LP: #772470) -- Stéphane Graber Wed, 04 Apr 2012 18:34:56 -0400 os-prober (1.51ubuntu2) precise; urgency=low * Add support for Windows 8. -- Stéphane Graber Wed, 04 Apr 2012 13:30:28 -0400 os-prober (1.51ubuntu1) precise; urgency=low * Resynchronise with Debian. Remaining changes: - Mount btrfs subvolume @ when present to access a btrfs formatted rootfs. -- Colin Watson Tue, 27 Mar 2012 18:48:08 +0100 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.50ubuntu1) precise; urgency=low * Resynchronise with Debian. Remaining changes: - Mount btrfs subvolume @ when present to access a btrfs formatted rootfs. -- Colin Watson Thu, 15 Mar 2012 15:13:49 +0000 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.49ubuntu1) oneiric; urgency=low [ Surbhi Palande ] * mount btrfs subvolume @ when present to access a btrfs formatted rootfs. (LP: #764893) -- Colin Watson Fri, 16 Sep 2011 14:01:36 +0100 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/lib. - 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 os-prober-1.63ubuntu1/linux-boot-probes/0000755000000000000000000000000011515765547015175 5ustar os-prober-1.63ubuntu1/linux-boot-probes/mounted/0000755000000000000000000000000011515765547016650 5ustar os-prober-1.63ubuntu1/linux-boot-probes/mounted/sparc/0000755000000000000000000000000011557401076017746 5ustar os-prober-1.63ubuntu1/linux-boot-probes/mounted/sparc/50silo0000755000000000000000000000475211557401076021017 0ustar #!/bin/sh . /usr/share/os-prober/common.sh set -e partition="$1" bootpart="$2" mpoint="$3" type="$4" found_item=0 title="" rootdev="" kernel="" parameters="" initrd="" read_only="" default_rootdev="" default_kernel="" default_parameters="" default_initrd="" default_read_only="" dequote () { item="${1%\"}" echo "${item#\"}" } recordstanza () { if [ -n "$kernel" ] && [ -n "$title" ]; then if [ -e "$mpoint/$kernel" ] || [ -e "$mpoint/boot$kernel" ]; then if [ -e "$mpoint/boot$initrd" ] || [ -e "$mpoint/$initrd" ]; then if [ "$read_only" ]; then parameters="ro $parameters" fi if [ "$rootdev" ]; then parameters="root=$rootdev $parameters" fi parameters="${parameters% }" result "$rootpart:$bootpart:$title:$kernel:$initrd:$parameters" found_item=1 else debug "cannot find $initrd, not recording" fi else debug "cannot find $kernel, not recording" fi title="" rootdev="$default_rootdev" kernel="$default_kernel" parameters="$default_parameters" initrd="$default_initrd" read_only="$default_read_only" else # Everything before set default values. default_rootdev="$rootdev" default_kernel="$kernel" default_parameters="$parameters" default_initrd="$initrd" default_read_only="$read_only" fi } parse_silo_conf () { mpoint="$1" rootpart="$2" bootpart="$3" IFS=" =" while read line; do debug "parsing: $line" set -f set -- $line set +f case "$1" in root) rootdev=$(dequote "$2") ;; image) recordstanza # Dereference if symbolic link if echo "$2" | grep -qs "/boot/"; then kernel="$(readlink -f "$(dequote "$mpoint$2")" | sed -e 's#'"$mpoint"'##g')" else kernel="$(readlink -f "$(dequote "$mpoint/boot$2")" | sed -e 's#'"$mpoint"'/boot##g')" fi ;; append) shift 1 parameters=$(dequote "${line#append=}") ;; initrd) # Dereference if symbolic link if echo "$2" | grep -qs "/boot/"; then initrd="$(readlink -f "$(dequote "$mpoint$2")" | sed -e 's#'"$mpoint"'##g')" else initrd="$(readlink -f "$(dequote "$mpoint/boot$2")" | sed -e 's#'"$mpoint"'/boot##g')" fi ;; label) shift 1 title=$(dequote "$*" | sed -e 's/:/ /g') ;; other) recordstanza ;; read-only) read_only=1 ;; esac done recordstanza } if [ -e "$mpoint/boot/silo.conf" ]; then debug "parsing silo.conf" parse_silo_conf "$mpoint" "$partition" "$bootpart" < "$mpoint/boot/silo.conf" fi if [ "$found_item" = 0 ]; then exit 1 else exit 0 fi os-prober-1.63ubuntu1/linux-boot-probes/mounted/common/0000755000000000000000000000000012025743767020135 5ustar os-prober-1.63ubuntu1/linux-boot-probes/mounted/common/90fallback0000755000000000000000000000371511524643264021773 0ustar #!/bin/sh # Fallback in case nothing else works. Look for vmlinu[xz] file in root and # /boot, see if there is a matching initrd, and wing it. . /usr/share/os-prober/common.sh set -e partition="$1" bootpart="$2" mpoint="$3" type="$4" mappedpartition=$(mapdevfs "$partition" 2>/dev/null) || mappedpartition="$partition" exitcode=1 for kernpat in /vmlinuz /vmlinux /boot/vmlinuz /boot/vmlinux "/boot/vmlinuz*" \ "/boot/vmlinux*" "/vmlinuz*" "/vmlinux*" "/kernel-*" "/boot/kernel-*"; do if echo "$kernpat" | grep -q boot/; then kernbootpart="$bootpart" else kernbootpart="$partition" fi for kernfile in $(eval ls "$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\*/") # Yellow Dog Linux appends .img to it. initrdname1="${initrdname}.img" # Arch Linux names its initrds weirdly. We take # some care here to avoid false positives on other # systems, since kernel.img could conceivably be a # kernel itself. initrdname2=$(echo "$kernfile" | sed -n 's/vmlinu[zx]\([0-9][0-9]*\)/kernel\1/p' | sed 's/$/.img/') # Dracut initramfses are named differently again. initrdname3=$(echo "$kernfile" | sed "s/vmlinu[zx]/initramfs\*/" | sed 's/$/.img/') # And Gentoo's also initrdname4=$(echo "$kernfile" | sed "s/kernel/initramfs\*/") foundinitrd=0 for initrd in $(eval ls "$initrdname" "$initrdname1" "$initrdname2" "$initrdname3" "$initrdname4" 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" exitcode=0 foundinitrd=1 fi done if [ "$foundinitrd" = 0 ]; then result "$partition:$kernbootpart::$kernbasefile::root=$mappedpartition" exitcode=0 fi fi done done exit "$exitcode" os-prober-1.63ubuntu1/linux-boot-probes/mounted/common/40grub20000755000000000000000000000474712025743767021264 0ustar #!/bin/sh . /usr/share/os-prober/common.sh set -e partition="$1" bootpart="$2" mpoint="$3" type="$4" found_item=0 entry_result () { if [ "$ignore_item" = 0 ] && \ [ -n "$kernel" ] && \ [ -e "$mpoint/$kernel" ]; then result "$rootpart:$bootpart:$title:$kernel:$initrd:$parameters" found_item=1 fi kernel="" parameters="" initrd="" title="" ignore_item=0 } parse_grub_menu () { mpoint="$1" rootpart="$2" bootpart="$3" kernel="" parameters="" initrd="" title="" ignore_item=0 while read line; do debug "parsing: $line" set -f set -- $line set +f case "$1" in menuentry) entry_result shift 1 # The double-quoted string is the title. # Make sure to look at the text of the line # before 'set' mangled it. title="$(echo "$line" | sed -n 's/[^"]*"\(.*\)".*/\1/p' | sed 's/://g')" if [ -z "$title" ]; then # ... or single-quoted? Be careful # to handle constructions like # 'foo'\''bar' (which expands to # foo'bar, as in shell), and to # handle multiple single-quoted # strings on the same line. title="$(echo "$line" | sed -n "s/[^']*'\(\([^']\|'\\\\''\)*\)'.*/\1/p" | sed "s/'\\\\''/'/; s/://g")" fi if [ -z "$title" ]; then ignore_item=1 elif echo "$title" | grep -q '(on /dev/[^)]*)$'; then log "Skipping entry '$title':" log "appears to be an automatic reference taken from another menu.lst" ignore_item=1 fi ;; linux) # Hack alert: sed off any (hdn,n) but # assume the kernel is on the same # partition. kernel="$(echo "$2" | sed 's/(.*)//')" shift 2 parameters="$@" # Systems with a separate /boot will not have # the path to the kernel in grub.cfg. if [ "$partition" != "$bootpart" ]; then kernel="/boot$kernel" fi ;; initrd) initrd="$(echo "$2" | sed 's/(.*)//')" # Initrd same. if [ "$partition" != "$bootpart" ]; then initrd="/boot$initrd" fi ;; "}") entry_result ;; esac done entry_result } if [ -e "$mpoint/boot/grub/grub.cfg" ] && \ ([ ! -e "$mpoint/boot/grub/menu.lst" ] || \ [ "$mpoint/boot/grub/grub.cfg" -nt "$mpoint/boot/grub/menu.lst" ]); then debug "parsing grub.cfg" parse_grub_menu "$mpoint" "$partition" "$bootpart" < "$mpoint/boot/grub/grub.cfg" elif [ -e "$mpoint/boot/grub2/grub.cfg" ]; then debug "parsing grub.cfg" parse_grub_menu "$mpoint" "$partition" "$bootpart" < "$mpoint/boot/grub2/grub.cfg" fi if [ "$found_item" = 0 ]; then exit 1 else exit 0 fi os-prober-1.63ubuntu1/linux-boot-probes/mounted/x86/0000755000000000000000000000000011752026445017263 5ustar os-prober-1.63ubuntu1/linux-boot-probes/mounted/x86/40grub0000755000000000000000000000414311752025762020317 0ustar #!/bin/sh . /usr/share/os-prober/common.sh set -e partition="$1" bootpart="$2" mpoint="$3" type="$4" found_item=0 entry_result () { if [ "$ignore_item" = 0 ] && \ [ -n "$kernel" ] && \ [ -e "$mpoint/$kernel" ]; then result "$rootpart:$bootpart:$title:$kernel:$initrd:$parameters" found_item=1 fi kernel="" parameters="" initrd="" title="" ignore_item=0 } parse_grub_menu () { mpoint="$1" rootpart="$2" bootpart="$3" kernel="" parameters="" initrd="" title="" ignore_item=0 while read line; do #debug "parsing: $line" set -f set -- $line set +f case "$1" in title) entry_result shift 1 title="$(echo "$@" | sed 's/://g')" if echo "$title" | grep -q '(on /dev/[^)]*)$'; then log "Skipping entry '$title':" log "appears to be an automatic reference taken from another menu.lst" ignore_item=1 fi ;; kernel) # Hack alert: sed off any (hdn,n) but # assume the kernel is on the same # partition. kernel="$(echo "$2" | sed 's/(.*)//')" shift 2 parameters="$@" # Systems with a separate /boot will not have # the path to the kernel in menu.lst. if [ "$partition" != "$bootpart" ]; then kernel="/boot$kernel" fi ;; initrd) # Hack alert take 2: sed off any (hdn,n) # See #566102 initrd="$(echo "$2" | sed 's/(.*)//')" # Initrd same. if [ "$partition" != "$bootpart" ]; then initrd="/boot$initrd" fi ;; boot) entry_result ;; module) log "Skipping entry '$title':" log "parsing of entries containing 'module' lines is currently not supported" ignore_item=1 ;; esac done entry_result } grubconf= if [ -e "$mpoint/boot/grub/menu.lst" ]; then grubconf="menu.lst" elif [ -e "$mpoint/boot/grub/grub.conf" ]; then grubconf="grub.conf" fi if [ "$grubconf" ] && \ ([ ! -e "$mpoint/boot/grub/grub.cfg" ] || \ [ "$mpoint/boot/grub/$grubconf" -nt "$mpoint/boot/grub/grub.cfg" ]); then debug "parsing $grubconf" parse_grub_menu "$mpoint" "$partition" "$bootpart" < "$mpoint/boot/grub/$grubconf" fi if [ "$found_item" = 0 ]; then exit 1 else exit 0 fi os-prober-1.63ubuntu1/linux-boot-probes/mounted/x86/50lilo0000755000000000000000000000443311557401076020321 0ustar #!/bin/sh . /usr/share/os-prober/common.sh set -e partition="$1" bootpart="$2" mpoint="$3" type="$4" found_item=0 title="" rootdev="" kernel="" parameters="" initrd="" read_only="" added_parameters=0 default_rootdev="" default_kernel="" default_parameters="" default_initrd="" default_read_only="" dequote () { item="${1%\"}" echo "${item#\"}" } addparams () { # Any parameters we find replace the default parameters, but # otherwise append. if [ "$added_parameters" = 0 ]; then parameters="$1" added_parameters=1 else parameters="${parameters:+$parameters }$1" fi } recordstanza () { if [ -n "$kernel" ] && [ -n "$title" ]; then if [ -e "$mpoint/$kernel" ] && [ -e "$mpoint/$initrd" ]; then if [ "$read_only" ]; then parameters="ro $parameters" fi if [ "$rootdev" ]; then parameters="root=$rootdev $parameters" fi parameters="${parameters% }" result "$rootpart:$bootpart:$title:$kernel:$initrd:$parameters" found_item=1 else debug "cannot find $kernel or $initrd, not recording" fi title="" rootdev="$default_rootdev" kernel="$default_kernel" parameters="$default_parameters" initrd="$default_initrd" read_only="$default_read_only" added_parameters=0 else # Everything before set default values. default_rootdev="$rootdev" default_kernel="$kernel" default_parameters="$parameters" default_initrd="$initrd" default_read_only="$read_only" fi } parse_lilo_conf () { mpoint="$1" rootpart="$2" bootpart="$3" IFS=" =" while read line; do debug "parsing: $line" set -f set -- $line set +f case "$1" in root) rootdev=$(dequote "$2") ;; image) recordstanza # Dereference if symbolic link kernel="$(readlink -f "$(dequote "$2")")" ;; append) addparams "$(dequote "${line#append=}")" ;; initrd) # Dereference if symbolic link initrd="$(readlink -f "$(dequote "$2")")" ;; label) shift 1 title="$(dequote "$*" | sed -e 's/:/ /g')" ;; other) recordstanza ;; read-only) read_only=1 ;; vga) addparams "$line" ;; esac done recordstanza } if [ -e "$mpoint/etc/lilo.conf" ]; then debug "parsing lilo.conf" parse_lilo_conf "$mpoint" "$partition" "$bootpart" < "$mpoint/etc/lilo.conf" fi if [ "$found_item" = 0 ]; then exit 1 else exit 0 fi os-prober-1.63ubuntu1/linux-boot-probes/mounted/powerpc/0000755000000000000000000000000011557401076020315 5ustar os-prober-1.63ubuntu1/linux-boot-probes/mounted/powerpc/40yaboot0000755000000000000000000000427311557401076021712 0ustar #!/bin/sh . /usr/share/os-prober/common.sh set -e partition="$1" bootpart="$2" mpoint="$3" type="$4" found_item=0 dequote () { item="${1%\"}" echo "${item#\"}" } recordstanza () { if [ -n "$kernel" ]; then # TODO: handle device=/partition= to find images if ! [ -e "$mpoint/$kernel" ]; then debug "cannot find $kernel; not recording" return fi if [ "$initrd" ] && ! [ -e "$mpoint/$initrd" ]; then debug "cannot find $initrd: not recording" return fi if [ -z "$title" ]; then title="$(basename "$kernel")" fi if [ "$read_only" ]; then parameters="ro $parameters" fi if [ "$rootdev" ]; then parameters="root=$rootdev $parameters" fi parameters="${parameters% }" result "$rootpart:$bootpart:$title:$kernel:$initrd:$parameters" found_item=1 title= rootdev="$default_rootdev" kernel="$default_kernel" parameters="$default_parameters" initrd="$default_initrd" read_only="$default_read_only" else # Everything in the global options section set default values. default_rootdev="$rootdev" default_kernel="$kernel" default_parameters="$parameters" default_initrd="$initrd" default_read_only="$read_only" fi } parse_yaboot_conf () { mpoint="$1" rootpart="$2" bootpart="$3" IFS=" =" while read line; do debug "parsing: $line" set -f set -- $line set +f case "$1" in root) rootdev="$(dequote "$2")" ;; image) recordstanza kernel="$(dequote "$2")" ;; append) shift 1 parameters="$(dequote "${line#append=}")" ;; initrd) initrd="$(dequote "$2")" ;; label) shift 1 title="$(dequote "$*")" ;; alias) shift 1 titlealias="$(dequote "$*")" ;; read-only) read_only=1 ;; esac done recordstanza } # Avoid failing if archdetect is missing (running outside d-i). This is # suboptimal but will do for now. if type archdetect >/dev/null 2>&1; then case "`archdetect`" in powerpc/powermac_newworld) ;; powerpc/chrp*) ;; *) exit 1 ;; esac fi if [ -e "$mpoint/etc/yaboot.conf" ]; then debug "parsing yaboot.conf" parse_yaboot_conf "$mpoint" "$partition" "$bootpart" < "$mpoint/etc/yaboot.conf" fi if [ "$found_item" = 0 ]; then exit 1 else exit 0 fi os-prober-1.63ubuntu1/linux-boot-probes/common/0000755000000000000000000000000012277125504016452 5ustar os-prober-1.63ubuntu1/linux-boot-probes/common/50mounted-tests0000755000000000000000000000462512277125504021367 0ustar #!/bin/sh # Sub-tests that require a mounted partition. . /usr/share/os-prober/common.sh set -e partition="$1" types="$(fs_type "$partition")" || types=NOT-DETECTED if [ "$types" = NOT-DETECTED ]; then debug "$1 type not recognised; skipping" exit 0 elif [ "$types" = swap ]; then debug "$1 is a swap partition; skipping" exit 0 elif [ "$types" = crypto_LUKS ]; then debug "$1 is a LUKS partition; skipping" exit 0 elif [ "$types" = ntfs ]; then if type ntfs-3g >/dev/null 2>&1; then types='ntfs-3g ntfs' fi elif [ -z "$types" ]; then if type cryptsetup >/dev/null 2>&1 && \ cryptsetup luksDump "$partition" >/dev/null 2>&1; then debug "$1 is a LUKS partition; skipping" exit 0 fi types="$(grep -v nodev /proc/filesystems)" fi tmpmnt=/var/lib/os-prober/mount if [ ! -d "$tmpmnt" ]; then mkdir "$tmpmnt" fi mounted= if type grub-mount >/dev/null 2>&1 && \ type grub-probe >/dev/null 2>&1 && \ grub-mount "$partition" "$tmpmnt" 2>/dev/null; then mounted=1 type="$(grub-probe -d "$partition" -t fs)" [ "$type" ] || type=fuseblk else ro_partition "$partition" for type in $types; do if mount -o ro -t "$type" "$partition" "$tmpmnt" 2>/dev/null; then mounted=1 case "$type" in btrfs) if [ -x "$tmpmnt/@/lib" ] && \ ! mount --bind "$tmpmnt/@" "$tmpmnt"; then warn "failed to mount btrfs subvolume @ on $partition" if ! umount $tmpmnt; then warn "failed to umount $tmpmnt" fi mounted= fi ;; esac break fi done fi if [ "$mounted" ]; then linux_mount_boot "$partition" "$tmpmnt" bootpart="${mountboot%% *}" mounted="${mountboot#* }" for test in /usr/lib/linux-boot-probes/mounted/*; do if [ -f "$test" ] && [ -x "$test" ]; then debug "running $test $partition $bootpart $tmpmnt $type" if $test "$partition" "$bootpart" "$tmpmnt" "$type"; then debug "$test succeeded" umount "$tmpmnt/boot" 2>/dev/null || true if ! umount "$tmpmnt"; then warn "failed to umount $tmpmnt" fi case $type in btrfs) # umount to account for the bind-mount if [ -x "$tmpmnt/@/lib" ] && \ ! umount $tmpmnt; then warn "failed to umount $tmpmnt" fi ;; esac rmdir "$tmpmnt" || true exit 0 fi fi done umount "$tmpmnt/boot" 2>/dev/null || true if ! umount "$tmpmnt"; then warn "failed to umount $tmpmnt" fi fi rmdir "$tmpmnt" || true # No tests found anything. exit 1 os-prober-1.63ubuntu1/os-prober0000755000000000000000000001024512170177216013431 0ustar #!/bin/sh set -e . /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 } on_sataraid () { type dmraid >/dev/null 2>&1 || return 1 local parent="${1%/*}" local device="/dev/${parent##*/}" if dmraid -r -c | grep -q "$device"; then return 0 fi return 1 } partitions () { # 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 [ "$(uname -s)" = Linux ]; then echo "Cannot find list of partitions! (Try mounting /sys.)" >&2 exit 1 else # We don't know how to probe OSes on non-Linux kernels. For # now, just don't get in the way. exit 0 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 | sed "s|-|--|g;s|^[[:space:]]*\(.*\):\(.*\)$|/dev/mapper/\1-\2|")" fi } 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/lib/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 | parse_proc_mdstat >"$OS_PROBER_TMP/raided-map" || true fi 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 if ! 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" 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/lib/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 os-prober-1.63ubuntu1/Makefile0000644000000000000000000000015512144725552013235 0ustar CFLAGS := -Os -g -Wall all: newns newns: newns.c $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ clean: rm -f newns os-prober-1.63ubuntu1/linux-boot-prober0000755000000000000000000000305111515765547015121 0ustar #!/bin/sh . /usr/share/os-prober/common.sh set -e newns "$@" require_tmpdir grep "^/dev/" /proc/mounts | parse_proc_mounts >"$OS_PROBER_TMP/mounted-map" || true partition="$1" if [ -z "$partition" ]; then echo "usage: linux-boot-prober partition" >&2 exit 1 fi if ! mapped="$(mapdevfs "$partition")"; then log "Device '$partition' does not exist; skipping" continue fi 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 if $test "$partition"; then debug "linux 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) if ! grep -q " $mpoint/boot " "$OS_PROBER_TMP/mounted-map"; then linux_mount_boot "$partition" "$mpoint" bootpart="${mountboot%% *}" bootmounted="${mountboot#* }" else bootpart="$partition" bootmounted=0 fi for test in /usr/lib/linux-boot-probes/mounted/*; do if [ -f $test ] && [ -x $test ]; then debug "running $test on mounted $partition" if $test "$partition" "$bootpart" "$mpoint" "$type"; then debug "$test succeeded" break fi fi done if [ "$bootmounted" = 1 ]; then if ! umount "$mpoint/boot"; then warn "failed to umount $mpoint/boot" fi fi fi fi os-prober-1.63ubuntu1/README0000644000000000000000000000656211515765547012476 0ustar This 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/lib/os-probes/. Each test is called once per partition, with the partiton 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/lib/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/lib/linux-boot-probes/ and also in /usr/lib/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. os-prober-1.63ubuntu1/os-probes/0000755000000000000000000000000011515765547013516 5ustar os-prober-1.63ubuntu1/os-probes/mounted/0000755000000000000000000000000011515765547015171 5ustar os-prober-1.63ubuntu1/os-probes/mounted/sparc/0000755000000000000000000000000011515765547016301 5ustar os-prober-1.63ubuntu1/os-probes/mounted/sparc/80solaris0000755000000000000000000000060211515765547020051 0ustar #!/bin/sh # Attempt to check if solaris is installed in this system # looking at the /etc/system parameters file and /etc/vfstab. set -e . /usr/share/os-prober/common.sh partition="$1" dir="$2" type="$3" if [ -f "$dir/etc/system" ] && [ -f "$dir/etc/vfstab" ]; then label="$(count_next_label Solaris)" result "$partition:Solaris/SPARC:$label:chain" exit 0 else exit 1 fi os-prober-1.63ubuntu1/os-probes/mounted/m68k/0000755000000000000000000000000011515765547015756 5ustar os-prober-1.63ubuntu1/os-probes/mounted/m68k/10macos6-90000755000000000000000000000065711515765547017413 0ustar #!/bin/sh # Probe for OS 9 via System suitcase check. . /usr/share/os-prober/common.sh set -e partition="$1" dir="$2" fstype="$3" case "$fstype" in hfs) debug "Partition is HFS" ;; hfsplus) debug "Partition is HFS+ (Mac OS 9 only, we hope)" ;; esac if [ -e "$dir/System Folder/System" ]; then label="$(count_next_label MacOS)" result "${partition}:Macintosh System 6/7, OS 8/9:${label}:chain" exit 0 else exit 1 fi os-prober-1.63ubuntu1/os-probes/mounted/common/0000755000000000000000000000000012055017431016437 5ustar os-prober-1.63ubuntu1/os-probes/mounted/common/90linux-distro0000755000000000000000000001141712055017431021203 0ustar #!/bin/sh # Test for linux distributions. set -e . /usr/share/os-prober/common.sh partition="$1" dir="$2" type="$3" # 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 # better. Make sure this test has a high number so that more accurate tests # can come first. # Unless volumes to checked are already mounted, they will be mounted using # GRUB's own filesystems through FUSE. Since these ATM doesn't support # symlinks we need to also check in $dir/usr/lib* for distributions that # moved /lib* to /usr and only left symlinks behind. # TODO: look for ld-linux.so on arches that have it if (ls "$dir"/lib*/ld*.so* || ls "$dir"/usr/lib*/ld*.so*) >/dev/null 2>/dev/null; then if [ -e "$dir/etc/debian_version" ]; then short="Debian" long="$(printf "Debian GNU/Linux (%s)\n" "$(cat "$dir/etc/debian_version")")" # RPM derived distributions may also have a redhat-release or # mandrake-release, so check their files first. elif [ -e "$dir/etc/altlinux-release" ]; then short="ALTLinux" long="$(cat "$dir/etc/altlinux-release")" elif [ -e "$dir/etc/magic-release" ]; then short="Magic" long="$(cat "$dir/etc/magic-release")" elif [ -e "$dir/etc/blackPanther-release" ]; then short="blackPanther" long="$(cat "$dir/etc/blackPanther-release")" elif [ -e "$dir/etc/ark-release" ]; then short="Ark" long="$(cat "$dir/etc/ark-release")" elif [ -e "$dir/etc/arch-release" ]; then short="Arch" long="$(cat "$dir/etc/arch-release")" elif [ -e "$dir/etc/asplinux-release" ]; then short="ASPLinux" long="$(cat "$dir/etc/asplinux-release")" elif [ -e "$dir/etc/lvr-release" ]; then short="LvR" long="$(cat "$dir/etc/lvr-release")" elif [ -e "$dir/etc/caos-release" ]; then short="cAos" long="$(cat "$dir/etc/caos-release")" elif [ -e "$dir/etc/aurox-release" ]; then short="Aurox" long="$(cat "$dir/etc/aurox-release")" elif [ -e "$dir/etc/engarde-release" ]; then short="EnGarde" long="$(cat "$dir/etc/engarde-release")" elif [ -e "$dir/etc/vine-release" ]; then short="Vine" long="$(cat "$dir/etc/vine-release")" elif [ -e "$dir/etc/whitebox-release" ]; then short="WhiteBox" long="$(cat "$dir/etc/whitebox-release")" elif [ -e "$dir/etc/pld-release" ]; then short="PLD" long="$(cat "$dir/etc/pld-release")" elif [ -e "$dir/etc/startcom-release" ]; then short="StartCom" long="$(cat "$dir/etc/startcom-release")" elif [ -e "$dir/etc/trustix-release" ]; then short="Trustix" long="$(cat "$dir/etc/trustix-release")" elif [ -e "$dir/etc/openna-release" ]; then short="OpenNA" long="$(cat "$dir/etc/openna-release")" elif [ -e "$dir/etc/conectiva-release" ]; then short="Conectiva" long="$(cat "$dir/etc/conectiva-release")" elif [ -e "$dir/etc/mandrake-release" ]; then short="Mandrake" long="$(cat "$dir/etc/mandrake-release")" elif [ -e "$dir/etc/fedora-release" ]; then short="Fedora" long="$(cat "$dir/etc/fedora-release")" elif [ -e "$dir/etc/redhat-release" ]; then short="RedHat" long="$(cat "$dir/etc/redhat-release")" elif [ -e "$dir/etc/SuSE-release" ]; then short="SuSE" long="$(head -n 1 "$dir/etc/SuSE-release")" elif [ -e "$dir/etc/gentoo-release" ]; then short="Gentoo" long="$(cat "$dir/etc/gentoo-release")" elif [ -e "$dir/etc/cobalt-release" ]; then short="Cobalt" long="$(cat "$dir/etc/cobalt-release")" elif [ -e "$dir/etc/yellowdog-release" ]; then short="YellowDog" long="$(cat "$dir/etc/yellowdog-release")" elif [ -e "$dir/etc/turbolinux-release" ]; then short="Turbolinux" long="$(cat "$dir/etc/turbolinux-release")" elif [ -e "$dir/etc/pardus-release" ]; then short="Pardus" long="$(cat "$dir/etc/pardus-release")" elif [ -e "$dir/etc/kanotix-version" ]; then short="Kanotix" long="$(cat "$dir/etc/kanotix-version")" elif [ -e "$dir/etc/slackware-version" ]; then short="Slackware" long="$(printf "Slackware Linux (%s)\n" "$(cat "$dir/etc/slackware-version")")" elif [ -e "$dir/sbin/pkgtool" ]; then short="Slackware" long="Slackware Linux" elif grep -qs OpenLinux "$dir/etc/issue"; then short="Caldera" long="Caldera OpenLinux" elif [ -e "$dir/etc/frugalware-release" ]; then short="Frugalware Linux" long="$(cat "$dir/etc/frugalware-release")" elif [ -e "$dir/etc/kdemar-release" ]; then short="K-DEMar" long="$(printf "K-DEMar GNU/Linux (%s)\n" "$(cat "$dir/etc/kdemar-release")")" elif [ -e "$dir/etc/lfs-release" ]; then short="LFS" long="$(printf "Linux From Scratch (%s)\n" "$(cat "$dir/etc/lfs-release")")" elif [ -e "$dir/etc/meego-release" ]; then short="MeeGo" long="$(head -1 "$dir/etc/meego-release")" else short="Linux" long="unknown Linux distribution" fi label="$(count_next_label "$short")" result "$partition:$long:$label:linux" exit 0 else exit 1 fi os-prober-1.63ubuntu1/os-probes/mounted/common/40lsb0000755000000000000000000000157311515765547017341 0ustar #!/bin/sh # Test for LSB systems. set -e . /usr/share/os-prober/common.sh partition="$1" dir="$2" type="$3" lsb_field () { file="$1" field="$2" grep ^"$field" "$file" | cut -d = -f 2 | sed 's/^"//' | sed 's/"$//' | sed 's/:/ /g' } file="$dir/etc/lsb-release" if [ ! -e "$file" ]; then exit 1 fi release=$(lsb_field "$file" DISTRIB_RELEASE) if [ -z "$release" ]; then release=$(lsb_field "$file" DISTRIB_CODENAME) fi description=$(lsb_field "$file" DISTRIB_DESCRIPTION) if [ -z "$description" ]; then description=$(lsb_field "$file" DISTRIB_CODENAME) fi if [ -n "$description" ]; then if [ -n "$release" ]; then long="$description ($release)" else long="$description" fi else exit 1 fi short=$(lsb_field "$file" DISTRIB_ID | sed 's/ //g') if [ -z "$short" ]; then short="UnknownLSB" fi label="$(count_next_label "$short")" result "$partition:$long:$label:linux" exit 0 os-prober-1.63ubuntu1/os-probes/mounted/x86/0000755000000000000000000000000012277125504015603 5ustar os-prober-1.63ubuntu1/os-probes/mounted/x86/10freedos0000755000000000000000000000100511730517422017312 0ustar #!/bin/sh . /usr/share/os-prober/common.sh partition="$1" mpoint="$2" type="$3" # Weed out stuff that doesn't apply to us case "$type" in vfat) debug "$1 is a FAT32 partition" ;; msdos) debug "$1 is a FAT16 partition" ;; fat) debug "$1 is a FAT partition (mounted by GRUB)" ;; *) debug "$1 is not a FAT partition: exiting"; exit 1 ;; esac if item_in_dir -q kernel.sys "$2" && item_in_dir -q command.com "$2"; then label="$(count_next_label FreeDOS)" result "$1:FreeDOS:$label:chain" exit 0 else exit 1 fi os-prober-1.63ubuntu1/os-probes/mounted/x86/10qnx0000755000000000000000000000060611542252115016473 0ustar #!/bin/sh . /usr/share/os-prober/common.sh partition="$1" mpoint="$2" type="$3" # Weed out stuff that doesn't apply to us case "$type" in qnx4) debug "$partition is a QNX4 partition" ;; *) debug "$partition is not a QNX4 partition: exiting"; exit 1 ;; esac if [ -e "$mpoint/.boot" ]; then label="$(count_next_label QNX)" result "$partition:QNX:$label:chain" exit 0 else exit 1 fi os-prober-1.63ubuntu1/os-probes/mounted/x86/83haiku0000755000000000000000000000156312014035402016774 0ustar #!/bin/sh # Detects Haiku on BeFS partitions. . /usr/share/os-prober/common.sh partition="$1" mpoint="$2" type="$3" # Weed out stuff that doesn't apply to us case "$type" in befs|befs_be) debug "$partition is a BeFS partition" ;; *) debug "$partition is not a BeFS partition: exiting"; exit 1 ;; esac if head -c 512 "$partition" | grep -qs "system.haiku_loader"; then debug "Stage 1 bootloader found" else debug "Stage 1 bootloader not found: exiting" exit 1 fi if system="$(item_in_dir "system" "$mpoint")" && item_in_dir -q "haiku_loader" "$mpoint/$system" && (item_in_dir -q "kernel_x86" "$mpoint/$system" || item_in_dir -q "kernel_x86_64" "$mpoint/$system") then debug "Stage 2 bootloader and kernel found" label="$(count_next_label Haiku)" result "$partition:Haiku:$label:chain" exit 0 else debug "Stage 2 bootloader and kernel not found: exiting" exit 1 fi os-prober-1.63ubuntu1/os-probes/mounted/x86/90solaris0000755000000000000000000000060111515765547017366 0ustar #!/bin/sh # Attempt to check if solaris is installed in this system # looking at the /etc/system parameters file and /etc/vfstab. set -e . /usr/share/os-prober/common.sh partition="$1" dir="$2" type="$3" if [ -f "$dir/etc/system" ] && [ -f "$dir/etc/vfstab" ]; then label="$(count_next_label Solaris)" result "$partition:Solaris/IA32:$label:chain" exit 0 else exit 1 fi os-prober-1.63ubuntu1/os-probes/mounted/x86/20microsoft0000755000000000000000000001021012277125504017672 0ustar #!/bin/sh # Detects all Microsoft OSes on a collection of partitions. . /usr/share/os-prober/common.sh partition="$1" mpoint="$2" type="$3" # This script looks for legacy BIOS bootloaders only. Skip if running UEFI if [ -d /sys/firmware/efi ] && [ -z "$WINOSDATA" ]; then debug "Skipping legacy bootloaders on UEFI system" exit 1 fi # Weed out stuff that doesn't apply to us case "$type" in ntfs|ntfs-3g) debug "$1 is a NTFS partition" ;; vfat) debug "$1 is a FAT32 partition" ;; msdos) debug "$1 is a FAT16 partition" ;; fat) debug "$1 is a FAT partition (mounted by GRUB)" ;; fuse|fuseblk) debug "$1 is a FUSE partition" ;; # might be ntfs-3g *) debug "$1 is not a MS partition: exiting"; exit 1 ;; esac found= # Vista (previously Longhorn) if item_in_dir -q bootmgr "$2"; then # there might be different boot directories in different case as: # boot Boot BOOT for boot in $(item_in_dir boot "$2"); do bcd=$(item_in_dir bcd "$2/$boot") if [ -n "$bcd" ]; then if grep -qs "W.i.n.d.o.w.s. .8" "$2/$boot/$bcd"; then long="Windows 8 (loader)" elif grep -qs "W.i.n.d.o.w.s. .7" "$2/$boot/$bcd"; then long="Windows 7 (loader)" elif grep -qs "W.i.n.d.o.w.s. .V.i.s.t.a" "$2/$boot/$bcd"; then long="Windows Vista (loader)" elif grep -qs "W.i.n.d.o.w.s. .S.e.r.v.e.r. .2.0.0.8. .R.2." "$2/$boot/$bcd"; then long="Windows Server 2008 R2 (loader)" elif grep -qs "W.i.n.d.o.w.s. .S.e.r.v.e.r. .2.0.0.8." "$2/$boot/$bcd"; then long="Windows Server 2008 (loader)" elif grep -qs "W.i.n.d.o.w.s. .R.e.c.o.v.e.r.y. .E.n.v.i.r.o.n.m.e.n.t" "$2/$boot/$bcd"; then long="Windows Recovery Environment (loader)" elif grep -qs "W.i.n.d.o.w.s. .S.e.t.u.p" "$2/$boot/$bcd"; then long="Windows Recovery Environment (loader)" else long="Windows Vista (loader)" fi short=Windows found=true break fi done fi # 2000/XP/NT4.0 if [ -z "$found" ] && item_in_dir -q ntldr "$2" && item_in_dir -q ntdetect.com "$2"; then long="Windows NT/2000/XP" short=Windows ini=$(item_in_dir boot.ini "$2") if [ -n "$ini" ]; then multicount="$(grep -e "^multi" "$2/$ini" | wc -l)" scsicount="$(grep -e "^scsi" "$2/$ini" | wc -l)" msoscount="$(expr "${multicount}" + "${scsicount}")" if [ "$msoscount" -eq 1 ]; then # We need to remove a Carriage Return at the end of # the line... defaultmspart="$(grep -e "^default=" "$2/$ini" | cut -d '=' -f2 | tr -d '\r')" # Escape any backslashes in defaultmspart grepexp="^$(echo "$defaultmspart" | sed -e 's/\\/\\\\/')=" # Colons not allowed; replace by spaces # Accented characters (non UTF-8) cause debconf to # hang, so we fall back to the default if the name # contains any weird characters. long="$(grep -e "$grepexp" "$2/$ini" | cut -d '"' -f2 | \ tr ':' ' ' | LC_ALL=C grep -v '[^a-zA-Z0-9 &()/_-]')" if [ -z "$long" ]; then long="Windows NT/2000/XP" fi else long="Windows NT/2000/XP (loader)" fi found=true fi fi # MS-DOS if [ -z "$found" ] && item_in_dir -q dos "$2"; then long="MS-DOS 5.x/6.x/Win3.1" short=MS-DOS found=true fi # 95/98/Me if [ -z "$found" ] && item_in_dir -q windows "$2" && item_in_dir -q win.com "$2"/"$(item_in_dir windows "$2")"; then long="Windows 95/98/Me" short=Windows9xMe found=true fi # Restrict to partitions containing the OS if [ -n "$WINOSDATA" ]; then found= if [ -d "$2/ProgramData/Microsoft/Windows/Start Menu/Programs/StartUp" ]; then long=${long:-"Windows 8 (data)"} short=${short:-"Windows"} found=true elif [ -d "$2/ProgramData/Microsoft/Windows/Start Menu/Programs/Startup" ]; then long=${long:-"Windows 7 (data)"} short=${short:-"Windows"} found=true elif [ -d "$2/Documents and Settings/All Users/Start Menu/Programs/Startup" ]; then long=${long:-"Windows XP/Vista (data)"} short=${short:-"Windows"} found=true elif [ -d "$2/Winnt/Profiles/All Users/Start Menu/Programs/Startup" ]; then long=${long:-"Windows NT (data)"} short=${short:-"Windows"} found=true fi fi if [ -z "$found" ]; then exit 1 fi label="$(count_next_label "$short")" result "${partition}:${long}:${label}:chain" exit 0 os-prober-1.63ubuntu1/os-probes/mounted/x86/05efi0000755000000000000000000000356712170177216016453 0ustar #!/bin/sh # Detects all Microsoft OSes on a collection of partitions. . /usr/share/os-prober/common.sh partition="$1" mpoint="$2" type="$3" # This file is for UEFI platform only if [ ! -d /sys/firmware/efi ]; then debug "Not on UEFI platform" exit 1 fi # Weed out stuff that doesn't apply to us case "$type" in vfat) debug "$1 is a FAT32 partition" ;; msdos) debug "$1 is a FAT16 partition" ;; fat) debug "$1 is a FAT partition (mounted by GRUB)" ;; *) debug "$1 is $type partition: exiting"; exit 1 ;; esac if type udevadm > /dev/null 2>&1; then udevinfo () { udevadm info "$@" } fi if type udevinfo > /dev/null 2>&1; then # Skip virtual devices if udevinfo -q path -n $partition | grep -q /virtual/; then debug "$1 is virtual device: exiting" exit 1 fi eval "$(udevinfo -q property -n "$partition" | grep -E '^ID_PART_ENTRY_(TYPE|SCHEME)=')" debug "$partition partition scheme is $ID_PART_ENTRY_SCHEME" debug "$partition partition type is $ID_PART_ENTRY_TYPE" if [ -z "$ID_PART_ENTRY_TYPE" -o -z "$ID_PART_ENTRY_SCHEME" -o \ \( "$ID_PART_ENTRY_SCHEME" != gpt -a "$ID_PART_ENTRY_SCHEME" != msdos \) -o \ \( "$ID_PART_ENTRY_SCHEME" = gpt -a "$ID_PART_ENTRY_TYPE" != c12a7328-f81f-11d2-ba4b-00a0c93ec93b \) -o \ \( "$ID_PART_ENTRY_SCHEME" = msdos -a "$ID_PART_ENTRY_TYPE" != 0xef \) ]; then debug "$partition is not a ESP partition: exiting" exit 1 fi else debug "udevinfo and udevadm missing - cannot check partition type" fi efi=$(item_in_dir efi "$mpoint") if [ -z "$efi" ]; then debug "$mpoint does not have /EFI directory: exiting" exit 1 fi ret=1 for test in /usr/lib/os-probes/mounted/efi/*; do debug "running subtest $test" if [ -f "$test" ] && [ -x "$test" ]; then entry=$("$test" "$mpoint/$efi") if [ -n "$entry" ]; then debug "bootloader $entry found by subtest $test" ret=0 result "${partition}@/$efi/${entry}:efi" fi fi done exit $ret os-prober-1.63ubuntu1/os-probes/mounted/x86/70hurd0000755000000000000000000000040111515765547016650 0ustar #!/bin/sh set -e . /usr/share/os-prober/common.sh partition="$1" dir="$2" type="$3" if [ -e "$dir/servers/exec" ] && [ -x "$dir/hurd/init" ]; then label="$(count_next_label Hurd)" result "$partition:GNU/Hurd:$label:hurd" exit 0 else exit 1 fi os-prober-1.63ubuntu1/os-probes/mounted/x86/30utility0000755000000000000000000000153711730517422017402 0ustar #!/bin/sh # Detects utility (hw vendor recovery) partitions. . /usr/share/os-prober/common.sh partition="$1" mpoint="$2" type="$3" # Weed out stuff that doesn't apply to us case "$type" in vfat) debug "$1 is a FAT32 partition" ;; msdos) debug "$1 is a FAT16 partition" ;; fat) debug "$1 is a FAT partition (mounted by GRUB)" ;; *) debug "$1 is not a FAT partition: exiting"; exit 1 ;; esac # Dell Utility partitions have partition type 0xde, but no idea how to # cleanly detect that from shell if item_in_dir -q dellbio.bin "$2" && \ (item_in_dir -q delldiag.exe "$2" || item_in_dir -q delldiag.com "$2"); then long="Dell Utility Partition" short=DellUtility elif item_in_dir -q f11.sys "$2"; then long="Acronis Secure Zone" short=AcroneZone else exit 1 fi label="$(count_next_label "$short")" result "${partition}:${long}:${label}:chain" exit 0 os-prober-1.63ubuntu1/os-probes/mounted/x86/80minix0000755000000000000000000000065711730517422017032 0ustar #!/bin/sh set -e . /usr/share/os-prober/common.sh partition="$1" dir="$2" type="$3" # Weed out stuff that doesn't apply to us case "$type" in minix|minix2|ext2) ;; *) exit 1 ;; esac if [ -f "$dir/minix" ] || [ -e "$dir/boot/image_big" ]; then if [ -e "$dir/boot/image_latest" ]; then boot="minix" else boot="chain" fi label="$(count_next_label Minix)" result "$partition:Minix:$label:$boot" exit 0 else exit 1 fi os-prober-1.63ubuntu1/os-probes/mounted/x86/efi/0000755000000000000000000000000012144725552016350 5ustar os-prober-1.63ubuntu1/os-probes/mounted/x86/efi/10elilo0000755000000000000000000000063512144725552017547 0ustar #!/bin/sh # Detects ELILO bootloader on a EFI System Partition . /usr/share/os-prober/common.sh efi="$1" found= elilo=`find $1 -name "elilo.efi"` if [ -n "$elilo" ]; then bdir=`dirname $elilo` bdir=`basename $bdir` long="ELILO Boot Manager" short="ELILO" path=${bdir}/elilo.efi found=true fi if [ -n "$found" ]; then label="$(count_next_label "$short")" result "${path}:${long}:${label}" fi exit 0 os-prober-1.63ubuntu1/os-probes/mounted/x86/efi/20microsoft0000755000000000000000000000115012144725552020442 0ustar #!/bin/sh # Detects Microsoft bootloader on a EFI System Partition . /usr/share/os-prober/common.sh efi="$1" found= for microsoft in $(item_in_dir microsoft "$efi"); do for boot in $(item_in_dir boot "$efi/$microsoft"); do bcd=$(item_in_dir bcd "$efi/$microsoft/$boot") bootmgfw=$(item_in_dir bootmgfw.efi "$efi/$microsoft/$boot") if [ -n "$bcd" -a -n "$bootmgfw" ]; then long="Windows Boot Manager" short=Windows path="$microsoft/$boot/$bootmgfw" found=true break fi done done if [ -n "$found" ]; then label="$(count_next_label "$short")" result "${path}:${long}:${label}" fi exit 0 os-prober-1.63ubuntu1/os-probes/mounted/powerpc/0000755000000000000000000000000011730517422016632 5ustar os-prober-1.63ubuntu1/os-probes/mounted/powerpc/10macos6-90000755000000000000000000000065711515765547020305 0ustar #!/bin/sh # Probe for OS 9 via System suitcase check. . /usr/share/os-prober/common.sh set -e partition="$1" dir="$2" fstype="$3" case "$fstype" in hfs) debug "Partition is HFS" ;; hfsplus) debug "Partition is HFS+ (Mac OS 9 only, we hope)" ;; esac if [ -e "$dir/System Folder/System" ]; then label="$(count_next_label MacOS)" result "${partition}:Macintosh System 6/7, OS 8/9:${label}:macos" exit 0 else exit 1 fi os-prober-1.63ubuntu1/os-probes/mounted/powerpc/20macosx0000755000000000000000000000131711730517422020216 0ustar #!/bin/sh -e # Detects Mac OS X. I don't yet know how Mac OS <= 9 fits into this. . /usr/share/os-prober/common.sh partition="$1" mpoint="$2" type="$3" debug() { logger -t macosx-prober "debug: $@" } # Weed out stuff that doesn't apply to us case "$type" in hfsplus) debug "$1 is an HFS+ partition" ;; *) debug "$1 is not an HFS+ partition: exiting"; exit 1 ;; esac # Could use a better test than this. # /System/Library/CoreServices/SystemVersion.plist has version information, # but I don't think it exists on Mac OS <= 9, and it's XML so parsing in # shell will be nasty. if [ -e "$2/mach_kernel" ]; then label="$(count_next_label MacOSX)" result "$1:Mac OS X:$label:macosx" exit 0 else exit 1 fi os-prober-1.63ubuntu1/os-probes/init/0000755000000000000000000000000011515765547014461 5ustar os-prober-1.63ubuntu1/os-probes/init/common/0000755000000000000000000000000012173431340015727 5ustar os-prober-1.63ubuntu1/os-probes/init/common/10filesystems0000755000000000000000000000220612173431340020365 0ustar #!/bin/sh # Make sure filesystems are available. set +e # ignore errors from modprobe FILESYSTEMS='ext2 ext3 ext4 xfs jfs msdos vfat ntfs minix hfs hfsplus qnx4 ufs btrfs' # fuse is needed to make grub-mount work. FILESYSTEMS="$FILESYSTEMS fuse" # The Ubuntu kernel udebs put a number of filesystem modules in # fs-{core,secondary}-modules. It's fairly cheap to check for these too. FILESYSTEMS="$FILESYSTEMS fs-core fs-secondary" if [ ! -e /var/lib/os-prober/modules ]; then # Check for anna-install to make it easier to use os-prober outside # d-i. if type anna-install >/dev/null 2>&1 && [ -d /lib/debian-installer ]; then for fs in $FILESYSTEMS; do ANNA_QUIET=1 DEBIAN_FRONTEND=none \ log-output -t os-prober \ anna-install "$fs-modules" || true done depmod -a >/dev/null 2>&1 || true fi for fs in $FILESYSTEMS; do case "$fs" in fs-*) ;; *) modprobe "$fs" 2>/dev/null | logger -t os-prober ;; esac done # We only want to keep this state inside d-i, so this is as good a # check as any. if type anna-install >/dev/null 2>&1 && [ -d /lib/debian-installer ]; then touch /var/lib/os-prober/modules fi fi os-prober-1.63ubuntu1/os-probes/common/0000755000000000000000000000000012277125504014773 5ustar os-prober-1.63ubuntu1/os-probes/common/50mounted-tests0000755000000000000000000000531012277125504017700 0ustar #!/bin/sh # Sub-tests that require a mounted partition. set -e partition="$1" . /usr/share/os-prober/common.sh types="$(fs_type "$partition")" || types=NOT-DETECTED if [ "$types" = NOT-DETECTED ]; then debug "$1 type not recognised; skipping" exit 0 elif [ "$types" = swap ]; then debug "$1 is a swap partition; skipping" exit 0 elif [ "$types" = crypto_LUKS ]; then debug "$1 is a LUKS partition; skipping" exit 0 elif [ "$types" = ntfs ]; then if type ntfs-3g >/dev/null 2>&1; then types='ntfs-3g ntfs' fi elif [ -z "$types" ]; then if type cryptsetup >/dev/null 2>&1 && \ cryptsetup luksDump "$partition" >/dev/null 2>&1; then debug "$1 is a LUKS partition; skipping" exit 0 fi for type in $(grep -v nodev /proc/filesystems); do # hfsplus filesystems are mountable as hfs. Try hfs last so # that we can tell the difference. if [ "$type" = hfs ]; then delaytypes="${delaytypes:+$delaytypes }$type" elif [ "$type" = fuseblk ]; then if type ntfs-3g >/dev/null 2>&1; then types="${types:+$types }ntfs-3g" fi else types="${types:+$types }$type" fi done fi tmpmnt=/var/lib/os-prober/mount if [ ! -d "$tmpmnt" ]; then mkdir "$tmpmnt" fi mounted= if type grub-mount >/dev/null 2>&1 && \ type grub-probe >/dev/null 2>&1 && \ grub-mount "$partition" "$tmpmnt" 2>/dev/null; then mounted=1 type="$(grub-probe -d "$partition" -t fs)" || true if [ "$type" ]; then debug "mounted using GRUB $type filesystem driver" else debug "mounted using GRUB, but unknown filesystem?" type=fuseblk fi else ro_partition "$partition" for type in $types $delaytypes; do if mount -o ro -t "$type" "$partition" "$tmpmnt" 2>/dev/null; then debug "mounted as $type filesystem" case "$type" in btrfs) if [ -x "$tmpmnt/@/lib" ] && \ ! mount --bind "$tmpmnt/@" "$tmpmnt"; then warn "failed to mount btrfs subvolume @ on $partition" if ! umount $tmpmnt; then warn "failed to umount $tmpmnt" fi mounted= fi ;; esac mounted=1 break fi done fi if [ "$mounted" ]; then for test in /usr/lib/os-probes/mounted/*; do debug "running subtest $test" if [ -f "$test" ] && [ -x "$test" ]; then if "$test" "$partition" "$tmpmnt" "$type"; then debug "os found by subtest $test" if ! umount "$tmpmnt"; then warn "failed to umount $tmpmnt" fi case "$type" in btrfs) # umount to account for the bind-mount if [ -x "$tmpmnt/@/lib" ] && \ ! umount $tmpmnt; then warn "failed to umount $tmpmnt" fi ;; esac rmdir "$tmpmnt" || true exit 0 fi fi done if ! umount "$tmpmnt"; then warn "failed to umount $tmpmnt" fi fi rmdir "$tmpmnt" || true # No tests found anything. exit 1 os-prober-1.63ubuntu1/newns.c0000644000000000000000000000125011515765547013101 0ustar #define _GNU_SOURCE #include #include #include #include #include int main(int argc, char **argv) { if (argc < 2) { fprintf(stderr, "Usage: newns PROGRAM [ARGUMENTS ...]\n"); exit(1); } /* This is best-effort; if the kernel is too old (Linux << 2.6.16), * or indeed if the kernel isn't Linux so we don't have * unshare(CLONE_NEWNS), don't worry about it. */ #ifdef __linux__ if (unshare(CLONE_NEWNS) < 0 && errno != ENOSYS) perror("unshare failed"); /* ... but continue anyway */ #endif /* __linux__ */ setenv("OS_PROBER_NEWNS", "1", 1); execvp(argv[1], argv + 1); perror("execvp failed"); _exit(127); }