473,390 Members | 1,361 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,390 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 2643
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.