├── debian ├── compat ├── source │ └── format ├── os-prober.dirs ├── os-prober.docs ├── os-prober-udeb.dirs ├── .gitignore ├── os-prober-udeb.install ├── os-prober.install ├── copyright ├── rules ├── control └── changelog ├── .gitignore ├── do-build-replace ├── src ├── probes │ ├── os │ │ ├── mounted │ │ │ ├── x86 │ │ │ │ ├── 70hurd │ │ │ │ ├── 90solaris │ │ │ │ ├── 10qnx │ │ │ │ ├── efi │ │ │ │ │ ├── 10elilo │ │ │ │ │ └── 20microsoft │ │ │ │ ├── 80minix │ │ │ │ ├── 10freedos │ │ │ │ ├── 30utility │ │ │ │ ├── 83haiku │ │ │ │ ├── 05efi │ │ │ │ └── 20microsoft │ │ │ ├── sparc │ │ │ │ └── 80solaris │ │ │ ├── m68k │ │ │ │ └── 10macos6-9 │ │ │ ├── powerpc │ │ │ │ ├── 10macos6-9 │ │ │ │ └── 20macosx │ │ │ └── common │ │ │ │ ├── 40lsb │ │ │ │ └── 90linux-distro │ │ ├── init │ │ │ └── common │ │ │ │ └── 10filesystems │ │ └── common │ │ │ └── 50mounted-tests │ └── linux-boot │ │ ├── mounted │ │ ├── common │ │ │ ├── 90fallback │ │ │ └── 40grub2 │ │ ├── x86 │ │ │ ├── 40grub │ │ │ └── 50lilo │ │ ├── powerpc │ │ │ └── 40yaboot │ │ └── sparc │ │ │ └── 50silo │ │ └── common │ │ └── 50mounted-tests ├── newns.c ├── linux-boot-prober ├── os-prober └── common.sh ├── TODO ├── Makefile └── README /debian/compat: -------------------------------------------------------------------------------- 1 | 9 2 | -------------------------------------------------------------------------------- /debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (native) 2 | -------------------------------------------------------------------------------- /debian/os-prober.dirs: -------------------------------------------------------------------------------- 1 | os-prober-udeb.dirs -------------------------------------------------------------------------------- /debian/os-prober.docs: -------------------------------------------------------------------------------- 1 | README 2 | TODO 3 | -------------------------------------------------------------------------------- /debian/os-prober-udeb.dirs: -------------------------------------------------------------------------------- 1 | var/lib/os-prober 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | test 3 | 4 | # Vim tempfiles 5 | *.sw[op] 6 | -------------------------------------------------------------------------------- /debian/.gitignore: -------------------------------------------------------------------------------- 1 | *.debhelper* 2 | *.substvars 3 | os-prober 4 | os-prober-udeb 5 | files 6 | 7 | -------------------------------------------------------------------------------- /debian/os-prober-udeb.install: -------------------------------------------------------------------------------- 1 | os-prober linux-boot-prober bin 2 | newns usr/lib/os-prober 3 | common.sh usr/share/os-prober 4 | -------------------------------------------------------------------------------- /debian/os-prober.install: -------------------------------------------------------------------------------- 1 | os-prober linux-boot-prober usr/bin 2 | newns usr/lib/os-prober 3 | common.sh usr/share/os-prober 4 | -------------------------------------------------------------------------------- /do-build-replace: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | 4 | sed < /dev/stdin > /dev/stdout \ 5 | -e "s,replace LIB_DIR,export LIB_DIR=$LIB_DIR," \ 6 | -e "s,replace BIN_DIR,export BIN_DIR=$BIN_DIR," 7 | -------------------------------------------------------------------------------- /src/probes/os/mounted/x86/70hurd: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | . /usr/share/os-prober/common.sh 5 | 6 | partition="$1" 7 | dir="$2" 8 | type="$3" 9 | 10 | if [ -e "$dir/servers/exec" ] && [ -x "$dir/hurd/init" ]; then 11 | label="$(count_next_label Hurd)" 12 | result "$partition:GNU/Hurd:$label:hurd" 13 | exit 0 14 | else 15 | exit 1 16 | fi 17 | -------------------------------------------------------------------------------- /src/probes/os/mounted/x86/90solaris: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Attempt to check if solaris is installed in this system 3 | # looking at the /etc/system parameters file and /etc/vfstab. 4 | 5 | set -e 6 | 7 | . /usr/share/os-prober/common.sh 8 | 9 | partition="$1" 10 | dir="$2" 11 | type="$3" 12 | 13 | if [ -f "$dir/etc/system" ] && [ -f "$dir/etc/vfstab" ]; then 14 | label="$(count_next_label Solaris)" 15 | result "$partition:Solaris/IA32:$label:chain" 16 | exit 0 17 | else 18 | exit 1 19 | fi 20 | -------------------------------------------------------------------------------- /src/probes/os/mounted/sparc/80solaris: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Attempt to check if solaris is installed in this system 3 | # looking at the /etc/system parameters file and /etc/vfstab. 4 | 5 | set -e 6 | 7 | . /usr/share/os-prober/common.sh 8 | 9 | partition="$1" 10 | dir="$2" 11 | type="$3" 12 | 13 | if [ -f "$dir/etc/system" ] && [ -f "$dir/etc/vfstab" ]; then 14 | label="$(count_next_label Solaris)" 15 | result "$partition:Solaris/SPARC:$label:chain" 16 | exit 0 17 | else 18 | exit 1 19 | fi 20 | -------------------------------------------------------------------------------- /src/probes/os/mounted/x86/10qnx: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | . /usr/share/os-prober/common.sh 4 | 5 | partition="$1" 6 | mpoint="$2" 7 | type="$3" 8 | 9 | # Weed out stuff that doesn't apply to us 10 | case "$type" in 11 | qnx4) debug "$partition is a QNX4 partition" ;; 12 | *) debug "$partition is not a QNX4 partition: exiting"; exit 1 ;; 13 | esac 14 | 15 | if [ -e "$mpoint/.boot" ]; then 16 | label="$(count_next_label QNX)" 17 | result "$partition:QNX:$label:chain" 18 | exit 0 19 | else 20 | exit 1 21 | fi 22 | -------------------------------------------------------------------------------- /debian/copyright: -------------------------------------------------------------------------------- 1 | The majority of code in os-prober is Copyright 2004-2011 by Joshua 2 | Kwan, Joey Hess, Christian Perrier, Colin Watson and Otavio Salvador. 3 | This is licensed $under the terms of the GNU GPL, either version 2 or, 4 | at your option, any later version. 5 | 6 | 7 | Some portions of os-prober by other contributors has an unclear license 8 | of "GNU GPL", with the version not specified. 9 | 10 | On Debian systems, a copy of the GNU General Public License is available in 11 | /usr/share/common-licenses/GPL-2. 12 | -------------------------------------------------------------------------------- /src/probes/os/mounted/x86/efi/10elilo: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Detects ELILO bootloader on a EFI System Partition 3 | 4 | . /usr/share/os-prober/common.sh 5 | 6 | efi="$1" 7 | 8 | found= 9 | 10 | elilo=`find $1 -name "elilo.efi"` 11 | if [ -n "$elilo" ]; then 12 | bdir=`dirname $elilo` 13 | bdir=`basename $bdir` 14 | long="ELILO Boot Manager" 15 | short="ELILO" 16 | path=${bdir}/elilo.efi 17 | found=true 18 | fi 19 | 20 | if [ -n "$found" ]; then 21 | label="$(count_next_label "$short")" 22 | result "${path}:${long}:${label}" 23 | fi 24 | exit 0 25 | -------------------------------------------------------------------------------- /src/probes/os/mounted/m68k/10macos6-9: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Probe for OS 9 via System suitcase check. 3 | . /usr/share/os-prober/common.sh 4 | 5 | set -e 6 | 7 | partition="$1" 8 | dir="$2" 9 | fstype="$3" 10 | 11 | case "$fstype" in 12 | hfs) debug "Partition is HFS" ;; 13 | hfsplus) debug "Partition is HFS+ (Mac OS 9 only, we hope)" ;; 14 | esac 15 | 16 | if [ -e "$dir/System Folder/System" ]; then 17 | label="$(count_next_label MacOS)" 18 | result "${partition}:Macintosh System 6/7, OS 8/9:${label}:chain" 19 | exit 0 20 | else 21 | exit 1 22 | fi 23 | -------------------------------------------------------------------------------- /src/probes/os/mounted/powerpc/10macos6-9: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Probe for OS 9 via System suitcase check. 3 | . /usr/share/os-prober/common.sh 4 | 5 | set -e 6 | 7 | partition="$1" 8 | dir="$2" 9 | fstype="$3" 10 | 11 | case "$fstype" in 12 | hfs) debug "Partition is HFS" ;; 13 | hfsplus) debug "Partition is HFS+ (Mac OS 9 only, we hope)" ;; 14 | esac 15 | 16 | if [ -e "$dir/System Folder/System" ]; then 17 | label="$(count_next_label MacOS)" 18 | result "${partition}:Macintosh System 6/7, OS 8/9:${label}:macos" 19 | exit 0 20 | else 21 | exit 1 22 | fi 23 | -------------------------------------------------------------------------------- /src/probes/os/mounted/x86/80minix: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | . /usr/share/os-prober/common.sh 5 | 6 | partition="$1" 7 | dir="$2" 8 | type="$3" 9 | 10 | # Weed out stuff that doesn't apply to us 11 | case "$type" in 12 | minix|minix2|ext2) ;; 13 | *) exit 1 ;; 14 | esac 15 | 16 | if [ -f "$dir/minix" ] || [ -e "$dir/boot/image_big" ]; then 17 | if [ -e "$dir/boot/image_latest" ]; then 18 | boot="minix" 19 | else 20 | boot="chain" 21 | fi 22 | 23 | label="$(count_next_label Minix)" 24 | result "$partition:Minix:$label:$boot" 25 | exit 0 26 | else 27 | exit 1 28 | fi 29 | -------------------------------------------------------------------------------- /src/probes/os/mounted/x86/10freedos: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | . /usr/share/os-prober/common.sh 4 | 5 | partition="$1" 6 | mpoint="$2" 7 | type="$3" 8 | 9 | # Weed out stuff that doesn't apply to us 10 | case "$type" in 11 | vfat) debug "$1 is a FAT32 partition" ;; 12 | msdos) debug "$1 is a FAT16 partition" ;; 13 | fat) debug "$1 is a FAT partition (mounted by GRUB)" ;; 14 | *) debug "$1 is not a FAT partition: exiting"; exit 1 ;; 15 | esac 16 | 17 | if item_in_dir -q kernel.sys "$2" && item_in_dir -q command.com "$2"; then 18 | label="$(count_next_label FreeDOS)" 19 | result "$1:FreeDOS:$label:chain" 20 | exit 0 21 | else 22 | exit 1 23 | fi 24 | -------------------------------------------------------------------------------- /src/probes/os/mounted/x86/efi/20microsoft: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Detects Microsoft bootloader on a EFI System Partition 3 | 4 | . /usr/share/os-prober/common.sh 5 | 6 | efi="$1" 7 | 8 | found= 9 | for microsoft in $(item_in_dir microsoft "$efi"); do 10 | for boot in $(item_in_dir boot "$efi/$microsoft"); do 11 | bcd=$(item_in_dir bcd "$efi/$microsoft/$boot") 12 | bootmgfw=$(item_in_dir bootmgfw.efi "$efi/$microsoft/$boot") 13 | if [ -n "$bcd" -a -n "$bootmgfw" ]; then 14 | long="Windows Boot Manager" 15 | short=Windows 16 | path="$microsoft/$boot/$bootmgfw" 17 | found=true 18 | break 19 | fi 20 | done 21 | done 22 | 23 | 24 | if [ -n "$found" ]; then 25 | label="$(count_next_label "$short")" 26 | result "${path}:${long}:${label}" 27 | fi 28 | exit 0 29 | -------------------------------------------------------------------------------- /src/newns.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | int main(int argc, char **argv) 9 | { 10 | if (argc < 2) { 11 | fprintf(stderr, "Usage: newns PROGRAM [ARGUMENTS ...]\n"); 12 | exit(1); 13 | } 14 | 15 | // We are not targeting any systems old enough not to support 16 | // unshare(CLONE_NEWNS). Require it to continue. 17 | if (unshare(CLONE_NEWNS) < 0 && errno != ENOSYS) { 18 | perror("unshare failed (needed to prevent side effects, see man unshare)"); 19 | _exit(1); 20 | } 21 | setenv("OS_PROBER_NEWNS", "1", 1); 22 | execvp(argv[1], argv + 1); 23 | 24 | perror("execvp failed"); 25 | _exit(127); 26 | } 27 | -------------------------------------------------------------------------------- /src/probes/os/mounted/powerpc/20macosx: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | # Detects Mac OS X. I don't yet know how Mac OS <= 9 fits into this. 3 | . /usr/share/os-prober/common.sh 4 | 5 | partition="$1" 6 | mpoint="$2" 7 | type="$3" 8 | 9 | debug() { 10 | logger -t macosx-prober "debug: $@" 11 | } 12 | 13 | # Weed out stuff that doesn't apply to us 14 | case "$type" in 15 | hfsplus) debug "$1 is an HFS+ partition" ;; 16 | *) debug "$1 is not an HFS+ partition: exiting"; exit 1 ;; 17 | esac 18 | 19 | # Could use a better test than this. 20 | # /System/Library/CoreServices/SystemVersion.plist has version information, 21 | # but I don't think it exists on Mac OS <= 9, and it's XML so parsing in 22 | # shell will be nasty. 23 | 24 | if [ -e "$2/mach_kernel" ]; then 25 | label="$(count_next_label MacOSX)" 26 | result "$1:Mac OS X:$label:macosx" 27 | exit 0 28 | else 29 | exit 1 30 | fi 31 | -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- 1 | This thing needs a regression test suite. 2 | 3 | The grub linux-boot-probe has these limitations: 4 | 5 | - Does not handle grub present menus. 6 | - Does not support things like (hd0,1)/path/to/file 7 | although in the case of the kernel it will strip 8 | off the drive specification, and look for the file in the current 9 | partition. 10 | 11 | The lilo linux-boot-probe has these limitations: 12 | 13 | - Doesn't map from devfs to normal if the lilo.conf uses devfs names 14 | (valid?) 15 | 16 | linux-boot-prober: 17 | 18 | - Partition names in boot loader config may have changed during 19 | the debian install, so cannot be trusted. Fix up root= lines, 20 | etc. 21 | - To get to boot/, may need to parse fstab. But this can fail because 22 | as noted above, drive names may have changed! 23 | - Maybe do some probing before partitioning and store info? 24 | Or don't support adding partitions before existing /boot partitions. 25 | -------------------------------------------------------------------------------- /src/probes/os/mounted/x86/30utility: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Detects utility (hw vendor recovery) partitions. 3 | 4 | . /usr/share/os-prober/common.sh 5 | 6 | partition="$1" 7 | mpoint="$2" 8 | type="$3" 9 | 10 | # Weed out stuff that doesn't apply to us 11 | case "$type" in 12 | vfat) debug "$1 is a FAT32 partition" ;; 13 | msdos) debug "$1 is a FAT16 partition" ;; 14 | fat) debug "$1 is a FAT partition (mounted by GRUB)" ;; 15 | *) debug "$1 is not a FAT partition: exiting"; exit 1 ;; 16 | esac 17 | 18 | # Dell Utility partitions have partition type 0xde, but no idea how to 19 | # cleanly detect that from shell 20 | if item_in_dir -q dellbio.bin "$2" && \ 21 | (item_in_dir -q delldiag.exe "$2" || item_in_dir -q delldiag.com "$2"); then 22 | long="Dell Utility Partition" 23 | short=DellUtility 24 | elif item_in_dir -q f11.sys "$2"; then 25 | long="Acronis Secure Zone" 26 | short=AcroneZone 27 | else 28 | exit 1 29 | fi 30 | 31 | label="$(count_next_label "$short")" 32 | result "${partition}:${long}:${label}:chain" 33 | exit 0 34 | -------------------------------------------------------------------------------- /src/probes/os/mounted/x86/83haiku: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Detects Haiku on BeFS partitions. 3 | 4 | . /usr/share/os-prober/common.sh 5 | 6 | partition="$1" 7 | mpoint="$2" 8 | type="$3" 9 | 10 | # Weed out stuff that doesn't apply to us 11 | case "$type" in 12 | befs|befs_be) debug "$partition is a BeFS partition" ;; 13 | *) debug "$partition is not a BeFS partition: exiting"; exit 1 ;; 14 | esac 15 | 16 | if head -c 512 "$partition" | grep -qs "system.haiku_loader"; then 17 | debug "Stage 1 bootloader found" 18 | else 19 | debug "Stage 1 bootloader not found: exiting" 20 | exit 1 21 | fi 22 | 23 | if system="$(item_in_dir "system" "$mpoint")" && 24 | item_in_dir -q "haiku_loader" "$mpoint/$system" && 25 | (item_in_dir -q "kernel_x86" "$mpoint/$system" || 26 | item_in_dir -q "kernel_x86_64" "$mpoint/$system") 27 | then 28 | debug "Stage 2 bootloader and kernel found" 29 | label="$(count_next_label Haiku)" 30 | result "$partition:Haiku:$label:chain" 31 | exit 0 32 | else 33 | debug "Stage 2 bootloader and kernel not found: exiting" 34 | exit 1 35 | fi 36 | -------------------------------------------------------------------------------- /src/probes/os/mounted/common/40lsb: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Test for LSB systems. 3 | set -e 4 | 5 | . /usr/share/os-prober/common.sh 6 | 7 | partition="$1" 8 | dir="$2" 9 | type="$3" 10 | 11 | lsb_field () { 12 | file="$1" 13 | field="$2" 14 | grep ^"$field" "$file" | cut -d = -f 2 | sed 's/^"//' | sed 's/"$//' | sed 's/:/ /g' 15 | } 16 | 17 | file="$dir/etc/lsb-release" 18 | if [ ! -e "$file" ]; then 19 | exit 1 20 | fi 21 | 22 | release=$(lsb_field "$file" DISTRIB_RELEASE) 23 | if [ -z "$release" ]; then 24 | release=$(lsb_field "$file" DISTRIB_CODENAME) 25 | fi 26 | description=$(lsb_field "$file" DISTRIB_DESCRIPTION) 27 | if [ -z "$description" ]; then 28 | description=$(lsb_field "$file" DISTRIB_CODENAME) 29 | fi 30 | 31 | if [ -n "$description" ]; then 32 | if [ -n "$release" ]; then 33 | long="$description ($release)" 34 | else 35 | long="$description" 36 | fi 37 | else 38 | exit 1 39 | fi 40 | 41 | short=$(lsb_field "$file" DISTRIB_ID | sed 's/ //g') 42 | if [ -z "$short" ]; then 43 | short="UnknownLSB" 44 | fi 45 | 46 | label="$(count_next_label "$short")" 47 | result "$partition:$long:$label:linux" 48 | exit 0 49 | -------------------------------------------------------------------------------- /src/probes/os/init/common/10filesystems: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Make sure filesystems are available. 3 | set +e # ignore errors from modprobe 4 | 5 | FILESYSTEMS='ext2 ext3 ext4 xfs jfs msdos vfat ntfs minix hfs hfsplus qnx4 ufs btrfs' 6 | # fuse is needed to make grub-mount work. 7 | FILESYSTEMS="$FILESYSTEMS fuse" 8 | # The Ubuntu kernel udebs put a number of filesystem modules in 9 | # fs-{core,secondary}-modules. It's fairly cheap to check for these too. 10 | FILESYSTEMS="$FILESYSTEMS fs-core fs-secondary" 11 | 12 | if [ ! -e /var/lib/os-prober/modules ]; then 13 | # Check for anna-install to make it easier to use os-prober outside 14 | # d-i. 15 | if type anna-install >/dev/null 2>&1 && [ -d /lib/debian-installer ]; then 16 | for fs in $FILESYSTEMS; do 17 | ANNA_QUIET=1 DEBIAN_FRONTEND=none \ 18 | log-output -t os-prober \ 19 | anna-install "$fs-modules" || true 20 | done 21 | depmod -a >/dev/null 2>&1 || true 22 | fi 23 | 24 | for fs in $FILESYSTEMS; do 25 | case "$fs" in 26 | fs-*) 27 | ;; 28 | *) 29 | modprobe "$fs" 2>/dev/null | logger -t os-prober 30 | ;; 31 | esac 32 | done 33 | 34 | # We only want to keep this state inside d-i, so this is as good a 35 | # check as any. 36 | if type anna-install >/dev/null 2>&1 && [ -d /lib/debian-installer ]; then 37 | touch /var/lib/os-prober/modules 38 | fi 39 | fi 40 | -------------------------------------------------------------------------------- /debian/rules: -------------------------------------------------------------------------------- 1 | #! /usr/bin/make -f 2 | # debhelper rules for os-prober 3 | # (C) 2004 Joshua Kwan 4 | 5 | %: 6 | dh $@ 7 | 8 | ARCH=$(shell dpkg-architecture -qDEB_HOST_ARCH) 9 | ifneq (,$(findstring :$(ARCH):,:i386:amd64:)) 10 | ARCH=x86 11 | endif 12 | 13 | DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) 14 | DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) 15 | 16 | ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE)) 17 | CC := gcc 18 | else 19 | CC := $(DEB_HOST_GNU_TYPE)-gcc 20 | endif 21 | 22 | export DEB_CFLAGS_MAINT_APPEND := -Os -Wall 23 | 24 | CFLAGS := $(shell dpkg-buildflags --get CPPFLAGS; dpkg-buildflags --get CFLAGS) 25 | LDFLAGS := $(shell dpkg-buildflags --get LDFLAGS) 26 | 27 | override_dh_auto_build: 28 | $(MAKE) CC=$(CC) CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" 29 | 30 | override_dh_install: 31 | dh_install 32 | for probes in os-probes os-probes/mounted os-probes/init \ 33 | linux-boot-probes linux-boot-probes/mounted; do \ 34 | dh_install $$probes/common/* usr/lib/$$probes; \ 35 | if [ -e "$$probes/$(ARCH)" ]; then \ 36 | dh_install $$probes/$(ARCH)/* usr/lib/$$probes; \ 37 | fi; \ 38 | done 39 | ifeq ($(ARCH),x86) 40 | dh_install os-probes/mounted/powerpc/20macosx usr/lib/os-probes/mounted 41 | endif 42 | cp -a debian/os-prober-udeb/usr/lib debian/os-prober/usr/ 43 | -------------------------------------------------------------------------------- /debian/control: -------------------------------------------------------------------------------- 1 | Source: os-prober 2 | Section: debian-installer 3 | Priority: optional 4 | Maintainer: Debian Install System Team 5 | Uploaders: Colin Watson , Joey Hess , Christian Perrier , Steve McIntyre <93sam@debian.org> 6 | Build-Depends: debhelper (>= 9), dpkg-dev (>= 1.15.7) 7 | Standards-Version: 3.9.4 8 | Vcs-Browser: http://anonscm.debian.org/gitweb/?p=d-i/os-prober.git 9 | Vcs-Git: git://anonscm.debian.org/d-i/os-prober.git 10 | 11 | Package: os-prober-udeb 12 | Package-Type: udeb 13 | Architecture: any 14 | Depends: ${misc:Depends}, ${shlibs:Depends}, di-utils-mapdevfs, anna (>= 1.16), grub-mount-udeb [i386 amd64 powerpc ppc64 ppc64el sparc mipsel kfreebsd-i386 kfreebsd-amd64] 15 | Provides: os-prober 16 | Description: utility to detect other OSes on a set of drives 17 | This package is to be used by boot loader installers to detect other OSes 18 | available on a system, in a generic format, which it can then adapt to its 19 | own configuration format. 20 | 21 | Package: os-prober 22 | Architecture: any 23 | Section: utils 24 | Priority: extra 25 | Depends: ${shlibs:Depends}, ${misc:Depends} 26 | Description: utility to detect other OSes on a set of drives 27 | This package detects other OSes available on a system and outputs the 28 | results in a generic machine-readable format. 29 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: build_dirs 2 | CFLAGS := -Os -g -Wall 3 | 4 | ifeq ($(ARCH),) 5 | export ARCH := $(shell uname -m) 6 | endif 7 | ifeq ($(ARCH),x86_64) 8 | export ARCH = x86 9 | endif 10 | 11 | $(info Architecture: $(ARCH)) 12 | 13 | # NixOS uses the $out variable to indicate build output location 14 | ifeq "$(out)" "" 15 | export LIB_DIR := /usr/lib/os-prober 16 | export BIN_DIR := /usr/bin/os-prober 17 | else 18 | export LIB_DIR := $(out)/lib 19 | export BIN_DIR := $(out)/bin 20 | endif 21 | 22 | all: build/bin/os-prober build/bin/linux-boot-prober build/lib/newns 23 | 24 | build_dirs: 25 | mkdir -p build/bin build/lib 26 | 27 | build/lib/newns: build_dirs src/newns.c 28 | $(CC) $(CFLAGS) $(LDFLAGS) src/newns.c -o build/lib/newns 29 | 30 | build/bin/os-prober: build/lib/common.sh src/os-prober 31 | ./do-build-replace < src/os-prober > build/bin/os-prober 32 | chmod +x build/bin/os-prober 33 | 34 | build/bin/linux-boot-prober: build/lib/common.sh src/linux-boot-prober 35 | ./do-build-replace < src/linux-boot-prober > build/bin/linux-boot-prober 36 | chmod +x build/bin/linux-boot-prober 37 | 38 | build/lib/common.sh: build_dirs src/common.sh 39 | ./do-build-replace < src/common.sh > build/lib/common.sh 40 | 41 | check: build/lib/newns 42 | ./build/bin/os-prober 43 | ./build/bin/os-prober | grep ':' 44 | ./build/bin/linux-boot-prover 45 | ./build/bin/linux-boot-prover | grep ':' 46 | 47 | install: all 48 | mkdir -p $(LIB_DIR) $(BIN_DIR) 49 | cp -r build/lib/* $(LIB_DIR) 50 | cp -a build/bin/* $(BIN_DIR) 51 | for probes in os os/init os/mounted; do \ 52 | mkdir -p $(LIB_DIR)/probes/$$probes; \ 53 | cp src/probes/$$probes/common/* $(LIB_DIR)/probes/$$probes; \ 54 | if [ -e "src/probes/$$probes/$(ARCH)" ]; then \ 55 | cp -r src/probes/$$probes/$(ARCH)/* $(LIB_DIR)/probes/$$probes; \ 56 | fi; \ 57 | done 58 | 59 | clean: 60 | rm -f newns 61 | -------------------------------------------------------------------------------- /src/linux-boot-prober: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . /usr/share/os-prober/common.sh 3 | 4 | set -e 5 | 6 | newns "$@" 7 | require_tmpdir 8 | 9 | grep "^/dev/" /proc/mounts | parse_proc_mounts >"$OS_PROBER_TMP/mounted-map" || true 10 | 11 | partition="$1" 12 | 13 | if [ -z "$partition" ]; then 14 | echo "usage: linux-boot-prober partition" >&2 15 | exit 1 16 | fi 17 | 18 | if ! mapped="$(mapdevfs "$partition")"; then 19 | log "Device '$partition' does not exist; skipping" 20 | continue 21 | fi 22 | 23 | if ! grep -q "^$mapped " "$OS_PROBER_TMP/mounted-map"; then 24 | for test in /usr/lib/linux-boot-probes/*; do 25 | debug "running $test" 26 | if [ -x $test ] && [ -f $test ]; then 27 | if $test "$partition"; then 28 | debug "linux detected by $test" 29 | break 30 | fi 31 | fi 32 | done 33 | else 34 | mpoint=$(grep "^$mapped " "$OS_PROBER_TMP/mounted-map" | head -n1 | cut -d " " -f 2) 35 | mpoint="$(unescape_mount "$mpoint")" 36 | if [ "$mpoint" != "/target/boot" ] && [ "$mpoint" != "/target" ] && [ "$mpoint" != "/" ]; then 37 | type=$(grep "^$mapped " "$OS_PROBER_TMP/mounted-map" | head -n1 | cut -d " " -f 3) 38 | if ! grep -q " $mpoint/boot " "$OS_PROBER_TMP/mounted-map"; then 39 | linux_mount_boot "$partition" "$mpoint" 40 | bootpart="${mountboot%% *}" 41 | bootmounted="${mountboot#* }" 42 | else 43 | bootpart="$partition" 44 | bootmounted=0 45 | fi 46 | for test in /usr/lib/linux-boot-probes/mounted/*; do 47 | if [ -f $test ] && [ -x $test ]; then 48 | debug "running $test on mounted $partition" 49 | if $test "$partition" "$bootpart" "$mpoint" "$type"; then 50 | debug "$test succeeded" 51 | break 52 | fi 53 | fi 54 | done 55 | if [ "$bootmounted" = 1 ]; then 56 | if ! umount "$mpoint/boot"; then 57 | warn "failed to umount $mpoint/boot" 58 | fi 59 | fi 60 | fi 61 | fi 62 | -------------------------------------------------------------------------------- /src/probes/os/mounted/x86/05efi: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Detects all Microsoft OSes on a collection of partitions. 3 | 4 | . /usr/share/os-prober/common.sh 5 | 6 | partition="$1" 7 | mpoint="$2" 8 | type="$3" 9 | 10 | # This file is for UEFI platform only 11 | if [ ! -d /sys/firmware/efi ]; then 12 | debug "Not on UEFI platform" 13 | exit 1 14 | fi 15 | 16 | # Weed out stuff that doesn't apply to us 17 | case "$type" in 18 | vfat) debug "$1 is a FAT32 partition" ;; 19 | msdos) debug "$1 is a FAT16 partition" ;; 20 | fat) debug "$1 is a FAT partition (mounted by GRUB)" ;; 21 | *) debug "$1 is $type partition: exiting"; exit 1 ;; 22 | esac 23 | 24 | if type udevadm > /dev/null 2>&1; then 25 | udevinfo () { 26 | udevadm info "$@" 27 | } 28 | fi 29 | 30 | if type udevinfo > /dev/null 2>&1; then 31 | # Skip virtual devices 32 | if udevinfo -q path -n $partition | grep -q /virtual/; then 33 | debug "$1 is virtual device: exiting" 34 | exit 1 35 | fi 36 | 37 | eval "$(udevinfo -q property -n "$partition" | grep -E '^ID_PART_ENTRY_(TYPE|SCHEME)=')" 38 | debug "$partition partition scheme is $ID_PART_ENTRY_SCHEME" 39 | debug "$partition partition type is $ID_PART_ENTRY_TYPE" 40 | 41 | if [ -z "$ID_PART_ENTRY_TYPE" -o -z "$ID_PART_ENTRY_SCHEME" -o \ 42 | \( "$ID_PART_ENTRY_SCHEME" != gpt -a "$ID_PART_ENTRY_SCHEME" != msdos \) -o \ 43 | \( "$ID_PART_ENTRY_SCHEME" = gpt -a "$ID_PART_ENTRY_TYPE" != c12a7328-f81f-11d2-ba4b-00a0c93ec93b \) -o \ 44 | \( "$ID_PART_ENTRY_SCHEME" = msdos -a "$ID_PART_ENTRY_TYPE" != 0xef \) ]; then 45 | debug "$partition is not a ESP partition: exiting" 46 | exit 1 47 | fi 48 | else 49 | debug "udevinfo and udevadm missing - cannot check partition type" 50 | fi 51 | 52 | efi=$(item_in_dir efi "$mpoint") 53 | if [ -z "$efi" ]; then 54 | debug "$mpoint does not have /EFI directory: exiting" 55 | exit 1 56 | fi 57 | 58 | ret=1 59 | for test in /usr/lib/os-probes/mounted/efi/*; do 60 | debug "running subtest $test" 61 | if [ -f "$test" ] && [ -x "$test" ]; then 62 | entry=$("$test" "$mpoint/$efi") 63 | if [ -n "$entry" ]; then 64 | debug "bootloader $entry found by subtest $test" 65 | ret=0 66 | result "${partition}@/$efi/${entry}:efi" 67 | fi 68 | fi 69 | done 70 | 71 | exit $ret 72 | -------------------------------------------------------------------------------- /src/probes/linux-boot/mounted/common/90fallback: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Fallback in case nothing else works. Look for vmlinu[xz] file in root and 3 | # /boot, see if there is a matching initrd, and wing it. 4 | . /usr/share/os-prober/common.sh 5 | set -e 6 | 7 | partition="$1" 8 | bootpart="$2" 9 | mpoint="$3" 10 | type="$4" 11 | 12 | mappedpartition=$(mapdevfs "$partition" 2>/dev/null) || mappedpartition="$partition" 13 | 14 | exitcode=1 15 | for kernpat in /vmlinuz /vmlinux /boot/vmlinuz /boot/vmlinux "/boot/vmlinuz*" \ 16 | "/boot/vmlinux*" "/vmlinuz*" "/vmlinux*" "/kernel-*" "/boot/kernel-*"; do 17 | if echo "$kernpat" | grep -q boot/; then 18 | kernbootpart="$bootpart" 19 | else 20 | kernbootpart="$partition" 21 | fi 22 | for kernfile in $(eval ls "$mpoint$kernpat" 2>/dev/null); do 23 | kernbasefile=$(echo "$kernfile" | sed "s!^$mpoint!!") 24 | if [ -f "$kernfile" ] && [ ! -L "$kernfile" ]; then 25 | initrdname=$(echo "$kernfile" | sed "s/vmlinu[zx]/initrd\*/") 26 | # Yellow Dog Linux appends .img to it. 27 | initrdname1="${initrdname}.img" 28 | # Arch Linux names its initrds weirdly. We take 29 | # some care here to avoid false positives on other 30 | # systems, since kernel.img could conceivably be a 31 | # kernel itself. 32 | initrdname2=$(echo "$kernfile" | sed -n 's/vmlinu[zx]\([0-9][0-9]*\)/kernel\1/p' | sed 's/$/.img/') 33 | # Dracut initramfses are named differently again. 34 | initrdname3=$(echo "$kernfile" | sed "s/vmlinu[zx]/initramfs\*/" | sed 's/$/.img/') 35 | # And Gentoo's also 36 | initrdname4=$(echo "$kernfile" | sed "s/kernel/initramfs\*/") 37 | foundinitrd=0 38 | for initrd in $(eval ls "$initrdname" "$initrdname1" "$initrdname2" "$initrdname3" "$initrdname4" 2>/dev/null); do 39 | if [ "$initrd" != "$kernfile" ] && [ -f "$initrd" ] && [ ! -L "$initrd" ]; then 40 | initrd=$(echo "$initrd" | sed "s!^$mpoint!!") 41 | result "$partition:$kernbootpart::$kernbasefile:$initrd:root=$mappedpartition" 42 | exitcode=0 43 | foundinitrd=1 44 | fi 45 | done 46 | if [ "$foundinitrd" = 0 ]; then 47 | result "$partition:$kernbootpart::$kernbasefile::root=$mappedpartition" 48 | exitcode=0 49 | fi 50 | fi 51 | done 52 | done 53 | exit "$exitcode" 54 | -------------------------------------------------------------------------------- /src/probes/linux-boot/common/50mounted-tests: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Sub-tests that require a mounted partition. 3 | . /usr/share/os-prober/common.sh 4 | set -e 5 | 6 | partition="$1" 7 | 8 | types="$(fs_type "$partition")" || types=NOT-DETECTED 9 | if [ "$types" = NOT-DETECTED ]; then 10 | debug "$1 type not recognised; skipping" 11 | exit 0 12 | elif [ "$types" = swap ]; then 13 | debug "$1 is a swap partition; skipping" 14 | exit 0 15 | elif [ "$types" = crypto_LUKS ]; then 16 | debug "$1 is a LUKS partition; skipping" 17 | exit 0 18 | elif [ "$types" = ntfs ]; then 19 | if type ntfs-3g >/dev/null 2>&1; then 20 | types='ntfs-3g ntfs' 21 | fi 22 | elif [ -z "$types" ]; then 23 | if type cryptsetup >/dev/null 2>&1 && \ 24 | cryptsetup luksDump "$partition" >/dev/null 2>&1; then 25 | debug "$1 is a LUKS partition; skipping" 26 | exit 0 27 | fi 28 | types="$(grep -v nodev /proc/filesystems)" 29 | fi 30 | 31 | tmpmnt=/var/lib/os-prober/mount 32 | if [ ! -d "$tmpmnt" ]; then 33 | mkdir "$tmpmnt" 34 | fi 35 | 36 | mounted= 37 | if type grub-mount >/dev/null 2>&1 && \ 38 | type grub-probe >/dev/null 2>&1 && \ 39 | grub-mount "$partition" "$tmpmnt" 2>/dev/null; then 40 | mounted=1 41 | type="$(grub-probe -d "$partition" -t fs)" 42 | [ "$type" ] || type=fuseblk 43 | else 44 | ro_partition "$partition" 45 | for type in $types; do 46 | if mount -o ro -t "$type" "$partition" "$tmpmnt" 2>/dev/null; then 47 | mounted=1 48 | break 49 | fi 50 | done 51 | fi 52 | 53 | if [ "$mounted" ]; then 54 | linux_mount_boot "$partition" "$tmpmnt" 55 | bootpart="${mountboot%% *}" 56 | mounted="${mountboot#* }" 57 | 58 | for test in /usr/lib/linux-boot-probes/mounted/*; do 59 | if [ -f "$test" ] && [ -x "$test" ]; then 60 | debug "running $test $partition $bootpart $tmpmnt $type" 61 | if $test "$partition" "$bootpart" "$tmpmnt" "$type"; then 62 | debug "$test succeeded" 63 | umount "$tmpmnt/boot" 2>/dev/null || true 64 | if ! umount "$tmpmnt"; then 65 | warn "failed to umount $tmpmnt" 66 | fi 67 | rmdir "$tmpmnt" || true 68 | exit 0 69 | fi 70 | fi 71 | done 72 | 73 | umount "$tmpmnt/boot" 2>/dev/null || true 74 | if ! umount "$tmpmnt"; then 75 | warn "failed to umount $tmpmnt" 76 | fi 77 | fi 78 | 79 | rmdir "$tmpmnt" || true 80 | 81 | # No tests found anything. 82 | exit 1 83 | -------------------------------------------------------------------------------- /src/probes/os/common/50mounted-tests: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Sub-tests that require a mounted partition. 3 | set -e 4 | partition="$1" 5 | 6 | . /usr/share/os-prober/common.sh 7 | 8 | types="$(fs_type "$partition")" || types=NOT-DETECTED 9 | if [ "$types" = NOT-DETECTED ]; then 10 | debug "$1 type not recognised; skipping" 11 | exit 0 12 | elif [ "$types" = swap ]; then 13 | debug "$1 is a swap partition; skipping" 14 | exit 0 15 | elif [ "$types" = crypto_LUKS ]; then 16 | debug "$1 is a LUKS partition; skipping" 17 | exit 0 18 | elif [ "$types" = ntfs ]; then 19 | if type ntfs-3g >/dev/null 2>&1; then 20 | types='ntfs-3g ntfs' 21 | fi 22 | elif [ -z "$types" ]; then 23 | if type cryptsetup >/dev/null 2>&1 && \ 24 | cryptsetup luksDump "$partition" >/dev/null 2>&1; then 25 | debug "$1 is a LUKS partition; skipping" 26 | exit 0 27 | fi 28 | for type in $(grep -v nodev /proc/filesystems); do 29 | # hfsplus filesystems are mountable as hfs. Try hfs last so 30 | # that we can tell the difference. 31 | if [ "$type" = hfs ]; then 32 | delaytypes="${delaytypes:+$delaytypes }$type" 33 | elif [ "$type" = fuseblk ]; then 34 | if type ntfs-3g >/dev/null 2>&1; then 35 | types="${types:+$types }ntfs-3g" 36 | fi 37 | else 38 | types="${types:+$types }$type" 39 | fi 40 | done 41 | fi 42 | 43 | tmpmnt=/var/lib/os-prober/mount 44 | if [ ! -d "$tmpmnt" ]; then 45 | mkdir "$tmpmnt" 46 | fi 47 | 48 | mounted= 49 | if type grub-mount >/dev/null 2>&1 && \ 50 | type grub-probe >/dev/null 2>&1 && \ 51 | grub-mount "$partition" "$tmpmnt" 2>/dev/null; then 52 | mounted=1 53 | type="$(grub-probe -d "$partition" -t fs)" || true 54 | if [ "$type" ]; then 55 | debug "mounted using GRUB $type filesystem driver" 56 | else 57 | debug "mounted using GRUB, but unknown filesystem?" 58 | type=fuseblk 59 | fi 60 | else 61 | ro_partition "$partition" 62 | for type in $types $delaytypes; do 63 | if mount -o ro -t "$type" "$partition" "$tmpmnt" 2>/dev/null; then 64 | debug "mounted as $type filesystem" 65 | mounted=1 66 | break 67 | fi 68 | done 69 | fi 70 | 71 | if [ "$mounted" ]; then 72 | for test in /usr/lib/os-probes/mounted/*; do 73 | debug "running subtest $test" 74 | if [ -f "$test" ] && [ -x "$test" ]; then 75 | if "$test" "$partition" "$tmpmnt" "$type"; then 76 | debug "os found by subtest $test" 77 | if ! umount "$tmpmnt"; then 78 | warn "failed to umount $tmpmnt" 79 | fi 80 | rmdir "$tmpmnt" || true 81 | exit 0 82 | fi 83 | fi 84 | done 85 | if ! umount "$tmpmnt"; then 86 | warn "failed to umount $tmpmnt" 87 | fi 88 | fi 89 | 90 | rmdir "$tmpmnt" || true 91 | 92 | # No tests found anything. 93 | exit 1 94 | -------------------------------------------------------------------------------- /src/probes/linux-boot/mounted/x86/40grub: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . /usr/share/os-prober/common.sh 3 | set -e 4 | 5 | partition="$1" 6 | bootpart="$2" 7 | mpoint="$3" 8 | type="$4" 9 | 10 | found_item=0 11 | 12 | entry_result () { 13 | if [ "$ignore_item" = 0 ] && \ 14 | [ -n "$kernel" ] && \ 15 | [ -e "$mpoint/$kernel" ]; then 16 | result "$rootpart:$bootpart:$title:$kernel:$initrd:$parameters" 17 | found_item=1 18 | fi 19 | kernel="" 20 | parameters="" 21 | initrd="" 22 | title="" 23 | ignore_item=0 24 | } 25 | 26 | parse_grub_menu () { 27 | mpoint="$1" 28 | rootpart="$2" 29 | bootpart="$3" 30 | 31 | kernel="" 32 | parameters="" 33 | initrd="" 34 | title="" 35 | ignore_item=0 36 | 37 | while read line; do 38 | #debug "parsing: $line" 39 | set -f 40 | set -- $line 41 | set +f 42 | case "$1" in 43 | title) 44 | entry_result 45 | shift 1 46 | title="$(echo "$@" | sed 's/://g')" 47 | if echo "$title" | grep -q '(on /dev/[^)]*)$'; then 48 | log "Skipping entry '$title':" 49 | log "appears to be an automatic reference taken from another menu.lst" 50 | ignore_item=1 51 | fi 52 | ;; 53 | kernel) 54 | # Hack alert: sed off any (hdn,n) but 55 | # assume the kernel is on the same 56 | # partition. 57 | kernel="$(echo "$2" | sed 's/(.*)//')" 58 | shift 2 59 | parameters="$@" 60 | # Systems with a separate /boot will not have 61 | # the path to the kernel in menu.lst. 62 | if [ "$partition" != "$bootpart" ]; then 63 | kernel="/boot$kernel" 64 | fi 65 | ;; 66 | initrd) 67 | # Hack alert take 2: sed off any (hdn,n) 68 | # See #566102 69 | initrd="$(echo "$2" | sed 's/(.*)//')" 70 | # Initrd same. 71 | if [ "$partition" != "$bootpart" ]; then 72 | initrd="/boot$initrd" 73 | fi 74 | ;; 75 | boot) 76 | entry_result 77 | ;; 78 | module) 79 | log "Skipping entry '$title':" 80 | log "parsing of entries containing 'module' lines is currently not supported" 81 | ignore_item=1 82 | ;; 83 | esac 84 | done 85 | 86 | entry_result 87 | } 88 | 89 | grubconf= 90 | if [ -e "$mpoint/boot/grub/menu.lst" ]; then 91 | grubconf="menu.lst" 92 | elif [ -e "$mpoint/boot/grub/grub.conf" ]; then 93 | grubconf="grub.conf" 94 | fi 95 | 96 | if [ "$grubconf" ] && \ 97 | ([ ! -e "$mpoint/boot/grub/grub.cfg" ] || \ 98 | [ "$mpoint/boot/grub/$grubconf" -nt "$mpoint/boot/grub/grub.cfg" ]); then 99 | debug "parsing $grubconf" 100 | parse_grub_menu "$mpoint" "$partition" "$bootpart" < "$mpoint/boot/grub/$grubconf" 101 | fi 102 | 103 | if [ "$found_item" = 0 ]; then 104 | exit 1 105 | else 106 | exit 0 107 | fi 108 | -------------------------------------------------------------------------------- /src/probes/linux-boot/mounted/powerpc/40yaboot: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . /usr/share/os-prober/common.sh 3 | set -e 4 | 5 | partition="$1" 6 | bootpart="$2" 7 | mpoint="$3" 8 | type="$4" 9 | 10 | found_item=0 11 | 12 | dequote () { 13 | item="${1%\"}" 14 | echo "${item#\"}" 15 | } 16 | 17 | recordstanza () { 18 | if [ -n "$kernel" ]; then 19 | # TODO: handle device=/partition= to find images 20 | if ! [ -e "$mpoint/$kernel" ]; then 21 | debug "cannot find $kernel; not recording" 22 | return 23 | fi 24 | if [ "$initrd" ] && ! [ -e "$mpoint/$initrd" ]; then 25 | debug "cannot find $initrd: not recording" 26 | return 27 | fi 28 | 29 | if [ -z "$title" ]; then 30 | title="$(basename "$kernel")" 31 | fi 32 | if [ "$read_only" ]; then 33 | parameters="ro $parameters" 34 | fi 35 | if [ "$rootdev" ]; then 36 | parameters="root=$rootdev $parameters" 37 | fi 38 | parameters="${parameters% }" 39 | result "$rootpart:$bootpart:$title:$kernel:$initrd:$parameters" 40 | found_item=1 41 | 42 | title= 43 | rootdev="$default_rootdev" 44 | kernel="$default_kernel" 45 | parameters="$default_parameters" 46 | initrd="$default_initrd" 47 | read_only="$default_read_only" 48 | else 49 | # Everything in the global options section set default values. 50 | default_rootdev="$rootdev" 51 | default_kernel="$kernel" 52 | default_parameters="$parameters" 53 | default_initrd="$initrd" 54 | default_read_only="$read_only" 55 | fi 56 | } 57 | 58 | parse_yaboot_conf () { 59 | mpoint="$1" 60 | rootpart="$2" 61 | bootpart="$3" 62 | IFS=" =" 63 | while read line; do 64 | debug "parsing: $line" 65 | set -f 66 | set -- $line 67 | set +f 68 | case "$1" in 69 | root) 70 | rootdev="$(dequote "$2")" 71 | ;; 72 | image) 73 | recordstanza 74 | kernel="$(dequote "$2")" 75 | ;; 76 | append) 77 | shift 1 78 | parameters="$(dequote "${line#append=}")" 79 | ;; 80 | initrd) 81 | initrd="$(dequote "$2")" 82 | ;; 83 | label) 84 | shift 1 85 | title="$(dequote "$*")" 86 | ;; 87 | alias) 88 | shift 1 89 | titlealias="$(dequote "$*")" 90 | ;; 91 | read-only) 92 | read_only=1 93 | ;; 94 | esac 95 | done 96 | recordstanza 97 | } 98 | 99 | # Avoid failing if archdetect is missing (running outside d-i). This is 100 | # suboptimal but will do for now. 101 | if type archdetect >/dev/null 2>&1; then 102 | case "`archdetect`" in 103 | powerpc/powermac_newworld) 104 | ;; 105 | powerpc/chrp*) 106 | ;; 107 | *) 108 | exit 1 109 | ;; 110 | esac 111 | fi 112 | 113 | if [ -e "$mpoint/etc/yaboot.conf" ]; then 114 | debug "parsing yaboot.conf" 115 | parse_yaboot_conf "$mpoint" "$partition" "$bootpart" < "$mpoint/etc/yaboot.conf" 116 | fi 117 | 118 | if [ "$found_item" = 0 ]; then 119 | exit 1 120 | else 121 | exit 0 122 | fi 123 | -------------------------------------------------------------------------------- /src/probes/linux-boot/mounted/x86/50lilo: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . /usr/share/os-prober/common.sh 3 | set -e 4 | 5 | partition="$1" 6 | bootpart="$2" 7 | mpoint="$3" 8 | type="$4" 9 | 10 | found_item=0 11 | 12 | title="" 13 | rootdev="" 14 | kernel="" 15 | parameters="" 16 | initrd="" 17 | read_only="" 18 | added_parameters=0 19 | default_rootdev="" 20 | default_kernel="" 21 | default_parameters="" 22 | default_initrd="" 23 | default_read_only="" 24 | 25 | dequote () { 26 | item="${1%\"}" 27 | echo "${item#\"}" 28 | } 29 | 30 | addparams () { 31 | # Any parameters we find replace the default parameters, but 32 | # otherwise append. 33 | if [ "$added_parameters" = 0 ]; then 34 | parameters="$1" 35 | added_parameters=1 36 | else 37 | parameters="${parameters:+$parameters }$1" 38 | fi 39 | } 40 | 41 | recordstanza () { 42 | if [ -n "$kernel" ] && [ -n "$title" ]; then 43 | if [ -e "$mpoint/$kernel" ] && [ -e "$mpoint/$initrd" ]; then 44 | if [ "$read_only" ]; then 45 | parameters="ro $parameters" 46 | fi 47 | if [ "$rootdev" ]; then 48 | parameters="root=$rootdev $parameters" 49 | fi 50 | parameters="${parameters% }" 51 | result "$rootpart:$bootpart:$title:$kernel:$initrd:$parameters" 52 | found_item=1 53 | else 54 | debug "cannot find $kernel or $initrd, not recording" 55 | fi 56 | title="" 57 | rootdev="$default_rootdev" 58 | kernel="$default_kernel" 59 | parameters="$default_parameters" 60 | initrd="$default_initrd" 61 | read_only="$default_read_only" 62 | added_parameters=0 63 | else 64 | # Everything before set default values. 65 | default_rootdev="$rootdev" 66 | default_kernel="$kernel" 67 | default_parameters="$parameters" 68 | default_initrd="$initrd" 69 | default_read_only="$read_only" 70 | fi 71 | } 72 | 73 | parse_lilo_conf () { 74 | mpoint="$1" 75 | rootpart="$2" 76 | bootpart="$3" 77 | IFS=" =" 78 | while read line; do 79 | debug "parsing: $line" 80 | set -f 81 | set -- $line 82 | set +f 83 | case "$1" in 84 | root) 85 | rootdev=$(dequote "$2") 86 | ;; 87 | image) 88 | recordstanza 89 | # Dereference if symbolic link 90 | kernel="$(readlink -f "$(dequote "$2")")" 91 | ;; 92 | append) 93 | addparams "$(dequote "${line#append=}")" 94 | ;; 95 | initrd) 96 | # Dereference if symbolic link 97 | initrd="$(readlink -f "$(dequote "$2")")" 98 | ;; 99 | label) 100 | shift 1 101 | title="$(dequote "$*" | sed -e 's/:/ /g')" 102 | ;; 103 | other) 104 | recordstanza 105 | ;; 106 | read-only) 107 | read_only=1 108 | ;; 109 | vga) 110 | addparams "$line" 111 | ;; 112 | esac 113 | done 114 | recordstanza 115 | } 116 | 117 | if [ -e "$mpoint/etc/lilo.conf" ]; then 118 | debug "parsing lilo.conf" 119 | parse_lilo_conf "$mpoint" "$partition" "$bootpart" < "$mpoint/etc/lilo.conf" 120 | fi 121 | 122 | if [ "$found_item" = 0 ]; then 123 | exit 1 124 | else 125 | exit 0 126 | fi 127 | -------------------------------------------------------------------------------- /src/probes/linux-boot/mounted/common/40grub2: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . /usr/share/os-prober/common.sh 3 | set -e 4 | 5 | partition="$1" 6 | bootpart="$2" 7 | mpoint="$3" 8 | type="$4" 9 | 10 | found_item=0 11 | 12 | entry_result () { 13 | if [ "$ignore_item" = 0 ] && \ 14 | [ -n "$kernel" ] && \ 15 | [ -e "$mpoint/$kernel" ]; then 16 | result "$rootpart:$bootpart:$title:$kernel:$initrd:$parameters" 17 | found_item=1 18 | fi 19 | kernel="" 20 | parameters="" 21 | initrd="" 22 | title="" 23 | ignore_item=0 24 | } 25 | 26 | parse_grub_menu () { 27 | mpoint="$1" 28 | rootpart="$2" 29 | bootpart="$3" 30 | 31 | kernel="" 32 | parameters="" 33 | initrd="" 34 | title="" 35 | ignore_item=0 36 | 37 | while read line; do 38 | debug "parsing: $line" 39 | set -f 40 | set -- $line 41 | set +f 42 | case "$1" in 43 | menuentry) 44 | entry_result 45 | shift 1 46 | # The double-quoted string is the title. 47 | # Make sure to look at the text of the line 48 | # before 'set' mangled it. 49 | title="$(echo "$line" | sed -n 's/[^"]*"\(.*\)".*/\1/p' | sed 's/://g')" 50 | if [ -z "$title" ]; then 51 | # ... or single-quoted? Be careful 52 | # to handle constructions like 53 | # 'foo'\''bar' (which expands to 54 | # foo'bar, as in shell), and to 55 | # handle multiple single-quoted 56 | # strings on the same line. 57 | title="$(echo "$line" | sed -n "s/[^']*'\(\([^']\|'\\\\''\)*\)'.*/\1/p" | sed "s/'\\\\''/'/; s/://g")" 58 | fi 59 | if [ -z "$title" ]; then 60 | ignore_item=1 61 | elif echo "$title" | grep -q '(on /dev/[^)]*)$'; then 62 | log "Skipping entry '$title':" 63 | log "appears to be an automatic reference taken from another menu.lst" 64 | ignore_item=1 65 | fi 66 | ;; 67 | linux) 68 | # Hack alert: sed off any (hdn,n) but 69 | # assume the kernel is on the same 70 | # partition. 71 | kernel="$(echo "$2" | sed 's/(.*)//')" 72 | shift 2 73 | parameters="$@" 74 | # Systems with a separate /boot will not have 75 | # the path to the kernel in grub.cfg. 76 | if [ "$partition" != "$bootpart" ]; then 77 | kernel="/boot$kernel" 78 | fi 79 | ;; 80 | initrd) 81 | initrd="$(echo "$2" | sed 's/(.*)//')" 82 | # Initrd same. 83 | if [ "$partition" != "$bootpart" ]; then 84 | initrd="/boot$initrd" 85 | fi 86 | ;; 87 | "}") 88 | entry_result 89 | ;; 90 | esac 91 | done 92 | 93 | entry_result 94 | } 95 | 96 | if [ -e "$mpoint/boot/grub/grub.cfg" ] && \ 97 | ([ ! -e "$mpoint/boot/grub/menu.lst" ] || \ 98 | [ "$mpoint/boot/grub/grub.cfg" -nt "$mpoint/boot/grub/menu.lst" ]); then 99 | debug "parsing grub.cfg" 100 | parse_grub_menu "$mpoint" "$partition" "$bootpart" < "$mpoint/boot/grub/grub.cfg" 101 | elif [ -e "$mpoint/boot/grub2/grub.cfg" ]; then 102 | debug "parsing grub.cfg" 103 | parse_grub_menu "$mpoint" "$partition" "$bootpart" < "$mpoint/boot/grub2/grub.cfg" 104 | fi 105 | 106 | if [ "$found_item" = 0 ]; then 107 | exit 1 108 | else 109 | exit 0 110 | fi 111 | -------------------------------------------------------------------------------- /src/probes/linux-boot/mounted/sparc/50silo: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . /usr/share/os-prober/common.sh 3 | set -e 4 | 5 | partition="$1" 6 | bootpart="$2" 7 | mpoint="$3" 8 | type="$4" 9 | 10 | found_item=0 11 | 12 | title="" 13 | rootdev="" 14 | kernel="" 15 | parameters="" 16 | initrd="" 17 | read_only="" 18 | default_rootdev="" 19 | default_kernel="" 20 | default_parameters="" 21 | default_initrd="" 22 | default_read_only="" 23 | 24 | dequote () { 25 | item="${1%\"}" 26 | echo "${item#\"}" 27 | } 28 | 29 | recordstanza () { 30 | if [ -n "$kernel" ] && [ -n "$title" ]; then 31 | if [ -e "$mpoint/$kernel" ] || [ -e "$mpoint/boot$kernel" ]; then 32 | if [ -e "$mpoint/boot$initrd" ] || [ -e "$mpoint/$initrd" ]; then 33 | if [ "$read_only" ]; then 34 | parameters="ro $parameters" 35 | fi 36 | if [ "$rootdev" ]; then 37 | parameters="root=$rootdev $parameters" 38 | fi 39 | parameters="${parameters% }" 40 | result "$rootpart:$bootpart:$title:$kernel:$initrd:$parameters" 41 | found_item=1 42 | else 43 | debug "cannot find $initrd, not recording" 44 | fi 45 | else 46 | debug "cannot find $kernel, not recording" 47 | fi 48 | title="" 49 | rootdev="$default_rootdev" 50 | kernel="$default_kernel" 51 | parameters="$default_parameters" 52 | initrd="$default_initrd" 53 | read_only="$default_read_only" 54 | else 55 | # Everything before set default values. 56 | default_rootdev="$rootdev" 57 | default_kernel="$kernel" 58 | default_parameters="$parameters" 59 | default_initrd="$initrd" 60 | default_read_only="$read_only" 61 | fi 62 | } 63 | 64 | parse_silo_conf () { 65 | mpoint="$1" 66 | rootpart="$2" 67 | bootpart="$3" 68 | IFS=" =" 69 | while read line; do 70 | debug "parsing: $line" 71 | set -f 72 | set -- $line 73 | set +f 74 | case "$1" in 75 | root) 76 | rootdev=$(dequote "$2") 77 | ;; 78 | image) 79 | recordstanza 80 | # Dereference if symbolic link 81 | if echo "$2" | grep -qs "/boot/"; then 82 | kernel="$(readlink -f "$(dequote "$mpoint$2")" | sed -e 's#'"$mpoint"'##g')" 83 | else 84 | kernel="$(readlink -f "$(dequote "$mpoint/boot$2")" | sed -e 's#'"$mpoint"'/boot##g')" 85 | fi 86 | ;; 87 | append) 88 | shift 1 89 | parameters=$(dequote "${line#append=}") 90 | ;; 91 | initrd) 92 | # Dereference if symbolic link 93 | if echo "$2" | grep -qs "/boot/"; then 94 | initrd="$(readlink -f "$(dequote "$mpoint$2")" | sed -e 's#'"$mpoint"'##g')" 95 | else 96 | initrd="$(readlink -f "$(dequote "$mpoint/boot$2")" | sed -e 's#'"$mpoint"'/boot##g')" 97 | fi 98 | ;; 99 | label) 100 | shift 1 101 | title=$(dequote "$*" | sed -e 's/:/ /g') 102 | ;; 103 | other) 104 | recordstanza 105 | ;; 106 | read-only) 107 | read_only=1 108 | ;; 109 | esac 110 | done 111 | recordstanza 112 | } 113 | 114 | if [ -e "$mpoint/boot/silo.conf" ]; then 115 | debug "parsing silo.conf" 116 | parse_silo_conf "$mpoint" "$partition" "$bootpart" < "$mpoint/boot/silo.conf" 117 | fi 118 | 119 | if [ "$found_item" = 0 ]; then 120 | exit 1 121 | else 122 | exit 0 123 | fi 124 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | This is a small package that may be depended on by any bootloader 2 | installer package to detect other filesystems with operating systems on 3 | them, and work out how to boot other linux installs. 4 | 5 | os-prober 6 | -------- 7 | 8 | All one has to do is Depend on os-prober, and then run the os-prober 9 | command. This command takes no arguments: it will scan all disks available 10 | on the system for other operating systems, and output a list of strings 11 | such as: 12 | 13 | /dev/sda1:Windows NT/2000/XP:WinNT:chain 14 | ^-------^ ^----------------^ ^---^ ^---^ 15 | part. OS name for boot short May change: type of boot loader 16 | loader's pretty name required. Usually there is only 17 | output a 'linux' style bootloader or 18 | a chain one for other partitions 19 | with their own boot sectors. 20 | 21 | Tests are executable programs in the directory /usr/lib/os-probes/. Each 22 | test is called once per partition, with the partiton to check as its 23 | parameter, and may output a string as described above, or nothing if it does 24 | not recognise an OS on that partition. Tests return an exit code of 0 25 | if they successfully found an OS, and no further tests will be run on that 26 | partition; or return an exit code of 1 to indicate that no OS was found, 27 | and let the next test run. 28 | 29 | Tests that require the partition to be mounted can be placed in 30 | /usr/lib/os-probes/mounted/. These tests are passed the following 31 | parameters: partition, mount point, filesystem. 32 | 33 | Bootloader installer packages will then have to process this output (fairly 34 | trivial) to create valid configuration entries for the bootloader. 35 | 36 | Note that os-prober can find other Linux installations, as well as other 37 | operating systems. It does not try to work out all the information needed 38 | to boot Linux (initrd, kernel params, etc). That task is left to 39 | linux-boot-prober. 40 | 41 | linux-boot-prober 42 | ----------------- 43 | 44 | the linux-boot-prober command should be run with a single argument 45 | consisting of a partition that is known to have a linux root filesystem on 46 | it, as returned by the os-prober command. It will try to work out how to 47 | boot that linux installation, and if it is successful, will output one or 48 | more lines in the form: 49 | 50 | /dev/sda2:/dev/sda1:Linux:/vmlinuz:/initrd.gz:root=/dev/sda1 51 | ^-------^ ^-------^ ^---^ ^------^ ^--------^ ^------------^ 52 | root boot label kernel initrd kernel params 53 | part. part. 54 | 55 | The root partition and boot partition may of course be the same. No guarantee 56 | is made that any partitions referred to in the kernel parameters will still be 57 | in the same place after Debian is installed, or that the /etc/fstab of the 58 | system will be right, or that the system will even boot. The initrd field may 59 | be empty if there is no initrd. The label is whatever label was used in the 60 | boot loader for this linux installation, and it may be quite long or very 61 | short (or nonexistent), and may be inaccurate, confusing, or non-unique. See 62 | TODO for other limitations. 63 | 64 | The tests used by linux-boot-prober are in the directory 65 | /usr/lib/linux-boot-probes/ and also in /usr/lib/linux-boot-probes/mounted, 66 | and they are called in a similar way as the os-probes described above. 67 | The mounted probes are passed parameters for the root partition, the boot 68 | partition, and the directory the filesystems are mounted in. 69 | 70 | linux-boot-prober skips over partitions that are currently mounted on /, 71 | /target, or /target/boot. 72 | -------------------------------------------------------------------------------- /src/probes/os/mounted/x86/20microsoft: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Detects all Microsoft OSes on a collection of partitions. 3 | 4 | . /usr/share/os-prober/common.sh 5 | 6 | partition="$1" 7 | mpoint="$2" 8 | type="$3" 9 | 10 | # This script looks for legacy BIOS bootloaders only. Skip if running UEFI 11 | if [ -d /sys/firmware/efi ]; then 12 | debug "Skipping legacy bootloaders on UEFI system" 13 | exit 1 14 | fi 15 | 16 | # Weed out stuff that doesn't apply to us 17 | case "$type" in 18 | ntfs|ntfs-3g) debug "$1 is a NTFS partition" ;; 19 | vfat) debug "$1 is a FAT32 partition" ;; 20 | msdos) debug "$1 is a FAT16 partition" ;; 21 | fat) debug "$1 is a FAT partition (mounted by GRUB)" ;; 22 | fuse|fuseblk) debug "$1 is a FUSE partition" ;; # might be ntfs-3g 23 | *) debug "$1 is not a MS partition: exiting"; exit 1 ;; 24 | esac 25 | 26 | found= 27 | # Vista (previously Longhorn) 28 | if item_in_dir -q bootmgr "$2"; then 29 | # there might be different boot directories in different case as: 30 | # boot Boot BOOT 31 | for boot in $(item_in_dir boot "$2"); do 32 | bcd=$(item_in_dir bcd "$2/$boot") 33 | if [ -n "$bcd" ]; then 34 | if grep -qs "W.i.n.d.o.w.s. .8" "$2/$boot/$bcd"; then 35 | long="Windows 8 (loader)" 36 | elif grep -qs "W.i.n.d.o.w.s. .7" "$2/$boot/$bcd"; then 37 | long="Windows 7 (loader)" 38 | elif grep -qs "W.i.n.d.o.w.s. .V.i.s.t.a" "$2/$boot/$bcd"; then 39 | long="Windows Vista (loader)" 40 | 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 41 | long="Windows Server 2008 R2 (loader)" 42 | elif grep -qs "W.i.n.d.o.w.s. .S.e.r.v.e.r. .2.0.0.8." "$2/$boot/$bcd"; then 43 | long="Windows Server 2008 (loader)" 44 | 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 45 | long="Windows Recovery Environment (loader)" 46 | elif grep -qs "W.i.n.d.o.w.s. .S.e.t.u.p" "$2/$boot/$bcd"; then 47 | long="Windows Recovery Environment (loader)" 48 | else 49 | long="Windows Vista (loader)" 50 | fi 51 | short=Windows 52 | 53 | found=true 54 | 55 | break 56 | fi 57 | done 58 | fi 59 | 60 | # 2000/XP/NT4.0 61 | if [ -z "$found" ] && item_in_dir -q ntldr "$2" && item_in_dir -q ntdetect.com "$2"; then 62 | long="Windows NT/2000/XP" 63 | short=Windows 64 | ini=$(item_in_dir boot.ini "$2") 65 | if [ -n "$ini" ]; then 66 | multicount="$(grep -e "^multi" "$2/$ini" | wc -l)" 67 | scsicount="$(grep -e "^scsi" "$2/$ini" | wc -l)" 68 | msoscount="$(expr "${multicount}" + "${scsicount}")" 69 | if [ "$msoscount" -eq 1 ]; then 70 | # We need to remove a Carriage Return at the end of 71 | # the line... 72 | defaultmspart="$(grep -e "^default=" "$2/$ini" | cut -d '=' -f2 | tr -d '\r')" 73 | # Escape any backslashes in defaultmspart 74 | grepexp="^$(echo "$defaultmspart" | sed -e 's/\\/\\\\/')=" 75 | # Colons not allowed; replace by spaces 76 | # Accented characters (non UTF-8) cause debconf to 77 | # hang, so we fall back to the default if the name 78 | # contains any weird characters. 79 | long="$(grep -e "$grepexp" "$2/$ini" | cut -d '"' -f2 | \ 80 | tr ':' ' ' | LC_ALL=C grep -v '[^a-zA-Z0-9 &()/_-]')" 81 | if [ -z "$long" ]; then 82 | long="Windows NT/2000/XP" 83 | fi 84 | else 85 | long="Windows NT/2000/XP (loader)" 86 | fi 87 | 88 | found=true 89 | fi 90 | fi 91 | 92 | # MS-DOS 93 | if [ -z "$found" ] && item_in_dir -q dos "$2"; then 94 | long="MS-DOS 5.x/6.x/Win3.1" 95 | short=MS-DOS 96 | 97 | found=true 98 | fi 99 | 100 | # 95/98/Me 101 | if [ -z "$found" ] && item_in_dir -q windows "$2" && 102 | item_in_dir -q win.com "$2"/"$(item_in_dir windows "$2")"; then 103 | long="Windows 95/98/Me" 104 | short=Windows9xMe 105 | 106 | found=true 107 | fi 108 | 109 | if [ -z "$found" ]; then 110 | exit 1 111 | fi 112 | 113 | label="$(count_next_label "$short")" 114 | result "${partition}:${long}:${label}:chain" 115 | exit 0 116 | -------------------------------------------------------------------------------- /src/probes/os/mounted/common/90linux-distro: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Test for linux distributions. 3 | set -e 4 | 5 | . /usr/share/os-prober/common.sh 6 | 7 | partition="$1" 8 | dir="$2" 9 | type="$3" 10 | 11 | # This test is inaccurate, but given separate / and /boot partitions and the 12 | # fact that only some architectures have ld-linux.so, I can't see anything 13 | # better. Make sure this test has a high number so that more accurate tests 14 | # can come first. 15 | # Unless volumes to checked are already mounted, they will be mounted using 16 | # GRUB's own filesystems through FUSE. Since these ATM doesn't support 17 | # symlinks we need to also check in $dir/usr/lib* for distributions that 18 | # moved /lib* to /usr and only left symlinks behind. 19 | # TODO: look for ld-linux.so on arches that have it 20 | if (ls "$dir"/lib*/ld*.so* || ls "$dir"/usr/lib*/ld*.so*) >/dev/null 2>/dev/null; then 21 | if [ -e "$dir/etc/debian_version" ]; then 22 | short="Debian" 23 | long="$(printf "Debian GNU/Linux (%s)\n" "$(cat "$dir/etc/debian_version")")" 24 | # RPM derived distributions may also have a redhat-release or 25 | # mandrake-release, so check their files first. 26 | elif [ -e "$dir/etc/altlinux-release" ]; then 27 | short="ALTLinux" 28 | long="$(cat "$dir/etc/altlinux-release")" 29 | elif [ -e "$dir/etc/magic-release" ]; then 30 | short="Magic" 31 | long="$(cat "$dir/etc/magic-release")" 32 | elif [ -e "$dir/etc/blackPanther-release" ]; then 33 | short="blackPanther" 34 | long="$(cat "$dir/etc/blackPanther-release")" 35 | elif [ -e "$dir/etc/ark-release" ]; then 36 | short="Ark" 37 | long="$(cat "$dir/etc/ark-release")" 38 | elif [ -e "$dir/etc/arch-release" ]; then 39 | short="Arch" 40 | long="$(cat "$dir/etc/arch-release")" 41 | elif [ -e "$dir/etc/asplinux-release" ]; then 42 | short="ASPLinux" 43 | long="$(cat "$dir/etc/asplinux-release")" 44 | elif [ -e "$dir/etc/lvr-release" ]; then 45 | short="LvR" 46 | long="$(cat "$dir/etc/lvr-release")" 47 | elif [ -e "$dir/etc/caos-release" ]; then 48 | short="cAos" 49 | long="$(cat "$dir/etc/caos-release")" 50 | elif [ -e "$dir/etc/aurox-release" ]; then 51 | short="Aurox" 52 | long="$(cat "$dir/etc/aurox-release")" 53 | elif [ -e "$dir/etc/engarde-release" ]; then 54 | short="EnGarde" 55 | long="$(cat "$dir/etc/engarde-release")" 56 | elif [ -e "$dir/etc/vine-release" ]; then 57 | short="Vine" 58 | long="$(cat "$dir/etc/vine-release")" 59 | elif [ -e "$dir/etc/whitebox-release" ]; then 60 | short="WhiteBox" 61 | long="$(cat "$dir/etc/whitebox-release")" 62 | elif [ -e "$dir/etc/pld-release" ]; then 63 | short="PLD" 64 | long="$(cat "$dir/etc/pld-release")" 65 | elif [ -e "$dir/etc/startcom-release" ]; then 66 | short="StartCom" 67 | long="$(cat "$dir/etc/startcom-release")" 68 | elif [ -e "$dir/etc/trustix-release" ]; then 69 | short="Trustix" 70 | long="$(cat "$dir/etc/trustix-release")" 71 | elif [ -e "$dir/etc/openna-release" ]; then 72 | short="OpenNA" 73 | long="$(cat "$dir/etc/openna-release")" 74 | elif [ -e "$dir/etc/conectiva-release" ]; then 75 | short="Conectiva" 76 | long="$(cat "$dir/etc/conectiva-release")" 77 | elif [ -e "$dir/etc/mandrake-release" ]; then 78 | short="Mandrake" 79 | long="$(cat "$dir/etc/mandrake-release")" 80 | elif [ -e "$dir/etc/fedora-release" ]; then 81 | short="Fedora" 82 | long="$(cat "$dir/etc/fedora-release")" 83 | elif [ -e "$dir/etc/redhat-release" ]; then 84 | short="RedHat" 85 | long="$(cat "$dir/etc/redhat-release")" 86 | elif [ -e "$dir/etc/SuSE-release" ]; then 87 | short="SuSE" 88 | long="$(head -n 1 "$dir/etc/SuSE-release")" 89 | elif [ -e "$dir/etc/gentoo-release" ]; then 90 | short="Gentoo" 91 | long="$(cat "$dir/etc/gentoo-release")" 92 | elif [ -e "$dir/etc/cobalt-release" ]; then 93 | short="Cobalt" 94 | long="$(cat "$dir/etc/cobalt-release")" 95 | elif [ -e "$dir/etc/yellowdog-release" ]; then 96 | short="YellowDog" 97 | long="$(cat "$dir/etc/yellowdog-release")" 98 | elif [ -e "$dir/etc/turbolinux-release" ]; then 99 | short="Turbolinux" 100 | long="$(cat "$dir/etc/turbolinux-release")" 101 | elif [ -e "$dir/etc/pardus-release" ]; then 102 | short="Pardus" 103 | long="$(cat "$dir/etc/pardus-release")" 104 | elif [ -e "$dir/etc/kanotix-version" ]; then 105 | short="Kanotix" 106 | long="$(cat "$dir/etc/kanotix-version")" 107 | elif [ -e "$dir/etc/slackware-version" ]; then 108 | short="Slackware" 109 | long="$(printf "Slackware Linux (%s)\n" "$(cat "$dir/etc/slackware-version")")" 110 | elif [ -e "$dir/sbin/pkgtool" ]; then 111 | short="Slackware" 112 | long="Slackware Linux" 113 | elif grep -qs OpenLinux "$dir/etc/issue"; then 114 | short="Caldera" 115 | long="Caldera OpenLinux" 116 | elif [ -e "$dir/etc/frugalware-release" ]; then 117 | short="Frugalware Linux" 118 | long="$(cat "$dir/etc/frugalware-release")" 119 | elif [ -e "$dir/etc/kdemar-release" ]; then 120 | short="K-DEMar" 121 | long="$(printf "K-DEMar GNU/Linux (%s)\n" "$(cat "$dir/etc/kdemar-release")")" 122 | elif [ -e "$dir/etc/lfs-release" ]; then 123 | short="LFS" 124 | long="$(printf "Linux From Scratch (%s)\n" "$(cat "$dir/etc/lfs-release")")" 125 | elif [ -e "$dir/etc/meego-release" ]; then 126 | short="MeeGo" 127 | long="$(head -1 "$dir/etc/meego-release")" 128 | else 129 | short="Linux" 130 | long="unknown Linux distribution" 131 | fi 132 | 133 | label="$(count_next_label "$short")" 134 | result "$partition:$long:$label:linux" 135 | exit 0 136 | else 137 | exit 1 138 | fi 139 | -------------------------------------------------------------------------------- /src/os-prober: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | replace LIB_DIR 5 | 6 | . $LIB_DIR/common.sh 7 | 8 | newns "$@" 9 | require_tmpdir 10 | 11 | log_output () { 12 | if type log-output >/dev/null 2>&1; then 13 | log-output -t os-prober --pass-stdout $@ 14 | else 15 | $@ 16 | fi 17 | } 18 | 19 | on_sataraid () { 20 | type dmraid >/dev/null 2>&1 || return 1 21 | local parent="${1%/*}" 22 | local device="/dev/${parent##*/}" 23 | if dmraid -r -c | grep -q "$device"; then 24 | return 0 25 | fi 26 | return 1 27 | } 28 | 29 | partitions () { 30 | # Exclude partitions that have whole_disk sysfs attribute set. 31 | if [ -d /sys/block ]; then 32 | # Exclude partitions on physical disks that are part of a 33 | # Serial ATA RAID disk. 34 | for part in /sys/block/*/*[0-9]; do 35 | if [ -f "$part/start" ] && \ 36 | [ ! -f "$part/whole_disk" ] && ! on_sataraid $part; then 37 | name="$(echo "${part##*/}" | sed 's,[!.],/,g')" 38 | if [ -e "/dev/$name" ]; then 39 | echo "/dev/$name" 40 | fi 41 | fi 42 | done 43 | 44 | # Add Serial ATA RAID devices 45 | if type dmraid >/dev/null 2>&1 && \ 46 | dmraid -s -c >/dev/null 2>&1; then 47 | for raidset in $(dmraid -sa -c); do 48 | for part in /dev/mapper/"$raidset"*[0-9]; do 49 | echo "$part" 50 | done 51 | done 52 | fi 53 | elif [ "$(uname -s)" = Linux ]; then 54 | echo "Cannot find list of partitions! (Try mounting /sys.)" >&2 55 | exit 1 56 | else 57 | # We don't know how to probe OSes on non-Linux kernels. For 58 | # now, just don't get in the way. 59 | exit 0 60 | fi 61 | 62 | # Also detect OSes on LVM volumes (assumes LVM is active) 63 | if type lvs >/dev/null 2>&1; then 64 | echo "$(LVM_SUPPRESS_FD_WARNINGS=1 log_output lvs --noheadings --separator : -o vg_name,lv_name 2>&1 | 65 | sed "s|-|--|g;s|^[[:space:]]*\(.*\):\(.*\)$|/dev/mapper/\1-\2|" | 66 | grep -v "No volume groups found" 67 | )" 68 | fi 69 | } 70 | 71 | parse_proc_swaps () { 72 | while read line; do 73 | set -f 74 | set -- $line 75 | set +f 76 | echo "$(mapdevfs $1) swap" 77 | done 78 | } 79 | 80 | parse_proc_mdstat () { 81 | if type udevadm >/dev/null 2>&1; then 82 | udevinfo () { 83 | udevadm info "$@" 84 | } 85 | fi 86 | while read line; do 87 | for word in $line; do 88 | dev="${word%%\[*}" 89 | # TODO: factor this out to something in di-utils if 90 | # it's needed elsewhere 91 | if [ -d /sys/block ] && type udevinfo >/dev/null 2>&1; then 92 | if ! udevinfo -q path -n "/dev/$dev" 2>/dev/null | \ 93 | grep -q '/.*/.*/'; then 94 | continue 95 | fi 96 | elif ! echo "$dev" | grep -q "/part"; then 97 | continue 98 | fi 99 | raidpart="/dev/$dev" 100 | echo "$(mapdevfs "$raidpart")" 101 | done 102 | done 103 | } 104 | 105 | # Needed for idempotency 106 | rm -f $LIB_DIR/labels 107 | 108 | for prog in $LIB_DIR/probes/os/init/*; do 109 | if [ -x "$prog" ] && [ -f "$prog" ]; then 110 | echo "Running init probe $(basename $prog)..." 111 | "$prog" || true 112 | fi 113 | done 114 | 115 | # We need to properly canonicalize partitions with mount points and partitions 116 | # used in RAID 117 | grep "^/dev/" /proc/mounts | parse_proc_mounts >"$OS_PROBER_TMP/mounted-map" || true 118 | : >"$OS_PROBER_TMP/swaps-map" 119 | if [ -f /proc/swaps ]; then 120 | grep "^/dev/" /proc/swaps | parse_proc_swaps >"$OS_PROBER_TMP/swaps-map" || true 121 | fi 122 | : >"$OS_PROBER_TMP/raided-map" 123 | if [ -f /proc/mdstat ] ; then 124 | grep "^md" /proc/mdstat | parse_proc_mdstat >"$OS_PROBER_TMP/raided-map" || true 125 | fi 126 | 127 | for partition in $(partitions); do 128 | echo "==== Partition $partition ====" >&2 129 | if ! mapped="$(mapdevfs "$partition")"; then 130 | log "Device '$partition' does not exist; skipping" 131 | continue 132 | fi 133 | 134 | # Skip partitions used in software RAID arrays 135 | if grep -q "^$mapped" "$OS_PROBER_TMP/raided-map" ; then 136 | debug "$partition: part of software raid array" 137 | continue 138 | fi 139 | 140 | # Skip partitions used as active swap 141 | if grep -q "^$mapped " "$OS_PROBER_TMP/swaps-map" ; then 142 | debug "$partition: is active swap" 143 | continue 144 | fi 145 | 146 | # Not currently mounted 147 | if ! grep -q "^$mapped " "$OS_PROBER_TMP/mounted-map" ; then 148 | for test in $LIB_DIR/probes/os/*; do 149 | if [ -f "$test" ] && [ -x "$test" ]; then 150 | debug "running $test on $partition" 151 | if "$test" "$partition"; then 152 | echo "os detected by $test" 153 | break 154 | fi 155 | fi 156 | done 157 | else 158 | mpoint=$(grep "^$mapped " "$OS_PROBER_TMP/mounted-map" | head -n1 | cut -d " " -f 2) 159 | mpoint="$(unescape_mount "$mpoint")" 160 | if [ "$mpoint" != "/target/boot" ] && [ "$mpoint" != "/target" ] && [ "$mpoint" != "/" ]; then 161 | type=$(grep "^$mapped " "$OS_PROBER_TMP/mounted-map" | head -n1 | cut -d " " -f 3) 162 | for test in $LIB_DIR/probes/os/mounted/*; do 163 | echo "Running test $test on $partition" >&2 164 | if [ -f "$test" ] && [ -x "$test" ]; then 165 | debug "running $test on mounted $partition" 166 | if "$test" "$partition" "$mpoint" "$type"; then 167 | echo "os detected by $test" 168 | break 169 | fi 170 | fi 171 | done 172 | fi 173 | fi 174 | done 175 | -------------------------------------------------------------------------------- /src/common.sh: -------------------------------------------------------------------------------- 1 | replace LIB_DIR 2 | 3 | newns () { 4 | [ "$OS_PROBER_NEWNS" ] || exec $LIB_DIR/newns "$0" "$@" 5 | } 6 | 7 | cleanup_tmpdir=false 8 | cleanup_ro_partitions= 9 | cleanup () { 10 | local partition 11 | for partition in $cleanup_ro_partitions; do 12 | blockdev --setrw "$partition" 13 | done 14 | if $cleanup_tmpdir; then 15 | rm -rf "$OS_PROBER_TMP" 16 | fi 17 | } 18 | 19 | require_tmpdir() { 20 | if [ -z "$OS_PROBER_TMP" ]; then 21 | if type mktemp >/dev/null 2>&1; then 22 | export OS_PROBER_TMP="$(mktemp -d /tmp/os-prober.XXXXXX)" 23 | cleanup_tmpdir=: 24 | trap cleanup EXIT HUP INT QUIT TERM 25 | else 26 | export OS_PROBER_TMP=/tmp 27 | fi 28 | fi 29 | } 30 | 31 | count_for() { 32 | _labelprefix="$1" 33 | _result=$(grep "^${_labelprefix} " $LIB_DIR/os-prober/labels 2>/dev/null || true) 34 | 35 | if [ -z "$_result" ]; then 36 | return 37 | else 38 | echo "$_result" | cut -d' ' -f2 39 | fi 40 | } 41 | 42 | count_next_label() { 43 | require_tmpdir 44 | 45 | _labelprefix="$1" 46 | _cfor="$(count_for "${_labelprefix}")" 47 | 48 | if [ -z "$_cfor" ]; then 49 | echo "${_labelprefix} 1" >> $LIB_DIR/labels 50 | else 51 | sed "s/^${_labelprefix} ${_cfor}/${_labelprefix} $(($_cfor + 1))/" $LIB_DIR/labels > "$OS_PROBER_TMP/os-prober.tmp" 52 | mv "$OS_PROBER_TMP/os-prober.tmp" $LIB_DIR/labels 53 | fi 54 | 55 | echo "${_labelprefix}${_cfor}" 56 | } 57 | 58 | progname= 59 | cache_progname() { 60 | case $progname in 61 | '') 62 | progname="$(basename "$0")" 63 | ;; 64 | esac 65 | } 66 | 67 | log() { 68 | cache_progname 69 | logger -t "$progname" "$@" 70 | } 71 | 72 | error() { 73 | log "error: $@" 74 | } 75 | 76 | warn() { 77 | log "warning: $@" 78 | } 79 | 80 | debug() { 81 | log "debug: $@" 82 | } 83 | 84 | result () { 85 | log "result:" "$@" 86 | echo "$@" 87 | } 88 | 89 | # shim to make it easier to use os-prober outside d-i 90 | if ! type mapdevfs >/dev/null 2>&1; then 91 | mapdevfs () { 92 | readlink -f "$1" 93 | } 94 | fi 95 | 96 | item_in_dir () { 97 | if [ "$1" = "-q" ]; then 98 | q="-q" 99 | shift 1 100 | else 101 | q="" 102 | fi 103 | [ -d "$2" ] || return 1 104 | # find files with any case 105 | ls -1 "$2" | grep $q -i "^$1$" 106 | } 107 | 108 | # We can't always tell the filesystem type up front, but if we have the 109 | # information then we should use it. Note that we can't use block-attr here 110 | # as it's only available in udebs. 111 | fs_type () { 112 | if (export PATH="/lib/udev:$PATH"; type vol_id) >/dev/null 2>&1; then 113 | PATH="/lib/udev:$PATH" vol_id --type "$1" 2>/dev/null 114 | elif type blkid >/dev/null 2>&1; then 115 | blkid -o value -s TYPE "$1" 2>/dev/null 116 | else 117 | return 0 118 | fi 119 | } 120 | 121 | parse_proc_mounts () { 122 | while read -r line; do 123 | set -f 124 | set -- $line 125 | set +f 126 | printf '%s %s %s\n' "$(mapdevfs "$1")" "$2" "$3" 127 | done 128 | } 129 | 130 | parsefstab () { 131 | while read -r line; do 132 | case "$line" in 133 | "#"*) 134 | : 135 | ;; 136 | *) 137 | set -f 138 | set -- $line 139 | set +f 140 | printf '%s %s %s\n' "$1" "$2" "$3" 141 | ;; 142 | esac 143 | done 144 | } 145 | 146 | unescape_mount () { 147 | printf %s "$1" | \ 148 | sed 's/\\011/ /g; s/\\012/\n/g; s/\\040/ /g; s/\\134/\\/g' 149 | } 150 | 151 | ro_partition () { 152 | if type blockdev >/dev/null 2>&1 && \ 153 | [ "$(blockdev --getro "$1")" = 0 ] && \ 154 | blockdev --setro "$1"; then 155 | cleanup_ro_partitions="${cleanup_ro_partitions:+$cleanup_ro_partitions }$1" 156 | trap cleanup EXIT HUP INT QUIT TERM 157 | fi 158 | } 159 | 160 | find_label () { 161 | local output 162 | if type blkid >/dev/null 2>&1; then 163 | # Hopefully everyone has blkid by now 164 | output="$(blkid -o device -t LABEL="$1")" || return 1 165 | echo "$output" | head -n1 166 | elif [ -h "/dev/disk/by-label/$1" ]; then 167 | # Last-ditch fallback 168 | readlink -f "/dev/disk/by-label/$1" 169 | else 170 | return 1 171 | fi 172 | } 173 | 174 | find_uuid () { 175 | local output 176 | if type blkid >/dev/null 2>&1; then 177 | # Hopefully everyone has blkid by now 178 | output="$(blkid -o device -t UUID="$1")" || return 1 179 | echo "$output" | head -n1 180 | elif [ -h "/dev/disk/by-uuid/$1" ]; then 181 | # Last-ditch fallback 182 | readlink -f "/dev/disk/by-uuid/$1" 183 | else 184 | return 1 185 | fi 186 | } 187 | 188 | # Sets $mountboot as output variable. (We do this rather than requiring a 189 | # subshell so that we can run ro_partition without the cleanup trap firing 190 | # when the subshell exits.) 191 | linux_mount_boot () { 192 | partition="$1" 193 | tmpmnt="$2" 194 | 195 | bootpart="" 196 | mounted="" 197 | if [ -e "$tmpmnt/etc/fstab" ]; then 198 | # Try to mount any /boot partition. 199 | bootmnt=$(parsefstab < "$tmpmnt/etc/fstab" | grep " /boot ") || true 200 | if [ -n "$bootmnt" ]; then 201 | set -f 202 | set -- $bootmnt 203 | set +f 204 | boottomnt="" 205 | 206 | # Try to map labels and UUIDs ourselves if possible, 207 | # so that we can check whether they're already 208 | # mounted somewhere else. 209 | tmppart="$1" 210 | if echo "$1" | grep -q "LABEL="; then 211 | label="$(echo "$1" | cut -d = -f 2)" 212 | if tmppart="$(find_label "$label")"; then 213 | debug "mapped LABEL=$label to $tmppart" 214 | else 215 | debug "found boot partition LABEL=$label for Linux system on $partition, but cannot map to existing device" 216 | mountboot="$partition 0" 217 | return 218 | fi 219 | elif echo "$1" | grep -q "UUID="; then 220 | uuid="$(echo "$1" | cut -d = -f 2)" 221 | if tmppart="$(find_uuid "$uuid")"; then 222 | debug "mapped UUID=$uuid to $tmppart" 223 | else 224 | debug "found boot partition UUID=$uuid for Linux system on $partition, but cannot map to existing device" 225 | mountboot="$partition 0" 226 | return 227 | fi 228 | fi 229 | shift 230 | set -- "$(mapdevfs "$tmppart")" "$@" 231 | 232 | if grep -q "^$1 " "$OS_PROBER_TMP/mounted-map"; then 233 | bindfrom="$(grep "^$1 " "$OS_PROBER_TMP/mounted-map" | head -n1 | cut -d " " -f 2)" 234 | bindfrom="$(unescape_mount "$bindfrom")" 235 | if [ "$bindfrom" != "$tmpmnt/boot" ]; then 236 | if mount --bind "$bindfrom" "$tmpmnt/boot"; then 237 | mounted=1 238 | bootpart="$1" 239 | else 240 | debug "failed to bind-mount $bindfrom onto $tmpmnt/boot" 241 | fi 242 | fi 243 | fi 244 | if [ "$mounted" ]; then 245 | : 246 | elif [ -e "$1" ]; then 247 | bootpart="$1" 248 | boottomnt="$1" 249 | elif [ -e "$tmpmnt/$1" ]; then 250 | bootpart="$1" 251 | boottomnt="$tmpmnt/$1" 252 | elif [ -e "/target/$1" ]; then 253 | bootpart="$1" 254 | boottomnt="/target/$1" 255 | else 256 | bootpart="" 257 | fi 258 | 259 | if [ ! "$mounted" ]; then 260 | if [ -z "$bootpart" ]; then 261 | debug "found boot partition $1 for linux system on $partition, but cannot map to existing device" 262 | else 263 | debug "found boot partition $bootpart for linux system on $partition" 264 | if type grub-mount >/dev/null 2>&1 && \ 265 | grub-mount "$boottomnt" "$tmpmnt/boot" 2>/dev/null; then 266 | mounted=1 267 | else 268 | ro_partition "$boottomnt" 269 | if mount -o ro "$boottomnt" "$tmpmnt/boot" -t "$3"; then 270 | mounted=1 271 | else 272 | error "failed to mount $boottomnt on $tmpmnt/boot" 273 | fi 274 | fi 275 | fi 276 | fi 277 | fi 278 | fi 279 | if [ -z "$bootpart" ]; then 280 | bootpart="$partition" 281 | fi 282 | if [ -z "$mounted" ]; then 283 | mounted=0 284 | fi 285 | 286 | mountboot="$bootpart $mounted" 287 | } 288 | -------------------------------------------------------------------------------- /debian/changelog: -------------------------------------------------------------------------------- 1 | os-prober (1.64) unstable; urgency=medium 2 | 3 | [ Frederic Bonnard ] 4 | * Add ppc64el support. Closes: #752416. 5 | 6 | -- Aurelien Jarno Sun, 17 Aug 2014 23:36:52 +0200 7 | 8 | os-prober (1.63) unstable; urgency=low 9 | 10 | [ Cyril Brulebois ] 11 | * Drop reiserfs, it's no longer supported. 12 | 13 | -- Christian Perrier Tue, 23 Jul 2013 09:38:17 +0200 14 | 15 | os-prober (1.62) unstable; urgency=low 16 | 17 | [ Dmitrijs Ledkovs ] 18 | * Set debian source format to '3.0 (native)'. 19 | * Bump debhelper compat level to 9. 20 | * Set Vcs-* to canonical format. 21 | 22 | [ Christian Perrier ] 23 | * Update Standards to 3.9.4 (checked) 24 | 25 | -- Christian Perrier Sun, 14 Jul 2013 12:43:27 +0200 26 | 27 | os-prober (1.61) unstable; urgency=low 28 | 29 | * Add an extra backslash to the code in parse_proc_mdstat to remove [...], 30 | so that it works properly in dash (thanks, John Ryan; LP: #905607). 31 | 32 | -- Colin Watson Tue, 21 May 2013 22:57:42 +0100 33 | 34 | os-prober (1.60) unstable; urgency=low 35 | 36 | * os-probes/mounted/x86/05efi: Handle the case where we used grub-mount to 37 | mount the EFI System Partition. 38 | 39 | -- Colin Watson Fri, 17 May 2013 13:02:41 +0100 40 | 41 | os-prober (1.59) unstable; urgency=low 42 | 43 | [ Colin Watson ] 44 | * Fix cross-building and use dpkg-buildflags. 45 | 46 | -- Christian Perrier Wed, 15 May 2013 17:36:49 +0200 47 | 48 | os-prober (1.58) unstable; urgency=low 49 | 50 | [ Steve McIntyre ] 51 | * add UEFI support, patch from Andrey Borzenkov: 52 | + skip legacy MS loader detection on UEFI platform 53 | + add framework for searching EFI System Partition 54 | + add scripts that detect Microsoft bootloader and ELILO. 55 | * Add myself to uploaders. 56 | 57 | -- Steve McIntyre <93sam@debian.org> Sun, 28 Apr 2013 16:01:50 +0100 58 | 59 | os-prober (1.57) unstable; urgency=low 60 | 61 | [ Christian Perrier ] 62 | * Deal with grub-probe exiting with non zero status on some 63 | devices, which in turns can stuck update-grub 64 | Closes: #680084 65 | 66 | [ Joey Hess ] 67 | * Fix detection of Fedora and other distros that moved /lib into /usr 68 | and left behind a symlink. Grub's filesystem code does not support 69 | symlinks. Closes: #685159 Thanks Andreas Bombe for the patch. 70 | 71 | -- Christian Perrier Sat, 22 Dec 2012 12:54:54 +0100 72 | 73 | os-prober (1.56) unstable; urgency=low 74 | 75 | [ Hedayat Vatankhah ] 76 | * Add support for probing Fedora's location for the GRUB 2 configuration 77 | file (closes: #674560). 78 | 79 | [ Colin Watson ] 80 | * Fix the parsing code in the grub2 handler so that it no longer gets 81 | hopelessly confused by multiple single-quoted strings on the same line, 82 | as produced by GRUB 2.00. 83 | 84 | -- Colin Watson Mon, 17 Sep 2012 19:02:29 +0100 85 | 86 | os-prober (1.55) unstable; urgency=low 87 | 88 | * Improve detection of Haiku: detect the 64-bit version 89 | Closes: #685228 90 | * Add myself to Uploaders 91 | 92 | -- Christian Perrier Sat, 25 Aug 2012 09:58:51 +0200 93 | 94 | os-prober (1.54) unstable; urgency=low 95 | 96 | * Team upload 97 | 98 | [ Joey Hess ] 99 | * Avoid noise when /proc/swaps does not exist. Closes: #673566 100 | 101 | -- Christian Perrier Sat, 07 Jul 2012 20:42:47 +0200 102 | 103 | os-prober (1.53) unstable; urgency=low 104 | 105 | * Team upload 106 | * Use Package-Type instead of deprecated XC-Package-Type 107 | for os-prober-udeb 108 | * Add ${misc:Depends} to udeb dependencies 109 | * Link to explicit GPL-2 document in debian/copyright 110 | * sed off (hdn,n) from the front of an initrd path, 111 | as seen in Mandriva/Mageia grub configs. 112 | Thanks to François Jaouen and Barry Jackson for the patch 113 | Closes: #566102 114 | 115 | -- Christian Perrier Mon, 07 May 2012 22:37:20 +0200 116 | 117 | os-prober (1.52) unstable; urgency=low 118 | 119 | [ Stéphane Graber ] 120 | * Add support for Windows 8. 121 | 122 | [ Colin Watson ] 123 | * Install README and TODO in the .deb. 124 | 125 | [ Joey Hess ] 126 | * Revert broken patch adding support for BSD distributions. Closes: #668860 127 | 128 | -- Joey Hess Fri, 20 Apr 2012 10:50:38 -0400 129 | 130 | os-prober (1.51) unstable; urgency=low 131 | 132 | [ Joey Hess ] 133 | * Relax the MS-DOS detection again now that it will not cause 134 | false positives for non-FAT filesystems. 135 | 136 | [ Colin Watson ] 137 | * Use 'type' rather than 'which' to test for grub-mount, as d-i doesn't 138 | have 'which'. Also test for grub-probe before using it, as that isn't 139 | currently in grub-mount-udeb and I'm going to need to add it 140 | (LP: #963471). 141 | 142 | -- Colin Watson Tue, 27 Mar 2012 15:47:04 +0100 143 | 144 | os-prober (1.50) unstable; urgency=low 145 | 146 | [ Joey Hess ] 147 | * Clarify license version is GPL-2+, for all code written by Joey 148 | Hess, Colin Watson, Christian Perrier, Otavio Salvador and 149 | Joshua Kwan. The license had just been "GNU GPL"; other contributors 150 | to os-prober are encouraged to clarify which GPL versions apply to 151 | their code. 152 | 153 | [ Otavio Salvador ] 154 | * Add support to detect BSD systems. Thanks to Gavrilin Andrey 155 | for the patch (refs: #659208). 156 | 157 | [ Joey Hess ] 158 | * Avoid false positives in MS-DOS detection by also looking for 159 | autoexec.bat. Closes: #663540 160 | 161 | [ Colin Watson ] 162 | * When using grub-mount, pass the GRUB filesystem type to individual tests 163 | rather than "fuseblk". Adjust a number of tests to handle GRUB 164 | filesystem names as well as OS names (closes: #663540, #663600). 165 | 166 | -- Colin Watson Thu, 15 Mar 2012 13:52:30 +0000 167 | 168 | os-prober (1.49) unstable; urgency=low 169 | 170 | [ Robert Millan ] 171 | * Depend on grub-mount-udeb only on architectures with FUSE support. 172 | 173 | [ Colin Watson ] 174 | * Restrict grub-mount-udeb dependency to architectures where 175 | grub-mount-udeb exists (closes: #639599). 176 | 177 | -- Colin Watson Mon, 29 Aug 2011 12:34:21 +0100 178 | 179 | os-prober (1.48) unstable; urgency=low 180 | 181 | [ Colin Watson ] 182 | * Depend on grub-mount-udeb (see changelog for 1.45). 183 | * item_in_dir: return 1 immediately if second argument is not a directory 184 | (thanks, Daniel Richard G.; LP: #798447). 185 | 186 | [ Otavio Salvador ] 187 | * add MeeGo detection support; thanks to Chengwei Yang 188 | for the patch. 189 | * Fix Windows detection when there are more then one boot directories 190 | (e.g boot and Boot). Closes: #634649. 191 | 192 | -- Otavio Salvador Sat, 23 Jul 2011 17:46:13 +0200 193 | 194 | os-prober (1.47) unstable; urgency=low 195 | 196 | [ Joey Hess ] 197 | * Fix unwanted wildcard expansions. Closes: #624815 198 | 199 | -- Otavio Salvador Sun, 15 May 2011 17:49:10 -0300 200 | 201 | os-prober (1.46) unstable; urgency=low 202 | 203 | * Correct syntax error in LFS detection. Closes: #623981 204 | 205 | -- Christian Perrier Mon, 25 Apr 2011 07:09:02 +0200 206 | 207 | os-prober (1.45) unstable; urgency=low 208 | 209 | [ Matti Kurkela ] 210 | * Improve MS-DOS detection by using an absolute path when verifying 211 | that "dos" is a directory. 212 | 213 | [ Colin Watson ] 214 | * Fix fatal typo in QNX prober. 215 | * Use grub-mount if it exists. This lets us do true read-only mounts, and 216 | works better on journalling filesystems that were mounted uncleanly 217 | (LP: #683355). 218 | * Attempt to load the fuse module, to improve the chances of grub-mount 219 | working. 220 | 221 | [ Armin Krejzi ] 222 | * Add detection of Linux From Scratch distribution. Closes: #623939 223 | 224 | -- Christian Perrier Sun, 24 Apr 2011 20:02:10 +0200 225 | 226 | os-prober (1.44) unstable; urgency=low 227 | 228 | * Team upload 229 | * Fix syntax errors in 83haiku and make it executable 230 | 231 | -- Christian Perrier Fri, 18 Feb 2011 20:17:55 +0100 232 | 233 | os-prober (1.43) unstable; urgency=low 234 | 235 | * Team upload 236 | 237 | [ Christian Perrier ] 238 | * Fix Gentoo detection (different name for kernel and initrd 239 | files). Thanks to caillean for the patch 240 | Closes: #611670 241 | * Detect Haiku on BeFS partitions. 242 | Thanks to Jeroen Oortwijn for the proposed patch 243 | Closes: #590897 244 | 245 | [ Joey Hess ] 246 | * 90fallback: Avoid ever accidentially identifying the same file 247 | as initrd and kernel. Closes: #612303 248 | 249 | -- Christian Perrier Fri, 18 Feb 2011 06:02:22 +0100 250 | 251 | os-prober (1.42) unstable; urgency=low 252 | 253 | [ Milan Kupcevic ] 254 | * Let yaboot linux-boot-prober work on all chrp machines. 255 | * Handle YDL initrd image in linux-boot-prober fallback test. 256 | 257 | -- Otavio Salvador Fri, 24 Dec 2010 19:13:19 -0200 258 | 259 | os-prober (1.41) unstable; urgency=low 260 | 261 | [ Joey Hess ] 262 | * Fix probes for MacOS 9 on m68k and powerpc. Closes: #604192 263 | (Thanks, Milan Kupcevic) 264 | 265 | -- Otavio Salvador Wed, 24 Nov 2010 09:58:18 -0200 266 | 267 | os-prober (1.40) unstable; urgency=low 268 | 269 | [ Christian Perrier ] 270 | * Fix Windows Vista and Windows Recovery Environment partitions 271 | recognition. (Thanks, Bouke Bunnik) 272 | Closes: #589676, LP: #476625 273 | * Allow recognition of recent MINIX installations. 274 | Thanks to Feiran Zheng 275 | Closes: #592924 276 | 277 | [ Colin Watson ] 278 | * Improve error message when /sys/block is missing. 279 | * os-prober doesn't know how to probe other OSes on non-Linux kernels. 280 | For now, just exit quietly rather than confusing people (closes: 281 | #567953). 282 | * Ignore active swap partitions (thanks, Alex Owen; see #417407). 283 | * Refactor linux_mount_boot to look up labels and UUIDs using blkid or 284 | /dev/disk/by-*/ rather than relying on mount being smart enough. This 285 | removes some horrible code that executes mount from /target. 286 | * Set partitions read-only before mounting them (based on a patch by Alex 287 | Owen; closes: #417407, #556739, #599203). 288 | 289 | -- Colin Watson Wed, 10 Nov 2010 11:51:19 +0000 290 | 291 | os-prober (1.39) unstable; urgency=low 292 | 293 | [ Joey Hess ] 294 | * Fix FreeDOS test to use case-insensative filename lookup 295 | as was already done for all other DOS/Windows tests. Closes: #582257 296 | (Thanks, Harald Dunkel) 297 | 298 | [ Colin Watson ] 299 | * Handle Dracut-generated initramfs names in linux-boot-prober fallback 300 | test (thanks, Piscium; LP: #420900). 301 | 302 | -- Colin Watson Mon, 28 Jun 2010 18:01:00 +0100 303 | 304 | os-prober (1.38) unstable; urgency=low 305 | 306 | * Handle single-quoted items in grub.cfg; this has been part of the syntax 307 | for a while, but recently started being used upstream to avoid another 308 | bug. 309 | 310 | -- Colin Watson Fri, 16 Apr 2010 12:17:28 +0100 311 | 312 | os-prober (1.37) unstable; urgency=low 313 | 314 | [ Frans Pop ] 315 | * 90linux-distro: also allow for lib32 and lib64 directories when looking 316 | for ld*.so*. With thanks to Maximilian Gerhard. Closes: #574407. 317 | 318 | [ Colin Watson ] 319 | * Detect Windows Server 2008 and Windows Server 2008 R2, thanks to 320 | Thorsten. LP: #544117 321 | * Detect Arch Linux initrds: http://wiki.archlinux.org/index.php/GRUB2 and 322 | http://repos.archlinux.org/wsvn/packages/grub2/trunk/grubconfig.archlinux.patch 323 | indicate that /boot/vmlinuz26 is associated with /boot/kernel26.img. 324 | LP: #518826 325 | 326 | -- Colin Watson Tue, 13 Apr 2010 14:15:35 +0100 327 | 328 | os-prober (1.36) unstable; urgency=low 329 | 330 | [ Colin Watson ] 331 | * Suppress tedious fd leak warnings from LVM tools. 332 | 333 | [ Frans Pop ] 334 | * Drop support for the discontinued lpia architecture. 335 | 336 | [ Christian Perrier ] 337 | * Properly quote variable in os-probes/mounted/x86. Thanks 338 | to Fabian Greffrath for the patch. Closes: #563825 339 | 340 | [ Otavio Salvador ] 341 | * Applied patch from Brad Jorsch to 342 | properly detect Windows' recovery partitions. Closes: #547382 343 | 344 | [ Joey Hess ] 345 | * Load btrfs module if available. 346 | * Fix arbitrary code execution via eval. Closes: #569229 347 | * Tighten up quoting of shell variables overall. 348 | * Avoid ever running mount command from filesystems being probed. 349 | Closes: #569222 350 | * Avoid leaving a temporary mountpoint behind when exiting 351 | in some exceptional conditions. Closes: #569235 352 | 353 | -- Otavio Salvador Tue, 23 Feb 2010 15:50:17 -0300 354 | 355 | os-prober (1.35) unstable; urgency=medium 356 | 357 | * Set LC_ALL=C when grepping out accented characters from Windows 358 | descriptions (LP: #438095). 359 | 360 | -- Colin Watson Mon, 05 Oct 2009 23:12:11 +0100 361 | 362 | os-prober (1.34) unstable; urgency=low 363 | 364 | * Only look for a smart version of mount if we're using busybox mount. In 365 | a normal system, mount probably already handles labels and UUIDs, and 366 | using mount from another filesystem is risky enough that it's worth 367 | avoiding if possible. 368 | * Memoise calls to 'basename $0' in log function. 369 | * Handle escaped special characters in /etc/fstab and /proc/mounts 370 | (LP: #433910). 371 | * dash defines test's -nt operator differently from bash, as it's entitled 372 | to do since this is an extension not defined in POSIX. If file1 exists 373 | and file2 does not, bash returns true but dash returns false. Don't rely 374 | on bash's behaviour when checking whether to use GRUB Legacy or GRUB 2 375 | configuration files, otherwise we end up using neither when only one set 376 | of configuration exists and /bin/sh is dash. 377 | * Try to map LABEL= and UUID= ourselves in linux_mount_boot rather than 378 | relying on mount to do it, to further reduce the chance that we need to 379 | use mount from another filesystem. 380 | * If the filesystem identified by linux-boot-prober as /boot is already 381 | mounted somewhere else, then bind-mount it rather than trying to mount 382 | it again. 383 | 384 | -- Colin Watson Mon, 21 Sep 2009 14:55:23 +0100 385 | 386 | os-prober (1.33) unstable; urgency=low 387 | 388 | * Distinguish Windows 7, based on a patch from "mattduckman" 389 | (LP: #393565). 390 | * Don't try to mount LUKS partitions (thanks, Chow Loong Jin and Soren 391 | Hansen; closes: #546546, LP: #428785). 392 | 393 | -- Colin Watson Tue, 15 Sep 2009 14:02:45 +0100 394 | 395 | os-prober (1.32) unstable; urgency=low 396 | 397 | * Pass arguments properly to newns (thanks, Roger E Critchlow Jr; LP: 398 | #426061). 399 | 400 | -- Colin Watson Tue, 08 Sep 2009 12:29:05 +0100 401 | 402 | os-prober (1.31) unstable; urgency=low 403 | 404 | * Upgrade to debhelper v7. 405 | * Detect Acronis Secure Zone (thanks, Alexey Fisher; LP: #354334). 406 | * Run os-prober and linux-boot-prober in a private mount namespace if 407 | possible, to avoid desktop environments picking up the mounts. Thanks to 408 | Gabor Gombas for the suggestion. (Closes: #476184) 409 | * Use vol_id/blkid output if possible to avoid having to try every 410 | possible filesystem for every partition. This isn't actually very much 411 | faster for me, but it certainly cuts down on syslog noise. 412 | * Skip extended and swap partitions (closes: #511518). 413 | * Install Mac OS X probe on i386/amd64 too (LP: #353639). 414 | 415 | -- Colin Watson Mon, 07 Sep 2009 11:06:55 +0100 416 | 417 | os-prober (1.30) unstable; urgency=low 418 | 419 | [ Colin Watson ] 420 | * Use result function in macosx prober, so that its output appears in 421 | syslog. 422 | * Quote arguments to tests, and in general quote mountpoints that were 423 | fetched from mounted-maps. I've seen the odd log with errors due to 424 | funny characters in mount points. 425 | 426 | [ Otavio Salvador ] 427 | * When there're both grub-legacy and grub2 configuration files available 428 | we ought to use the most recently changed. Closes: 534478 429 | 430 | -- Otavio Salvador Tue, 21 Jul 2009 12:22:09 -0300 431 | 432 | os-prober (1.29) unstable; urgency=low 433 | 434 | [ Colin Watson ] 435 | * Merge from Ubuntu: 436 | - Load ext4 module if available. 437 | - Check dmraid's exit code rather than parsing its output. 438 | * Windows Vista has been released for some time now, so just call it that 439 | rather than "Vista/Longhorn". 440 | 441 | [ Frans Pop ] 442 | * Remove myself as uploader. 443 | 444 | -- Colin Watson Wed, 11 Mar 2009 16:45:32 +0000 445 | 446 | os-prober (1.28) unstable; urgency=low 447 | 448 | [ Giuseppe Iuculano ] 449 | * Probe all partitions that are a part of active dmraid arrays. 450 | Patch based on work done by Luke Yelavich in Ubuntu. 451 | 452 | -- Otavio Salvador Sun, 21 Sep 2008 22:02:30 -0300 453 | 454 | os-prober (1.27) unstable; urgency=low 455 | 456 | [ Joey Hess ] 457 | * Add support for detecting K-DEMar based on an example from Adonay Sanz. 458 | Closes: #485617 459 | 460 | -- Otavio Salvador Tue, 29 Jul 2008 12:33:43 -0300 461 | 462 | os-prober (1.26) unstable; urgency=HIGH 463 | 464 | * Remove hardcoded line in grub2 that must have slipped in during testing. 465 | Closes: #476389 466 | 467 | -- Joey Hess Tue, 03 Jun 2008 13:35:39 -0400 468 | 469 | os-prober (1.25) unstable; urgency=low 470 | 471 | [ Frans Pop ] 472 | * Disable excessive debug messages when parsing grub configs (see #471501). 473 | 474 | [ Joey Hess ] 475 | * Warn if umount fails for some reason (such as a desktop environment 476 | keeping the mount point busy). 477 | * Avoid exiting test scripts when a umount fails, as that can result in 478 | incomplete OS detection, and does not result in os-prober as a whole 479 | failing. 480 | 481 | -- Otavio Salvador Thu, 08 May 2008 13:31:46 -0300 482 | 483 | os-prober (1.24) unstable; urgency=low 484 | 485 | [ Colin Watson ] 486 | * udev 117 merged all udev tools into a single binary called udevadm. 487 | Check for this and use it instead of udevinfo if available. 488 | 489 | [ Joey Hess ] 490 | * Avoid using log-output when run outside of d-i. 491 | * Add preliminary support for grub2's grub.cfg file. Closes: #464928 492 | 493 | -- Otavio Salvador Fri, 15 Feb 2008 15:23:52 -0200 494 | 495 | os-prober (1.23) unstable; urgency=low 496 | 497 | * If fuseblk is in /proc/filesystems and ntfs-3g is present, try mounting 498 | filesystems as ntfs-3g. 499 | * Try finding a LABEL/UUID-capable /bin/mount in $tmpmnt as well as in 500 | /target. 501 | * Set LD_LIBRARY_PATH appropriately in the event that we have to use a 502 | foreign mount binary (LP: #145424). 503 | * Adjust Microsoft probe to cope with NTFS partitions appearing with type 504 | ntfs-3g. 505 | 506 | -- Colin Watson Mon, 26 Nov 2007 15:20:17 +0000 507 | 508 | os-prober (1.22) unstable; urgency=low 509 | 510 | [ Joey Hess ] 511 | * Call dh_md5sums. 512 | 513 | [ Jérémy Bobbio ] 514 | * Remove references to devfs-style device names in documentation and 515 | comments. 516 | 517 | [ Colin Watson ] 518 | * Accept fuseblk as well as fuse in the Microsoft probe. 519 | * Make sure to select only the first mountpoint for a given device (in 520 | case of bind mounts). 521 | * Treat the lpia architecture (used in the Ubuntu mobile project) as x86, 522 | since it is. 523 | 524 | -- Jérémy Bobbio Thu, 27 Sep 2007 18:43:50 +0200 525 | 526 | os-prober (1.21) unstable; urgency=low 527 | 528 | [ Joey Hess ] 529 | * Remove the largely obsolete --mounted option. 530 | 531 | [ Colin Watson ] 532 | * Recognise filesystems of type 'fuse' as applicable to the Microsoft 533 | probe (thanks, Agostino Russo). 534 | * Handle vga= options in lilo.conf (LP: #59525). 535 | 536 | -- Colin Watson Tue, 31 Jul 2007 17:03:10 +0100 537 | 538 | os-prober (1.20) unstable; urgency=low 539 | 540 | * Skip grub-installer's "(on /dev/blah)" entries detected in GRUB 541 | configuration files, as if they're useful they will probably be found by 542 | another probe, and detecting them can result in exponential growth of 543 | menu.lst files if you do repeated test installs on multiple partitions. 544 | * Use readlink -f in mapdevfs shim so that os-prober runs outside d-i 545 | handle mount-by-UUID correctly. 546 | * Use mktemp -d rather than /tmp, to make use outside d-i safer. 547 | * Merge from Ubuntu: 548 | - Try to install fs-core-modules and fs-secondary-modules udebs. These 549 | are specific to the Ubuntu kernel udeb layout, but it's fairly cheap 550 | to check for them as well and saves on divergence here. 551 | - Add os-probes/mounted/sparc/80solaris to recognize Solaris/SPARC 552 | (Fabio M. Di Nitto). 553 | - Add linux-boot-probes/mounted/sparc/50silo support (Fabio M. Di 554 | Nitto). 555 | - Try to load ufs module, for Solaris support (Fabio M. Di Nitto). 556 | - Tighten check for whether we're running in d-i; anna-install isn't 557 | quite enough because if you're running d-i code outside d-i it's 558 | sometimes reasonable to install a shim for anna-install. 559 | * Don't probe partitions mounted on /target/boot. 560 | * Teach linux-boot-prober to deal with mounted partitions correctly, 561 | unless they're mounted on /, /target, or /target/boot (LP: #14780). This 562 | should largely obsolete the --mounted option. 563 | * Only use /target/bin/mount if it exists, in order to work better outside 564 | d-i. 565 | 566 | -- Colin Watson Thu, 26 Jul 2007 12:33:31 +0100 567 | 568 | os-prober (1.19) unstable; urgency=low 569 | 570 | [ Joey Hess ] 571 | * Make the microsoft OS test completely case-insensative in the file and 572 | directory named it looks for. This is reportedly needed at least for 573 | Vista (Boot/BCD vs boot/bcd), and was already done on an ad-hoc basis 574 | for 2000/XP/NT4.0. 575 | * Patch from VMiklos to add support for recognising Frugalware. 576 | 577 | [ Frans Pop ] 578 | * Skip partitions on a physical disk that is part of a Serial ATA RAID disk. 579 | * Use log-output when checking for volume groups. 580 | * Also use the case insensitive test for Dell Utility partition detection. 581 | 582 | [ Fabio M. Di Nitto ] 583 | * Skip partitions that have the "whole_disk" sysfs attribute set. 584 | The kernel set the attribute for partitions like SUN Whole Disk. 585 | These partitions that encompass the whole disk can be mounted 586 | and often confused for the first partition on the disk. 587 | In situations where the OS is on the first partition, it would be 588 | detected twice in the first and the whole disk partition. 589 | 590 | -- Frans Pop Sat, 07 Jul 2007 20:11:49 +0200 591 | 592 | os-prober (1.18) unstable; urgency=low 593 | 594 | * Add detection for Dell Utility partition (can be chainloaded). 595 | Closes: #417279. 596 | * Remove support for devfs style paths. 597 | 598 | -- Frans Pop Sat, 21 Apr 2007 01:11:08 +0200 599 | 600 | os-prober (1.17) unstable; urgency=low 601 | 602 | * Check for both upper and lowercase filenames when detecting Windows 603 | NT/XP/2000. Thanks to Thanatermesis. 604 | 605 | -- Frans Pop Tue, 27 Feb 2007 20:16:49 +0100 606 | 607 | os-prober (1.16) unstable; urgency=low 608 | 609 | [ Joey Hess ] 610 | * Support for recognising Pardus linux. 611 | 612 | [ Frans Pop ] 613 | * Skip grub entries that have "module" lines as we currently don't support 614 | those. Based on #399882 where they were used for entries related to Xen. 615 | * Support for recognizing Kanotix linux. 616 | * Add support for probing other operating systems on LVM partitions. This 617 | will only work if LVM support has already been loaded. Closes: #277901. 618 | 619 | -- Frans Pop Tue, 20 Feb 2007 12:57:42 +0100 620 | 621 | os-prober (1.15) unstable; urgency=low 622 | 623 | [ Colin Watson ] 624 | * Discard stderr from udevinfo call in parse_proc_mdstat. 625 | 626 | [ Fabio M. Di Nitto ] 627 | * Nuke os-probes/x86. Empty useless dir. 628 | * Use -qs to grep and avoid an annoying warning when running os-probes. 629 | 630 | -- Frans Pop Thu, 21 Dec 2006 16:29:06 +0100 631 | 632 | os-prober (1.14) unstable; urgency=low 633 | 634 | * Use udevinfo if available in parse_proc_mdstat to figure out whether a 635 | device is a partition. 636 | 637 | -- Colin Watson Tue, 29 Aug 2006 11:27:47 +0100 638 | 639 | os-prober (1.13) unstable; urgency=low 640 | 641 | * Add support for detecting Windows Vista/Longhorn. 642 | 643 | -- Frans Pop Tue, 25 Jul 2006 13:06:13 +0200 644 | 645 | os-prober (1.12) unstable; urgency=low 646 | 647 | [ Joey Hess ] 648 | * Patch from VMiklos to sed off (hdn,n) from the front of a kernel path, 649 | as seen in SuSE grub configs. Closes: #258623 although this is fixed 650 | imprefectly since it assumes stripping the string is enough. 651 | * Patch from VMiklos to not require an initrd be specified in the grub 652 | probe. 653 | * Patch from VMiklos to add --mounted option to linux-boot-prober. 654 | May not be useful for d-i but in other situations including for the 655 | Frugalware installer. 656 | 657 | [ Frans Pop ] 658 | * When parsing a lilo configuration, dereference symbolic links. Not doing 659 | this will break booting the old OS if the link was in / and there was a 660 | separate /boot partition. And grub in general prefers full paths. 661 | Closes: #259825. 662 | * Use environment variable to pass --mounted option to lower level scripts 663 | instead of perpetuating the parameter. 664 | * Add myself to uploaders. 665 | 666 | -- Frans Pop Fri, 23 Jun 2006 21:46:41 +0200 667 | 668 | os-prober (1.11) unstable; urgency=low 669 | 670 | * Remove a useless debug message. 671 | 672 | -- Joey Hess Wed, 7 Jun 2006 22:10:10 -0400 673 | 674 | os-prober (1.10) unstable; urgency=low 675 | 676 | [ Colin Watson ] 677 | * Drop os-prober's priority to extra to match overrides. 678 | 679 | [ Frans Pop ] 680 | * Old-style options for head/tail are no longer supported by new busybox. 681 | 682 | -- Frans Pop Fri, 12 May 2006 15:26:30 +0200 683 | 684 | os-prober (1.09) unstable; urgency=low 685 | 686 | * To make it easier to use os-prober outside d-i, add a mapdevfs shim and 687 | avoid using anna-install if it isn't present. 688 | * Fix count_for to avoid failing outside d-i if /var/lib/os-prober/labels 689 | is missing. 690 | * Look for partitions in /sys/block if /dev/discs isn't present. 691 | * Add /usr/share/common-licenses/GPL reference to debian/copyright. 692 | * Rename os-prober to os-prober-udeb (leaving a Provides: behind) and 693 | create an os-prober deb. 694 | * Avoid yaboot probe failing outside d-i due to archdetect being missing. 695 | * Don't install /var/lib/os-prober/mount in either binary package, just 696 | /var/lib/os-prober; the former will be created/removed on the fly 697 | anyway. 698 | 699 | -- Colin Watson Thu, 8 Dec 2005 02:58:36 +0000 700 | 701 | os-prober (1.08) unstable; urgency=low 702 | 703 | [ Colin Watson ] 704 | * Install necessary kernel modules on the fly using anna-install, rather 705 | than depending on them. Requires anna >= 1.16. 706 | 707 | -- Frans Pop Tue, 15 Nov 2005 20:37:52 +0100 708 | 709 | os-prober (1.07) unstable; urgency=low 710 | 711 | [ Matt Kraai ] 712 | * Add support for QNX. 713 | 714 | -- Joey Hess Mon, 26 Sep 2005 17:18:18 +0200 715 | 716 | os-prober (1.06) unstable; urgency=low 717 | 718 | * Frans Pop 719 | - Make idempotent by deleting files in /var/lib/os-prober/ on start 720 | (resets count_next_label). 721 | - Properly determine whether partitions are mounted or not by using 722 | mapdevfs to match device names. Closes: #251794, #251662. 723 | - Add dependency on di-utils-mapdevfs. 724 | 725 | -- Joey Hess Sun, 1 May 2005 16:52:18 -0400 726 | 727 | os-prober (1.05) unstable; urgency=low 728 | 729 | * Colin Watson 730 | - 'boot' is implicit at the end of a grub menu entry. Cope with it being 731 | missing (part of #258623). 732 | 733 | -- Colin Watson Sat, 26 Mar 2005 16:55:23 +0000 734 | 735 | os-prober (1.04) unstable; urgency=low 736 | 737 | * Joey Hess 738 | - Fix micosoft and lsb tests to use count_next_label to get unique 739 | short labels. Closes: #299001 740 | 741 | -- Joey Hess Fri, 11 Mar 2005 14:06:00 -0500 742 | 743 | os-prober (1.03) unstable; urgency=low 744 | 745 | * Joey Hess 746 | - Applied patch from Guillem Jover to detect many redhat derived 747 | distributions. 748 | * Frans Pop 749 | - Exclude partitions that are part of a software raid array. 750 | Closes: #273960. 751 | - Don't use the description from Windows' boot.ini if it contains 752 | non-ascii (or other unusual) characters. Closes: #293859. 753 | * Colin Watson 754 | - Probe ext3, xfs, and jfs modules too. 755 | 756 | -- Joey Hess Fri, 11 Feb 2005 20:30:56 -0500 757 | 758 | os-prober (1.02) unstable; urgency=low 759 | 760 | * Joshua Kwan 761 | - I don't have time to test/improve os-prober these days, so removing 762 | myself from Uploaders. 763 | * Colin Watson 764 | - Install i386 tests on amd64 too (closes: #261378). 765 | 766 | -- Colin Watson Thu, 21 Oct 2004 14:02:05 +0100 767 | 768 | os-prober (1.01) unstable; urgency=low 769 | 770 | * Joey Hess 771 | - Applied patch from eddyp to parse boot.ini to determine correct names 772 | of modern versions of Windows. Closes: #275882 773 | 774 | -- Joey Hess Wed, 20 Oct 2004 15:20:12 -0400 775 | 776 | os-prober (1.00) unstable; urgency=low 777 | 778 | * Joey Hess 779 | - Fedora uses a grub.conf. This may or may not be linked to menu.lst 780 | (unknown). Look for it if menu.lst is not found. 781 | - Gratuitous version number bump. 782 | 783 | -- Joey Hess Sun, 3 Oct 2004 18:27:10 -0400 784 | 785 | os-prober (0.14) unstable; urgency=low 786 | 787 | * Joey Hess 788 | - It's actually allowed and common for /etc/lsb-release to not include a 789 | DISTRIB_DESCRIPTION or DISTRIB_CODENAME, so don't call such distros 790 | "Unknown semi-LSB-compliant Linux distribution", just skip to the next 791 | test. This affected FC2. 792 | 793 | -- Joey Hess Fri, 27 Aug 2004 12:57:06 -0400 794 | 795 | os-prober (0.13) unstable; urgency=low 796 | 797 | * Giuseppe Sacco 798 | - Added preliminary test for Solaris/IA32. Closes: #255206 799 | * Joey Hess 800 | - Add support for fstabs with UUIDs or disk labels. Closes:#257794 801 | - In fallback os-prober test, skip over symlinks, since they could point 802 | from root into /boot or result in confusing duplicate entries. 803 | Closes: #258624 804 | - Make the fallback os-prober really find kernels matched by globs. 805 | 806 | -- Joey Hess Sat, 10 Jul 2004 14:32:17 -0400 807 | 808 | os-prober (0.12) unstable; urgency=low 809 | 810 | * Colin Watson 811 | - Fix syntax error in already-mounted case. 812 | - Cope with empty initrd parameter in yaboot.conf parser. 813 | 814 | -- Colin Watson Wed, 12 May 2004 01:16:05 +0100 815 | 816 | os-prober (0.11) unstable; urgency=low 817 | 818 | * Colin Watson 819 | - Make linux-distro test work on architectures that don't have 820 | /lib/ld-linux.so* (closes: #244076). 821 | - Fix a typo in the yaboot parser. 822 | 823 | -- Colin Watson Sun, 9 May 2004 16:35:43 +0100 824 | 825 | os-prober (0.10) unstable; urgency=low 826 | 827 | * Colin Watson 828 | - Restore module dependencies, using debian/module-depends.$(ARCH). 829 | Closes: #246700 830 | * Joey Hess 831 | - Have os-prober run mounted tests on partitions that are already 832 | mounted (skipping / and /target). Closes: #247080 833 | 834 | -- Joey Hess Tue, 4 May 2004 20:52:29 -0400 835 | 836 | os-prober (0.09) unstable; urgency=low 837 | 838 | * Guillem Jover 839 | - Added more distros support. 840 | * Joey Hess 841 | - Use just "Windows" as the shortname for Windows 2k/NT/XP. 842 | 843 | -- Joey Hess Thu, 22 Apr 2004 12:07:11 -0400 844 | 845 | os-prober (0.08) unstable; urgency=low 846 | 847 | * Joey Hess 848 | - Initialise variables in lilo and grub probes, to avoid inheriting 849 | settings for things like $initrd from the kernel command line. 850 | This fixes processing of things like lilo.conf stanzas that do not set 851 | an initrd. Thanks to Frans Pop. 852 | - Add some extra debug logging. 853 | 854 | -- Joey Hess Tue, 20 Apr 2004 16:40:16 -0400 855 | 856 | os-prober (0.07) unstable; urgency=low 857 | 858 | * Colin Watson 859 | - Add a Mac OS 6-9 check for powerpc. This is currently a copy of the 860 | m68k version with a different loader name for yaboot's benefit, which 861 | may not be ideal ... 862 | - Send modprobe's standard output to syslog so that it doesn't confuse 863 | programs parsing os-prober's output. 864 | 865 | -- Colin Watson Sun, 18 Apr 2004 11:23:51 +0100 866 | 867 | os-prober (0.06) unstable; urgency=low 868 | 869 | * Colin Watson 870 | - Add a Linux boot probe for /etc/yaboot.conf. 871 | - Make sure hfs is available for the Mac OS 9 check. 872 | - Delay hfs until last in mounted checks so that we can tell the 873 | difference between that and hfsplus. 874 | - Add count to Mac OS X labels; change loader type to macosx. 875 | - Add myself to Uploaders. 876 | 877 | -- Colin Watson Wed, 14 Apr 2004 01:15:53 +0100 878 | 879 | os-prober (0.05) unstable; urgency=low 880 | 881 | * Joey Hess 882 | - Fix broken mounting of /boot partitions. 883 | - Fix grub probe to support systems that have /boot on a separate 884 | partition, by looking for kernels in /boot as well. 885 | - Same for initrds. 886 | 887 | -- Joey Hess Sat, 10 Apr 2004 16:06:49 -0400 888 | 889 | os-prober (0.04) unstable; urgency=low 890 | 891 | * Joey Hess 892 | - Return "hurd" as the OS type for hurd, rather than "multiboot". 893 | The latter is not enough info to boot the hurd. 894 | - Fix broken hurd detection. 895 | 896 | -- Joey Hess Fri, 9 Apr 2004 22:18:54 -0400 897 | 898 | os-prober (0.03) unstable; urgency=low 899 | 900 | * Joshua Kwan 901 | - Allow for unique short names via functions in new common.sh library. 902 | - Revamp all the dh_install stuff. 903 | - Use /var/lib/os-prober as our sandbox. 904 | * Colin Watson 905 | - Add Mac OS X probing support. 906 | * Joey Hess 907 | - Added linux-boot-prober, with sorta working support for grub. 908 | - Reorg the probes, and move to /usr/lib. 909 | - Remove broken depends line. 910 | - Add a linux boot probe that searches for kernels and initrds with no 911 | bootloader config file, as a fallback. 912 | - Add a linux boot probe that parses /etc/lilo.conf. 913 | 914 | -- Joey Hess Wed, 7 Apr 2004 21:40:39 -0400 915 | 916 | os-prober (0.02) unstable; urgency=low 917 | 918 | * Include init dir in the udeb. 919 | 920 | -- Joey Hess Sun, 4 Apr 2004 00:43:12 -0500 921 | 922 | os-prober (0.01) unstable; urgency=low 923 | 924 | * Initial Release. 925 | 926 | -- Joey Hess Sat, 3 Apr 2004 23:45:29 -0500 927 | --------------------------------------------------------------------------------