[haiku-development] PM builds and os-prober

  • From: David Given <dg@xxxxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Fri, 20 Dec 2013 12:19:11 +0000

os-prober, which is a tool used on Linux (and possibly the BSDs) to find
alien operating systems, and which has had Haiku support for a while,
fails to find Haiku pm builds. The issue is that some stuff's moved
around; the magic string in the boot block has changed, and the kernel
has moved (now it's in a package).

The attached patch fixes this, or at least fixes it enough to find my PM
build.

I have no idea who to report this to...

-- 
┌─── dg@cowlark.com ───── http://www.cowlark.com ─────
│ "There does not now, nor will there ever, exist a programming
│ language in which it is the least bit hard to write bad programs." ---
│ Flon's Axiom
--- /usr/lib/os-probes/mounted/83haiku  2012-08-22 19:21:32.000000000 +0100
+++ /tmp/83haiku        2013-12-20 12:17:29.143209425 +0000
@@ -13,18 +13,34 @@
        *) debug "$partition is not a BeFS partition: exiting"; exit 1 ;;
 esac
 
-if head -c 512 "$partition" | grep -qs "system.haiku_loader"; then
+if head -c 512 "$partition" | grep -qs 'system.*haiku_loader'; then
        debug "Stage 1 bootloader found"
 else
        debug "Stage 1 bootloader not found: exiting"
        exit 1
 fi
 
-if system="$(item_in_dir "system" "$mpoint")" &&
+system="$(item_in_dir "system" "$mpoint")"
+packages="$(item_in_dir "packages" "$mpoint/$system")"
+found=
+if [ "$system" != "" ] &&
        item_in_dir -q "haiku_loader" "$mpoint/$system" &&
        (item_in_dir -q "kernel_x86" "$mpoint/$system" ||
                item_in_dir -q "kernel_x86_64" "$mpoint/$system")
 then
+       found=1
+fi
+
+if [ "$found" = "" ] && [ "$packages" != "" ] &&
+       item_in_dir -q "haiku_loader\-.*" "$mpoint/$system/$packages" &&
+       (item_in_dir -q "haiku_x86\-.*" "$mpoint/$system/$packages" ||
+               item_in_dir -q "haiku_x86_64\-.*" "$mpoint/$system/$packages")
+then
+       found=1
+fi
+
+if [ "$found" != "" ]
+then
        debug "Stage 2 bootloader and kernel found"
        label="$(count_next_label Haiku)"
        result "$partition:Haiku:$label:chain"

Attachment: signature.asc
Description: OpenPGP digital signature

Other related posts: