Editing a PIB
Prev | Chapter 6. Scripting | Next

## Editing a PIB

Many scripts place a device in a known state by editing a PIB file and writing it to the device before starting an operation. Program modpib can be used for this purpose. It is safe because only certain values can be changed and, where necessary, certain cross-parameter computations are performed automatically.

    modpib -C 0 -M next -D ${DAK} -N ${NMK} ${PIB}
    if [ ${?} != 0 ]; then
            exit 1
    fi

The example above uses modpib to set the CCo state (`-C`), the MAC address (`-M`), the DAK (`-D`) and the NMK (`-N`) in the defined `PIB` file. Argument `0` means “CCo Auto” and argument `next` increments the MAC address. The DAK and NMK were defined earlier in the script. Symbol PIB must be defined earlier in the script, possibly in firmware.sh.

Program modpib will print an error message and return a non-zero value on error. We test the return value and exit the script on error to avoid subsequent errors. One could, of course, suppress normal output (`-q`) and print your own error message using the Linux `echo` utility.

Prev | Up | Next
Actual Device Identity | Home | Initialize a Device