On Fri, Jun 19, 2015 at 01:53:13PM +0300, Nikos Skalkotos wrote:
Hello,
I was looking for a way to detect the installed boot loader of an image and I found this: https://github.com/arvidjaar/bootinfoscript This script will inspection a lot of things on a running system and will output a Report. The most interesting part is that it uses known Master and Volume Boot Record byte-patterns to determine the installed boot loader: https://github.com/arvidjaar/bootinfoscript/blob/master/bootinfoscript#L2983... https://github.com/arvidjaar/bootinfoscript/blob/master/bootinfoscript#L2343...
Those signatures (byte patterns) are from real mode machine code but this code is not generated by a compiler and does not change often.
I’ve isolated and simplified the signatures database here:
https://github.com/skalkoto/snf-image-creator/blob/develop/image_creator/boo...
and I was wondering if you care to add 2 new libguestfs API methods e.g.:
char * guestfs_inspect_get_mbr_bootloader(guestfs *g) char * guestfs_inspect_get_vbr_bootloader(guests *g, char *device)
What is 'vbr'?
that would return a string like “grub2”, “syslinux”, “windows”, etc. I can write the code.
What do you think?
I wonder if an easier and more general path here is to add the advanced detection signatures to 'file'. At the moment when you run 'file' on a hard drive it does some sort of detection like this: # file -bsL /dev/sdb DOS/MBR boot sector; partition 1 : ID=0x83, start-CHS (0x0,32,33), end-CHS (0xce,29,63), startsector 2048, 250067632 sectors, extended partition table (last) Adding it to file means it will be available in libguestfs automatically (via 'guestfs_file' API), and means it would be generally useful to other people as well. However I'm not opposed to adding it to libguestfs if for some reason it's not possible to add this to file. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top