NIS Boot Parameters

Goal

We want to map the following entry from /etc/bootparams:

www root=server:/export/www/root swap=server:/export/www/swap domain=www.example.com

into the following LDAP entry in Penrose:

dn: cn=www,ou=BootParams,dc=NIS,dc=Example,dc=com
objectClass: device
objectClass: bootableDevice
bootParameter: root=server:/export/www/root
bootParameter: swap=server:/export/www/swap
bootParameter: domain=www.example.com
cn: www

Solution

First we create the source:

<source name="bootparams">

    <connection-name>NIS</connection-name>

    <field name="cn" primaryKey="true"/>
    <field name="bootFile"/>
    <field name="bootParameter"/>

    <parameter>
      <param-name>objectClasses</param-name>
      <param-value>bootableDevice</param-value>
    </parameter>
    <parameter>
      <param-name>base</param-name>
      <param-value>system/bootparams</param-value>
    </parameter>
    <parameter>
      <param-name>scope</param-name>
      <param-value>ONELEVEL</param-value>
    </parameter>

</source>

Then we create the mapping:

<entry dn="cn=...,ou=BootParams,dc=NIS,dc=Example,dc=com">

    <oc>device</oc>
    <oc>bootableDevice</oc>

    <at name="cn" rdn="true">
      <variable>b.cn</variable>
    </at>
    <at name="bootFile">
      <variable>b.bootFile</variable>
    </at>
    <at name="bootParameter">
      <variable>b.bootParameter</variable>
    </at>

    <source name="b">
      <source-name>bootparams</source-name>
      <field name="cn">
        <variable>cn</variable>
      </field>
      <field name="bootFile">
        <variable>bootFile</variable>
      </field>
      <field name="bootParameter">
        <variable>bootParameter</variable>
      </field>
    </source>

</entry>