[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Automatically using the right kmdl module with the newest kernel

On Sat, Apr 14, 2007 at 09:28:19AM -0400, Jason Edgecombe wrote:
> Hi,
> I'm doing kickstarts in RHEL5. I have extra repo statements in the 
> kickstart file that point to an updates repo which has RedHat updates 
> including the kernel. I also have a repo with extras like the openafs 
> rpms from atrpms.net.
> How can I have the install automatically pick the right openafs-kmdl rpm 
> to go with the kernel.  Yum can do it if I use the yum-plugin-kdml rpm. 
> Is there any way to activate yum-plugin-kmdl during the install or some 
> other way to pick the right kdml to go with the latest kernel. I would 
> prefer to now have to hard-code the kmdl rpm version in the kickstart file.
> What are my options besides hard-coding the kmdl rpm version or running 
> yum in %post?

You will have to do it in %post. What I do is the following (this is a
script that is called by %post as well as stand alone):


kernels=`rpm -qf /boot/vmlinuz-* | grep -v "^file .* is not owned by any package"`
uname_rs=`rpm -ql $kernels | grep ^/boot/vmlinuz- | sed -e's,^/boot/vmlinuz-\(.*\)$,\1,'`


if [ -f $installtree/$packagelist ]; then
    echo === `date`  kmdls
    for kmdl in `cat $installtree/$packagelist | sed -e's,#.*,,' | grep -- -kmdl`; do
        for uname_r in $uname_rs; do
            echo $package
            rpm -q $package > /dev/null || smartdo install $package
    echo === `date`  non-kmdls
    for package in `cat $installtree/$packagelist | sed -e's,#.*,,' | grep -v -- -kmdl`; do
        rpm -q $package > /dev/null || smartdo install $package

variables are set beforehand to point to proper NFS
locations. $installtree/$packagelist contains a package list for this
host, where kmdls are simply listed as "foo-kmdl". smartdo is a bash
function that feeds smart with packages this host needs to install,
but you could use yum shell instead as well. For reference here is
what it does:

smartdo () {
  verbout smart cmd: "$@"
  echo -e "$@" >&7
  echo "" >&7

fd 7 is either a pipe to smart's shell, or a simple file that is piped
into smart at the end of the kickstart's %post.

So at the end of the day the above will ensure that all kmdls of "foo"
have been installed for all kernels, be it the standard kernel, smp,
xen flavours, many different kernel versions or a mix.
Axel.Thimm at ATrpms.net

Attachment: pgpuECe3AuNSR.pgp
Description: PGP signature

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]