Skip to content

Commit 0b057a9

Browse files
agmsmithpulkomandy
authored andcommitted
3rdparty/os_probe: Better wording, fix Beta+ version parsing.
Add lots of comments explaining things in the code. Also fix parsing of Beta updates which have hrev version numbers with an extra bit at the end, like hrev12345_67. Include architecture in the GRUB menu title, so you can tell 32 bit and 64 bit installs apart. Switch back to #!/usr/bin/sh, like all the other probes do. Change-Id: Id47afe5029369c739d5177b1dd917c7d1d631ad6 Reviewed-on: https://review.haiku-os.org/c/haiku/+/4498 Reviewed-by: Alexander G. M. Smith <agmsmith@ncf.ca> Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
1 parent c09821c commit 0b057a9

File tree

2 files changed

+31
-23
lines changed

2 files changed

+31
-23
lines changed

3rdparty/os_probe/83haiku

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,52 @@
1-
#!/bin/sh
2-
# Detects Haiku on BeFS partitions and FUSE mounted BeFS too.
3-
# Discussion at https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=732696
4-
# From version 42 (dated 20150811) updated by Jeroen Oortwijn at https://bazaar.launchpad.net/~idefix/ubuntu/trusty/os-prober/HaikuPM/files/head:/os-probes/mounted/x86
1+
#!/usr/bin/sh
2+
# Detects bootable Haiku OS on BeFS partitions and FUSE mounted BeFS too.
3+
# If it doesn't find anything, try mounting the BeFS volumes in Linux.
4+
# Discussion of improvements and development history at
5+
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=732696
6+
# Adapted from version 42 (dated 20150811) updated by Jeroen Oortwijn at
7+
# https://bazaar.launchpad.net/~idefix/ubuntu/trusty/os-prober/HaikuPM/files/head:/os-probes/mounted/x86
8+
# Latest version now at https://git.haiku-os.org/haiku/tree/3rdparty/os_probe
59

610
. /usr/share/os-prober/common.sh
711

812
partition="$1"
913
mpoint="$2"
1014
type="$3"
1115

12-
# Weed out stuff that doesn't apply to us
16+
# Weed out stuff that doesn't apply to us, needs to be a Be file system.
1317
case "$type" in
14-
bfs|befs) debug "$partition is a BeFS partition" ;;
15-
fuse|fuseblk) debug "$partition is a FUSE partition" ; mpoint="$mpoint/myfs" ;; # might be befs-fuse
16-
*) debug "$partition is not a BeFS partition: exiting"; exit 1 ;;
18+
bfs|befs) debug "$partition is a BeFS partition." ;;
19+
fuse|fuseblk) debug "$partition is a FUSE partition, maybe with BeFS on it." ; mpoint="$mpoint/myfs" ;;
20+
*) exit 1 ;; # Be quiet and just quit for irrelevant partitions.
1721
esac
1822

1923
if head -c 512 "$partition" | grep -qs "haiku_loader"; then
20-
debug "Haiku stage 1 bootloader found"
24+
debug "Haiku stage 1 bootloader found."
2125
else
2226
debug "Haiku stage 1 bootloader not found: exiting"
2327
exit 1
2428
fi
2529

2630
if system="$(item_in_dir "system" "$mpoint")" &&
2731
packages="$(item_in_dir "packages" "$mpoint/$system")" &&
28-
item_in_dir -q "haiku_loader-.*\.hpkg" "$mpoint/$system/$packages" &&
29-
rev="$(item_in_dir "haiku-.*\.hpkg" "$mpoint/$system/$packages")"
32+
item_in_dir -q "haiku_loader-r[0-9].*\.hpkg" "$mpoint/$system/$packages" &&
33+
rev="$(item_in_dir "haiku-r[0-9].*\.hpkg" "$mpoint/$system/$packages")"
3034
then
31-
debug "Haiku PM stage 2 bootloader and kernel found"
35+
debug "Haiku Package Manager stage 2 bootloader and kernel ($rev) found."
3236
label="$(count_next_label Haiku)"
33-
rev="$(echo "$rev" | sed 's/haiku-//;s/^\(r[0-9]\+\)./\U\1\E /;s/ \([a-z]\+[0-9]\+\)[_-]/ \1 /;s/ [a-z]*_\?\(hrev[0-9]\+\)\+-/ (\1) /;s/[^ ]\+.hpkg//;s/ $//')"
37+
# Convert kernel file name like haiku-r1~beta3_hrev55181_56-1-x86_64.hpkg
38+
# or haiku-r1~alpha4_pm_hrev49856-1-x86_gcc2.hpkg into a readable version,
39+
# like "Haiku R1 beta3 (hrev55181_56) 64". Seems to use a travelling space
40+
# technique in the sed stream editor.
41+
rev="$(echo "$rev" | sed 's/haiku-//;s/^\(r[0-9]\+\)./\U\1\E /;s/ \([a-z]\+[0-9]\+\)[_-]/ \1 /;s/ [a-z]*_\?\(hrev[0-9_]\+\)\+-/ (\1) /;s/) [^_]\+_\([a-z0-9]\+\)\.hpkg/) \1 /;s/[^ ]\+.hpkg//;s/ $//')"
3442
long="Haiku $rev"
3543
result "$partition:$long:$label:chain"
3644
exit 0
3745
elif system="$(item_in_dir "system" "$mpoint")" &&
3846
item_in_dir -q "haiku_loader" "$mpoint/$system" &&
3947
item_in_dir -q "kernel_.*" "$mpoint/$system"
4048
then
41-
debug "Haiku non-PM stage 2 bootloader and kernel found"
49+
debug "Older non-package manager Haiku stage 2 bootloader and kernel found."
4250
label="$(count_next_label Haiku)"
4351
result "$partition:Haiku:$label:chain"
4452
exit 0

3rdparty/os_probe/README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
# os-probe for the Haiku Computer Operating System
22

33
This is the Linux "os-probes" file to detect Haiku OS and to automatically add
4-
it to the GRUB boot menu.
4+
it to the GRUB boot menu. Mostly relevant for x86 BIOS based computers.
55

6-
First make sure the Haiku volumes you want to boot are mounted in Linux
7-
(otherwise nothing gets detected). Then copy the 83haiku file to your Linux
8-
system in the os-probes subdirectory, usually (in Fedora at least) it will be
9-
/usr/libexec/os-probes/mounted/83haiku You can find older 83haiku versions in
10-
the repository history, though the latest should be able to detect older
11-
(pre-package manager) Haiku too.
6+
Copy the 83haiku file to your Linux system in the os-probes subdirectory,
7+
usually (in Fedora at least) it will be /usr/libexec/os-probes/mounted/83haiku
8+
You can find older 83haiku versions in the repository history, though the
9+
latest should be able to detect older (pre-package manager) Haiku too.
1210

1311
Then regenerate the GRUB boot configuration file. This will happen
1412
automatically the next time your kernel is updated. To do it manually,
1513
for old school MBR BIOS boot computers, the command is
1614
`grub2-mkconfig --output /boot/grub2/grub.cfg`
15+
If it doesn't find the Haiku partitions, try manually mounting them in Linux
16+
and rerun the grub command.
1717

1818
Computers using the newer UEFI boot system have a EFI/HAIKU/BOOTX64.EFI file
1919
that you manually install to your EFI partition, and booting is done
@@ -25,6 +25,6 @@ It's in the
2525
[Debian os-prober package](https://packages.debian.org/search?keywords=os-prober).
2626
There's also a big discussion about updating it in
2727
[Debian Bug Report #732696](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=732696).
28+
Latest version is now at https://git.haiku-os.org/haiku/tree/3rdparty/os_probe
2829

29-
_AGMS20210921_
30-
30+
_AGMS20210927_

0 commit comments

Comments
 (0)