Koozali.org: home of the SME Server

Adding fragment to /etc/modules.conf

Ian Wells

Adding fragment to /etc/modules.conf
« on: December 22, 2002, 12:57:20 PM »
What is the correct way to add a line into /etc/modules.conf?

I want to add 'alias char-major-89 i2c-dev'

This will be part of a mini HowTo for lm_sensors.

My attempt at this follows, and is based on /etc/e-smith/templates/modules.conf/10parport-aliases [5.6b7]

====
Modify /etc/modules.conf via a template fragment

Make the templates-custom directory.
# mkdir -p /etc/e-smith/templates-custom/etc/modules.conf

Create a new template for i2c, using pico or your favourite editor.
# pico /etc/e-smith/templates-custom/etc/modules.conf/10i2c

{
    foreach my $line
        (
            "alias char-major-89 i2c-dev"
        )
    {
        unless (exists $lines{$line})
        {
            push @lines, $line;
        }
    }
    "";
}

Expand the template.
# /sbin/e-smith/expand-template  /etc/modules.conf
====

Is this the correct way or is there another way?

Ian Wells

Charlie Brady

Re: Adding fragment to /etc/modules.conf
« Reply #1 on: December 23, 2002, 01:25:45 AM »
Ian Wells wrote:
 
> What is the correct way to add a line into /etc/modules.conf?

The developers mailing list (devinfo) is probably a better place to ask that question.

But anyway ...

> Is this the correct way or is there another way?

That's a good way to do it via a template. You could do it without a template using a "test then edit if necessary" in the %post section of your RPM.

Regards

Charlie