Skip to content

Commit c09821c

Browse files
agmsmithpulkomandy
authored andcommitted
3rdparty/os_probe: August 2015 version of 83Haiku.
This one seems to be the final collated version with the previous patches and ideas all included. It's version 42 (dated 20150811) put together by Jeroen Oortwijn at https://bazaar.launchpad.net/~idefix/ubuntu/trusty/os-prober/HaikuPM/files/head:/os-probes/mounted/x86 Change-Id: Ia7f276b45a5766c5f5bf1495d3726e5d475e2eee Reviewed-on: https://review.haiku-os.org/c/haiku/+/4497 Reviewed-by: Alexander G. M. Smith <agmsmith@ncf.ca> Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
1 parent 3958b55 commit c09821c

File tree

1 file changed

+24
-27
lines changed

1 file changed

+24
-27
lines changed

3rdparty/os_probe/83haiku

Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
#!/usr/bin/sh
2-
# Detects Haiku on BeFS partitions.
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
35

46
. /usr/share/os-prober/common.sh
57

@@ -9,43 +11,38 @@ type="$3"
911

1012
# Weed out stuff that doesn't apply to us
1113
case "$type" in
12-
befs|befs_be) debug "$partition is a BeFS partition" ;;
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
1316
*) debug "$partition is not a BeFS partition: exiting"; exit 1 ;;
1417
esac
1518

16-
if head -c 512 "$partition" | grep -qs 'system.*haiku_loader'; then
17-
debug "Stage 1 bootloader found"
19+
if head -c 512 "$partition" | grep -qs "haiku_loader"; then
20+
debug "Haiku stage 1 bootloader found"
1821
else
19-
debug "Stage 1 bootloader not found: exiting"
22+
debug "Haiku stage 1 bootloader not found: exiting"
2023
exit 1
2124
fi
2225

23-
system="$(item_in_dir "system" "$mpoint")"
24-
packages="$(item_in_dir "packages" "$mpoint/$system")"
25-
found=
26-
if [ "$system" != "" ] &&
27-
item_in_dir -q "haiku_loader" "$mpoint/$system" &&
28-
(item_in_dir -q "kernel_x86" "$mpoint/$system" ||
29-
item_in_dir -q "kernel_x86_64" "$mpoint/$system")
26+
if system="$(item_in_dir "system" "$mpoint")" &&
27+
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")"
3030
then
31-
found=1
32-
fi
33-
34-
if [ "$found" = "" ] && [ "$packages" != "" ] &&
35-
item_in_dir -q "haiku_loader\-.*" "$mpoint/$system/$packages" &&
36-
(item_in_dir -q "haiku_x86\-.*" "$mpoint/$system/$packages" ||
37-
item_in_dir -q "haiku_x86_64\-.*" "$mpoint/$system/$packages")
38-
then
39-
found=1
40-
fi
41-
42-
if [ "$found" != "" ]
31+
debug "Haiku PM stage 2 bootloader and kernel found"
32+
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/ $//')"
34+
long="Haiku $rev"
35+
result "$partition:$long:$label:chain"
36+
exit 0
37+
elif system="$(item_in_dir "system" "$mpoint")" &&
38+
item_in_dir -q "haiku_loader" "$mpoint/$system" &&
39+
item_in_dir -q "kernel_.*" "$mpoint/$system"
4340
then
44-
debug "Stage 2 bootloader and kernel found"
41+
debug "Haiku non-PM stage 2 bootloader and kernel found"
4542
label="$(count_next_label Haiku)"
4643
result "$partition:Haiku:$label:chain"
4744
exit 0
4845
else
49-
debug "Stage 2 bootloader and kernel not found: exiting"
46+
debug "Haiku stage 2 bootloader and kernel not found: exiting"
5047
exit 1
5148
fi

0 commit comments

Comments
 (0)