473,326 Members | 2,255 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

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
1 2642
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Chris | last post by:
I've added a configuration file similar to Web.config but that does not invoke a restart when changed, just a cache dependency. At various times I'm getting a seeingly random one of the following...
3
by: dadapeer | last post by:
hai In my computer i am having dual boot operating system one is winxpsp2 another one is linux red hat 3 i removed the the redhat partition (deleated). arter i rebooted the system system is...
0
kestrel
by: kestrel | last post by:
I just installed Ubuntu 7.04 on my computer today. I have both Ubuntu and Windows on my computer. It worked fine for a while, both Ubuntu and Windows booted properly. But i went to go use Windows,...
6
AmberJain
by: AmberJain | last post by:
Well, I installed Red hat linux a few days ago and recently I tried to repair my XP installation on same machine. It displayed the following message when I expected it to repair my XP-"Setup is...
1
by: sasimca007 | last post by:
Hello friends, At first, I installed windows-xp and after ubuntu. My windows-xp has encountered a problem that registry files are corrupted, then i re-installed windows-xp....
11
AmberJain
by: AmberJain | last post by:
Hello, From many few days whenever I tried installing Xubuntu on my PC, I failed as Xubuntu installer simply couldnot startup. Whenever I booted from Xubuntu Cd both Live CD and Xubuntu...
1
by: gaurav92K | last post by:
sir , please tell me what is the greate difference in lilo & grub boot loader. please tell me.
0
by: CarlFK | last post by:
I need some code that will read in grubs menu.lst file, and give me a list of dicts: I am not really sure what the rules are, like does it have to have a title, and do blank lines mean...
3
by: P4ZP47Z | last post by:
Here is my situation: - My windows install/apps/games were eaten by a virus that replicates into and wrecks .exe files - I made an Ubuntu 9.10 CD on my friends pc, and a Xubuntu 9.10 DVD...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.