[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#732696: Re: Bug#732696: os-prober: Fails to detect new package-management Haiku builds



Hello,

One year later and I have found some time to work on this.

On 6 August 2014 at 20:58, François Revol <revol@free.fr> wrote:
> On 15/07/2014 13:09, Jeroen Oortwijn wrote:
>> As the writer of the original probe [1], I will try to answer some questions.
>
> As the original writer of the original probe (:D), let me comment on
> this as well...

Woops, sorry for not mentioning you. Well at least it was clear from
the page I referred to. :)

> I added some sed to add the version info, I noticed at least the windows
> probe did this, and I saw no reason not to do it.
> First version was quite naive, but it should now be robust enough to
> handle future official releases I think, degrading partially with
> missing hrev and other parts.
>
> Some tests here:
> http://pastebin.com/KsseypUb
>
> Currently my menu ends up like:
> Haiku R1 alpha4 (hrev47000)
> which is much nicer than just the OS name.
>
> Patch against your branch attached, hopefully with correct format, I'm
> not used to bzr.

I like it!
I merged your patch into my branch [1] in rev. 37. (I'm also not used
to bzr, but it looks like the merge succeeded.)

>> I removed the detection of the non package management builds of Haiku,
>> because I don't think there will be a lot of non-PM versions installed
>> when the next Haiku release is out. Haiku releases currently are in
>> alpha phase, so a lot can still be changed. Though from now on all
>> releases will be package management based.
>
> Well the last official release is still alpha4 though, which is non-PM.
>
> And I still have a pre-PM partition on at least one machine to compare
> until I fix several regressions.
>
> But I copied the existing probe as a different name and it just works
> for me.

You're right, the script should detect all Haiku versions. So I added
the detection of the non package management Haiku builds back.

The partition type provided by grub-probe has changed in the meantime
[2] and the partition can be mounted with befs-fuse [3], so I also
modified the supported partition types.
In case of befs-fuse, a virtual folder named 'myfs' gets added in
which the file system contents are placed. Therefore, 'myfs' needs to
be added to the mount point variable. I intend to try to remove this
'myfs' folder from befs-fuse (tried once in the past [4]), but this
could take a while so for now this 'hack' is needed.

I've attached a git patch against the current git tree, containing all
previous changes. I've tested it with several different Haiku versions
(R1a3, R1a4, x86_64 non-PM, nightly, x86_64 nightly) and found no
problems. I would appreciate additional review and testing, though.

Kind regards,

Jeroen Oortwijn

[1] https://code.launchpad.net/~idefix/ubuntu/trusty/os-prober/HaikuPM
[2] http://lists.gnu.org/archive/html/grub-devel/2015-07/msg00128.html
[3] https://launchpad.net/~idefix/+archive/ubuntu/befs-support
[4] https://www.freelists.org/post/haiku-development/BFS-FUSE-removing-the-myfs-folder
From dc7754af9cabcf213168f60b2894e1e97037f0f8 Mon Sep 17 00:00:00 2001
From: Jeroen Oortwijn <oortwijn@gmail.com>
Date: Tue, 11 Aug 2015 16:11:14 +0200
Subject: [PATCH] Change Haiku detection (package management)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

 * Added detection of Haiku package management versions
 * Added Haiku version info code by François Revol
 * Modified the supported partition types
    - When not mounted, the grub-probe utility detects it as 'bfs'.
    - When mounted with the befs kernel module, it's get detected
      as 'befs'.
    - When mounted with befs-fuse, it's get detected as a FUSE
      partition.
 * Change mount point when partition is mounted with befs-fuse
      When the partition is mounted with befs-fuse, it will add a
      virtual folder 'myfs' in which the file system contents are
      placed. This folder needs to be removed from befs-fuse, but
      in the meantime add this folder to the mount point so that
      Haiku can be detected.
---
 os-probes/mounted/x86/83haiku | 27 +++++++++++++++++++--------
 1 file changed, 19 insertions(+), 8 deletions(-)

diff --git a/os-probes/mounted/x86/83haiku b/os-probes/mounted/x86/83haiku
index 6de7a1d..b2878d6 100755
--- a/os-probes/mounted/x86/83haiku
+++ b/os-probes/mounted/x86/83haiku
@@ -9,27 +9,38 @@ type="$3"
 
 # Weed out stuff that doesn't apply to us
 case "$type" in
-	befs|befs_be) debug "$partition is a BeFS partition" ;;
+	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 ;;
 esac
 
-if head -c 512 "$partition" | grep -qs "system.haiku_loader"; then
-	debug "Stage 1 bootloader found"
+if head -c 512 "$partition" | grep -qs "haiku_loader"; then
+	debug "Haiku stage 1 bootloader found"
 else
-	debug "Stage 1 bootloader not found: exiting"
+	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-.*\.hpkg" "$mpoint/$system/$packages" &&
+		rev="$(item_in_dir "haiku-.*\.hpkg" "$mpoint/$system/$packages")"
+then
+	debug "Haiku PM stage 2 bootloader and kernel 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/ $//')"
+	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_x86" "$mpoint/$system" ||
-		item_in_dir -q "kernel_x86_64" "$mpoint/$system")
+	item_in_dir -q "kernel_.*" "$mpoint/$system"
 then
-	debug "Stage 2 bootloader and kernel found"
+	debug "Haiku non-PM stage 2 bootloader and kernel found"
 	label="$(count_next_label Haiku)"
 	result "$partition:Haiku:$label:chain"
 	exit 0
 else
-	debug "Stage 2 bootloader and kernel not found: exiting"
+	debug "Haiku stage 2 bootloader and kernel not found: exiting"
 	exit 1
 fi
-- 
1.9.1


Reply to: