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 re...@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 oortw...@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) +
Bug#732696: Re: Bug#732696: os-prober: Fails to detect new package-management Haiku builds
Hello, On 15/07/2014 13:09, Jeroen Oortwijn wrote: Hello, 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... TBH if this were mine I'd be inclined to remove most of this logic. The prober doesn't do anything with the files other than to look to see if they're there. Simply checking the boot loader for 'haiku' would be a lot simpler and more robust. Yes, but that could give false-positives: When the user has 'makebootable'd' a partition, but then removed all the files to use it for something else. The stage 1 bootloader would then still be present, but not the stage 2 bootloader and the kernel. The partition would then still be detected as containing an OS. That's why the probe checks if the stage 1 bootloader, stage 2 bootloader and kernel are all present. +1 Although OTOH in theory GRUB2 is able to load haiku_loader directly so it might work without makebootable, but nobody knows and uses it, and I never finished multiboot support so it always asks where its boot partition is. Because David's patch doesn't work anymore, I have created a new patch. See attached file. This patch can also be found at my bazaar branch [3]. The resulting packages can be found in my PPA [4]. 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 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. François. # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: re...@free.fr-20140806181508-8ewigskp1r29yybv # target_branch: http://bazaar.launchpad.net/~idefix/ubuntu/trusty/os-\ # prober/HaikuPM/ # testament_sha1: e5e1cf1cc481796312c43938b873f8ebed3731dd # timestamp: 2014-08-06 20:33:38 +0200 # base_revision_id: oortw...@gmail.com-20140713175637-ciywgnvjqwou9vq9 # # Begin patch === modified file 'os-probes/mounted/x86/83haiku' --- os-probes/mounted/x86/83haiku 2014-07-13 17:56:37 + +++ os-probes/mounted/x86/83haiku 2014-08-06 18:15:08 + @@ -23,11 +23,13 @@ if system=$(item_in_dir system $mpoint) packages=$(item_in_dir packages $mpoint/$system) item_in_dir -q haiku_loader-.*\.hpkg $mpoint/$system/$packages - item_in_dir -q haiku-.*\.hpkg $mpoint/$system/$packages + rev=$(item_in_dir haiku-.*\.hpkg $mpoint/$system/$packages) then debug Stage 2 bootloader and kernel found label=$(count_next_label Haiku) - result $partition:Haiku:$label:chain + 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 else debug Stage 2 bootloader and kernel not found: exiting # Begin bundle IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWfqPiDkABK/flAAwVPv//9di Ug+1AIAIAGAHfeF923EpR6Ta7zqV0SkrrVQkpNAp4TU2U2k9JoyB6mTJkYnpNGgAAMlGiehH oPUJMhiDIDRkYgwQGmgcwBGCYgGATBNGQ0MAmCMTCSaop6nqNHpqYTQ9QNNGm1AD1AAAGgIpE0TE ZGiPSNFHqeT1R+kjQeoPUNNHk1D1AIpIAmRoMk2glNtTIjaj0mIAAZHqECiiUgpsuPBrqYIXh8k3 xEYB1K1q2mJ1QRedIDXWTwLWjVwrkTbajH44vn1Hp4sjTa48jwle+L2sMRBA+X7IY1NrBrgqlIb8 2jDNP4bDy9HWBr/Q1e/4OeTI8/6a3PDCx1dGJ6VNL5DHq3VlQ3nBsm9PbDZx7s+Gt6G97mjd7OvR 19tHwDkmmSNmik2kA7Akcw8MSQmF6ReiIXCmm2ZKDinglC3AudVwQNDnl7SUjFgeYegRyE4CQhqH gtP7nJejk+6uCwrEGmHi0NoJZpt3oC3WhK7dNPMSJiLxVTNxmExk5vX7sxiSghaBtk7RsVXW225g DCoUGPZXslPcDNTIV/omGoT2HI6xPSyegBohgAkPvkAdjaXTSkBAaFr+eu0kW0LWH0vpoMGkDKOw gbpED3vtrGXsHZkeDli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