Automate the build of grub.conf based on probe data. In this case, we take the results from three probes, serial-console-speed, grub-serial-order, and current-kernel to fill in a few variables. In addition, we want at least two entries set up for the kernel: a multiuser and a single user option.

# grub.conf generated by Bcfg2
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,0)
#          kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00
#          initrd /initrd-version.img
serial --unit=0 --speed=${metadata.Probes['serial-console-speed']}
terminal --timeout=5 ${metadata.Probes['grub-serial-order']}

{% for kernbootoption in ["", "single"] %}\
title Red Hat Enterprise Linux Server (${metadata.Probes['current-kernel']})) ${kernbootoption}
        root (hd0,0)
        kernel /vmlinuz-${metadata.Probes['current-kernel']} ro root=/dev/VolGroup00/LogVol00 console=ttyS0,${metadata.Probes['serial-console-speed']}n8 console=tty0 rhgb quiet ${kernbootoption}
        initrd /initrd-${metadata.Probes['current-kernel']}.img
{% end %}\

Previous topic


Next topic


This Page