Interface specification for lilo.conf agent

Author: dan.meszaros dmeszar@suse.cz
Last update: 2001-06-01 13:00:00

I. What is the lilo.conf agent

It is used to access the /etc/lilo.conf file.


II. Syntax of the lilo.conf file

lilo.conf file (see man 5 lilo.conf) is a configuration file for lilo
(see man 8 lilo). It consists of
    a) comments
    b) options
    c) sections


II.1 Comments

Comment lines may appear anywhere, and begin with the "#" character.
eg: # lilo.conf
# last modified: blah

option=value # some description here


II.2 Options

There are three types of options:
    a) boolean
    b) having a value (string, number)
    c) special
The presence of boolean option indicates, that the option has value TRUE.

eg: 
prompt
compact
# the prompt and compact options are set


The options having a value use a form "option=value"
eg: 
vga=normal
root=/dev/hda1

The special option is an option having a deeper structure.
eg: change-rules

change-rules
  reset
  type=DOS12
  normal=1
  hidden=0x11
  type=DOS16_small
  normal=4
  hidden=0x14
  type=DOS16_big
  normal=0x06
  hidden=0x16

The global options appear in the beginning of the lilo.conf file,
the sections follow them.


II.3 Sections

Sections start with an identifier of the section and follow with the options
specific for the given section. eg: image=/boot/zImage-1.0.9

# first "image" sections
    image=/tamu/vmlinuz
	label=tamu
	root=/dev/hdb2
        vga=ask

# second "image" sections
    image=/boot/vmlinuz-2.4
    label=2.4

III. Interface for lilo.conf agent


III.1 Reading

Read(.lilo)				rereads the file, thus discards
					changes made using Write(...)
Read(.lilo.comment)			trailing comment
					for lilo.file
Read(.lilo.optname)			returns value of global variable 'optname'
Read(.lilo.optname.comment)		returns contents of comment for option 'optname'
Read(.lilo.image)			returns list of 'image' sections
Read(.lilo.other)			returns list of 'other' sections
Read(.lilo.sections.vmlinuz)		returns list of all options in section 'vmlinuz'
Read(.lilo.sections.vmlinuz.image.comment)  returns comment for image section 'vmlinuz'
Read(.lilo.sections.windows.other.comment)  returns comment for other section 'windows'
Read(.lilo.image.vmlinuz.label)		returns value of option 'label' in the image 
					section 'vmlinuz'
Read(.lilo.sections.vmlinuz.label.comment) returns value of comment for option 'label' 
					in the image section 'vmlinuz'


III.2 Writing

Write(.lilo, nil)			writes the file to disk
Write(.lilo.comment, "# com")		trailing comment for lilo.file
Write(.lilo.optname, value)		writes value of global variable 'optname'
Write(.lilo.optname.comment, "# com")	writes comment for option 'optname'
Write(.lilo.optname, nil)		discards the option 
Write(.lilo.image.label, "label", "vava") if section with name 'vava' didn't exist, 
					it is created and value for 'label' is set
Write(.lilo.sections.vmlinuz, nil)		discards the section 'vmlinuz'
Write(.lilo.sections.vmlinuz.comment, "# com")writes comment for image section 'vmlinuz'
Write(.lilo.sections.vmlinuz.label, value)	sets value of option 'label' in the image section 'vmlinuz'
Write(.lilo.sections.vmlinuz.label.comment, "# com") sets value of comment for option 'label' 
					in the image section 'vmlinuz'


III.3 Dir

Dir(.lilo)				list od all globa variables. if
					there is at least one image/other section, list 
					also contains item 'image'/"other"
Dir(.lilo.sections)			list of image sections
Dir(.lilo.sections.vmlinuz)		list of options in given image


III.4 Execute

Execute(.lilo, params)			tes /sbin/lilo.
since /sbin/lilo is launched while Write(.lilo, nil) this is only
for special purpose.


III.5 Other

Bahaviour of other commands is not defined.


IV.1 Appendix A: global options

Boolean:
    compact .lilo.compact
    fix-table .lilo.fix_table
    ignore-table .lilo.ignore_table
    lba32 .lilo.lba32
    linear .lilo.linear
    lock .lilo.lock
    nowarn .lilo.nowarn
    optional .lilo.optional
    prompt .lilo.prompt
    read-only .lilo.read-only
    restricted .lilo.restricted

String:
    backup .lilo.backup
    boot .lilo.boot
    default .lilo.default
    disktab .lilo.disktab
    force-backup .lilo.force_backup
    install .lilo.install
    map .lilo.map
    menu-title .lilo.menu_title
    menu-scheme .lilo.menu_scheme
    message .lilo.message
    password .lilo.password
    serial .lilo.serial
   
Integer:
    delay .lilo.delay
    timeout .lilo.timeout
    verbose .lilo.verbose

Special:
    change-rules .lilo.change_rules
    disk .lilo.disk


IV.2 Appendix B: image section variables

boolean options:
    read-only .lilo.image.read_only,  section_name
    read-write .lilo.image.read_write,  section_name

string options:
    append .lilo.sections._.append, section_name
    initrd .lilo.sections._.initrd, section_name
    literal .lilo.sections._.literal, section_name
    amdisk .lilo.sections._.ramdisk, section_name
    root .lilo.sections._.root, section_name
    vga .lilo.sections._.vga, section_name


IV.3 Appendix B: other section variables

boolean options:
    unsafe .lilo.sections._.unsafe

string options:
    loader .lilo.sections._.loader
    table .lilo.sections._.table

special options:
    change .lilo.sections._.change
    map-drive .lilo.sections._.map_drive


IV.4 Appendix B: common image and other section variables

boolean options:
    lock .lilo.sections.lock
    optional .lilo.sections._.optional
    restricted .lilo.sections._.restricted

string options:
    label .lilo.sections._.label
    alias .lilo.sections._.alias
    password .lilo.sections._.password


V. Notes
[x] - The written file should use indentation

[ ]- The representation of the file must have a time-stamp of the original file
and each option and section must have a "dirty" flag---a flag which says if
it was changed by the agent interface.
If the file changes on the disk, the lilo.conf agent must try to re-read
the data which has changed on the disk but was not changed using the
agent interface (to keep the newest poassible version).
The conflict must be logged.
[x]- The order of the options and sections must be the same as it was in the
original file.

Example
-------
This file (from man 5 lilo.conf)

# lilo.conf
#
# global options:
boot=/dev/hda
prompt
timeout=150
lba32
compact
vga=normal
root=/dev/hda1
read-only
menu-title=" John's Computer "
#
# bootable kernel images:
image=/boot/zImage-1.5.99
label=try
image=/boot/zImage-1.0.9
label=1.0.9
image=/tamu/vmlinuz
label=tamu
root=/dev/hdb2
vga=ask
#
# other operating systems:
other=/dev/hda3
label=dos
other=/dev/hdb5
label=os2
loader=/boot/os2_d.b
table=E:

will be written by the following SCR calls:

// The comment for the file
Write(.lilo.comment, "# lilo.conf\n#\n# global options:");

// The global options
// boolean
Write(.lilo.prompt, true);
Write(.lilo.lba32, true);
Write(.lilo.compact, true);
Write(.lilo.read_only, true);
// string
Write(.lilo.boot, "/dev/hda");
Write(.lilo.vga, "normal");
Write(.lilo.root, "/dev/hda1");
Write(.lilo.menu_title, " John's Computer "
// integer
Write(.lilo.timeout, 150);

// The images sections
Write(.lilo.image.label, "try", "/boot/zImage-1.5.99");
Write(.lilo.image.comment, "#\n# bootable kernel images:", "/boot/zImage-1.5.99");

Write(.lilo.image.label, "1.0.9", "/boot/zImage-1.0.9");

Write(.lilo.image.label, "tamu", "/tamu/vmlinuz");
Write(.lilo.image.root, "/dev/hdb2", "/tamu/vmlinuz");
Write(.lilo.image.vga, "ask", "/tamu/vmlinuz");

// Other sections
Write(.lilo.other.label, "dos", "/dev/hda3");

Write(.lilo.other.label, "os2", "/dev/hdb5");
Write(.lilo.other.loader, "/boot/os2_d.b", "/dev/hdb5");
Write(.lilo.other.table, "E:", "/dev/hdb5");

Just for case:

Dir(.lilo)
--> [ "prompt", "lba32", "compact", "read_only", "boot", "vga",
"root", "menu_title", "timeout", "image", "other"]

Read(.lilo.image) or Dir(.lilo.image)
--> [ "/boot/zImage-1.5.99", "/boot/zImage-1.0.9", "/tamu/vmlinuz" ]

Read(.lilo.image, "/tamu/vmlinuz")
--> [ "label", "root", "vga" ]

Example 2
---------

This

change-rules
reset
type=DOS12
normal=1
hidden=0x11
type=DOS16_small
normal=4
hidden=0x14
type=DOS16_big
normal=0x06
hidden=0x16

can be written using

Write(.lilo.change_rules, [ "reset", "type=DOS12", "normal=1",
"hidden=0x11", "type=DOS16_small", "normal=4",
"hidden=0x14", "type=DOS16_big", "normal=0x06",
"hidden=0x16" ])
 

Bibliography

[1] man lilo.conf
[2] man lilo