linux-boot-probe: mounted/40grub2 add tests for handling escaped $ " \
[os-prober.git] / 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 partition 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.