mirror of
https://review.haiku-os.org/haiku
synced 2024-11-23 07:18:40 +01:00
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>
This commit is contained in:
parent
c09821c07d
commit
0b057a903f
36
3rdparty/os_probe/83haiku
vendored
36
3rdparty/os_probe/83haiku
vendored
@ -1,7 +1,11 @@
|
||||
#!/bin/sh
|
||||
# Detects Haiku on BeFS partitions and FUSE mounted BeFS too.
|
||||
# Discussion at https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=732696
|
||||
# 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
|
||||
#!/usr/bin/sh
|
||||
# Detects bootable Haiku OS on BeFS partitions and FUSE mounted BeFS too.
|
||||
# If it doesn't find anything, try mounting the BeFS volumes in Linux.
|
||||
# Discussion of improvements and development history at
|
||||
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=732696
|
||||
# Adapted 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
|
||||
# Latest version now at https://git.haiku-os.org/haiku/tree/3rdparty/os_probe
|
||||
|
||||
. /usr/share/os-prober/common.sh
|
||||
|
||||
@ -9,15 +13,15 @@ partition="$1"
|
||||
mpoint="$2"
|
||||
type="$3"
|
||||
|
||||
# Weed out stuff that doesn't apply to us
|
||||
# Weed out stuff that doesn't apply to us, needs to be a Be file system.
|
||||
case "$type" in
|
||||
bfs|befs) debug "$partition is a BeFS partition" ;;
|
||||
fuse|fuseblk) debug "$partition is a FUSE partition" ; mpoint="$mpoint/myfs" ;; # might be befs-fuse
|
||||
*) debug "$partition is not a BeFS partition: exiting"; exit 1 ;;
|
||||
bfs|befs) debug "$partition is a BeFS partition." ;;
|
||||
fuse|fuseblk) debug "$partition is a FUSE partition, maybe with BeFS on it." ; mpoint="$mpoint/myfs" ;;
|
||||
*) exit 1 ;; # Be quiet and just quit for irrelevant partitions.
|
||||
esac
|
||||
|
||||
if head -c 512 "$partition" | grep -qs "haiku_loader"; then
|
||||
debug "Haiku stage 1 bootloader found"
|
||||
debug "Haiku stage 1 bootloader found."
|
||||
else
|
||||
debug "Haiku stage 1 bootloader not found: exiting"
|
||||
exit 1
|
||||
@ -25,12 +29,16 @@ fi
|
||||
|
||||
if system="$(item_in_dir "system" "$mpoint")" &&
|
||||
packages="$(item_in_dir "packages" "$mpoint/$system")" &&
|
||||
item_in_dir -q "haiku_loader-.*\.hpkg" "$mpoint/$system/$packages" &&
|
||||
rev="$(item_in_dir "haiku-.*\.hpkg" "$mpoint/$system/$packages")"
|
||||
item_in_dir -q "haiku_loader-r[0-9].*\.hpkg" "$mpoint/$system/$packages" &&
|
||||
rev="$(item_in_dir "haiku-r[0-9].*\.hpkg" "$mpoint/$system/$packages")"
|
||||
then
|
||||
debug "Haiku PM stage 2 bootloader and kernel found"
|
||||
debug "Haiku Package Manager stage 2 bootloader and kernel ($rev) found."
|
||||
label="$(count_next_label Haiku)"
|
||||
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/ $//')"
|
||||
# Convert kernel file name like haiku-r1~beta3_hrev55181_56-1-x86_64.hpkg
|
||||
# or haiku-r1~alpha4_pm_hrev49856-1-x86_gcc2.hpkg into a readable version,
|
||||
# like "Haiku R1 beta3 (hrev55181_56) 64". Seems to use a travelling space
|
||||
# technique in the sed stream editor.
|
||||
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/ $//')"
|
||||
long="Haiku $rev"
|
||||
result "$partition:$long:$label:chain"
|
||||
exit 0
|
||||
@ -38,7 +46,7 @@ elif system="$(item_in_dir "system" "$mpoint")" &&
|
||||
item_in_dir -q "haiku_loader" "$mpoint/$system" &&
|
||||
item_in_dir -q "kernel_.*" "$mpoint/$system"
|
||||
then
|
||||
debug "Haiku non-PM stage 2 bootloader and kernel found"
|
||||
debug "Older non-package manager Haiku stage 2 bootloader and kernel found."
|
||||
label="$(count_next_label Haiku)"
|
||||
result "$partition:Haiku:$label:chain"
|
||||
exit 0
|
||||
|
18
3rdparty/os_probe/README.md
vendored
18
3rdparty/os_probe/README.md
vendored
@ -1,19 +1,19 @@
|
||||
# os-probe for the Haiku Computer Operating System
|
||||
|
||||
This is the Linux "os-probes" file to detect Haiku OS and to automatically add
|
||||
it to the GRUB boot menu.
|
||||
it to the GRUB boot menu. Mostly relevant for x86 BIOS based computers.
|
||||
|
||||
First make sure the Haiku volumes you want to boot are mounted in Linux
|
||||
(otherwise nothing gets detected). Then copy the 83haiku file to your Linux
|
||||
system in the os-probes subdirectory, usually (in Fedora at least) it will be
|
||||
/usr/libexec/os-probes/mounted/83haiku You can find older 83haiku versions in
|
||||
the repository history, though the latest should be able to detect older
|
||||
(pre-package manager) Haiku too.
|
||||
Copy the 83haiku file to your Linux system in the os-probes subdirectory,
|
||||
usually (in Fedora at least) it will be /usr/libexec/os-probes/mounted/83haiku
|
||||
You can find older 83haiku versions in the repository history, though the
|
||||
latest should be able to detect older (pre-package manager) Haiku too.
|
||||
|
||||
Then regenerate the GRUB boot configuration file. This will happen
|
||||
automatically the next time your kernel is updated. To do it manually,
|
||||
for old school MBR BIOS boot computers, the command is
|
||||
`grub2-mkconfig --output /boot/grub2/grub.cfg`
|
||||
If it doesn't find the Haiku partitions, try manually mounting them in Linux
|
||||
and rerun the grub command.
|
||||
|
||||
Computers using the newer UEFI boot system have a EFI/HAIKU/BOOTX64.EFI file
|
||||
that you manually install to your EFI partition, and booting is done
|
||||
@ -25,6 +25,6 @@ It's in the
|
||||
[Debian os-prober package](https://packages.debian.org/search?keywords=os-prober).
|
||||
There's also a big discussion about updating it in
|
||||
[Debian Bug Report #732696](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=732696).
|
||||
Latest version is now at https://git.haiku-os.org/haiku/tree/3rdparty/os_probe
|
||||
|
||||
_AGMS20210921_
|
||||
|
||||
_AGMS20210927_
|
||||
|
Loading…
Reference in New Issue
Block a user