mirror of
https://review.haiku-os.org/haiku
synced 2024-11-23 07:18:40 +01:00
610f99c838
Had a look at the actual Debian os-prober (1.79) package and found that they use /bin/sh as their shell for all their os-prober scripts. So for Fedora and other downstream packages, someone must be going through all the scripts and changing them to /usr/bin/sh. Switch to the Debian variety since they're the upstream of everybody for this. Change-Id: I2bed8cb133640861311061261ff0cae8ae6f2648 Reviewed-on: https://review.haiku-os.org/c/haiku/+/4599 Reviewed-by: Alexander G. M. Smith <agmsmith@ncf.ca> Reviewed-by: Adrien Destugues <pulkomandy@gmail.com> Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
57 lines
2.3 KiB
Bash
Executable File
57 lines
2.3 KiB
Bash
Executable File
#!/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
|
|
|
|
partition="$1"
|
|
mpoint="$2"
|
|
type="$3"
|
|
|
|
# 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, 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."
|
|
else
|
|
debug "Haiku stage 1 bootloader not found: exiting"
|
|
exit 1
|
|
fi
|
|
|
|
if system="$(item_in_dir "system" "$mpoint")" &&
|
|
packages="$(item_in_dir "packages" "$mpoint/$system")" &&
|
|
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 Package Manager stage 2 bootloader and kernel ($rev) found."
|
|
label="$(count_next_label Haiku)"
|
|
# 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
|
|
elif system="$(item_in_dir "system" "$mpoint")" &&
|
|
item_in_dir -q "haiku_loader" "$mpoint/$system" &&
|
|
item_in_dir -q "kernel_.*" "$mpoint/$system"
|
|
then
|
|
debug "Older non-package manager Haiku stage 2 bootloader and kernel found."
|
|
label="$(count_next_label Haiku)"
|
|
result "$partition:Haiku:$label:chain"
|
|
exit 0
|
|
else
|
|
debug "Haiku stage 2 bootloader and kernel not found: exiting"
|
|
exit 1
|
|
fi
|