parsing grub's menu.lst

C

CarlFK

I need some code that will read in grubs menu.lst file, and give me a
list of dicts:

[{'title':'Ubuntu, kernel 2.6.15-23-686',
'root':'(hd0,0)',
'kernel':'/boot/vmlinuz-2.6.15-23-686 root=/dev/hda1 ro quiet splash',
'initrd':'/boot/initrd.img-2.6.15-23-686',
'savedefault':'',
'boot':''},
{'title':....} ]

I am not really sure what the rules are, like does it have to have a
title, and do blank lines mean anything? so 1/2 of what I am looking
for is something that already knows what the rules are.

What I really want to parse is pxelinux.cfg/default file typically
used when pxe booting. which I 'think' is the same format is grub/
menu.lst, and it uses 'label' instead of 'title' which is making me
wonder if I should rely n the rules being the same. For now I am
willing to take that chance.

Carl K
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top