467,893 Members | 1,905 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,893 developers. It's quick & easy.

Re: parsing grub's menu.lst

On Mon, 2008-11-17 at 10:27 -0800, CarlFK wrote:
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.
Why take a chance when you can get it right the first time? There is
documentation on the syslinux config formats at their web site
(http://syslinux.zytor.com/).

Nov 17 '08 #1
  • viewed: 2420
Share:
1 Reply
On Nov 17, 12:56*pm, Albert Hopkins <mar...@python.invalidwrote:
On Mon, 2008-11-17 at 10:27 -0800, CarlFK wrote:
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.

Why take a chance when you can get it right the first time? *There is
documentation on the syslinux config formats at their web site
(http://syslinux.zytor.com/).
Um... I poked around, best I could find was:
http://syslinux.zytor.com/wiki/index...re_SYSLINUX.3F

Which explains what each option does, but not how they are grouped.

Carl K
Nov 18 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Chris | last post: by
3 posts views Thread by dadapeer | last post: by
AmberJain
6 posts views Thread by AmberJain | last post: by
1 post views Thread by sasimca007 | last post: by
AmberJain
11 posts views Thread by AmberJain | last post: by
reply views Thread by CarlFK | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.