[Yum] need a good comparison between yum and rh, current, nrh

Jason L Tibbitts III tibbs at math.uh.edu
Thu Jul 15 17:21:32 UTC 2004


>>>>> "JS" == Jeff Sheltren <sheltren at cs.ucsb.edu> writes:

JS> You can accomplish what you are trying to do (group systems) by
JS> editing the yum anacron file: /etc/cron.daily/yum.cron

Below is a yum.cron I hacked out.  With this I can touch
/etc/yum/groups/blah and yum will keep the packages in the "blah"
group installed (even if I later add packages to the group).  I use
this to maintain classes of systems.  It also bugs me when the kernel
is outdated (which arguably should live in a separate script.)

As an aside, I need to see why -R doesn't accept "0".  I use
/etc/sysconfig/yum to specify parameters like how long to randomly
delay, but hacking is required to prevent "-R 0" from being passed.

Some of this was stolen from previous posts to this list; apologies to
the authors but I've lost track of who they were.

 - J<

#!/bin/sh

SDELAY=5
DELAY=20

[ -f /etc/sysconfig/yum ] && . /etc/sysconfig/yum

SDELAYOPT="-R $SDELAY";
DELAYOPT="-R $DELAY";

if [ "$SDELAY" -eq 0 ]; then
        SDELAYOPT=''
fi
if [ "$DELAY" -eq 0 ]; then
        DELAYOPT=''
fi

SOPTIONS="$SDELAYOPT -e 0 -d 0 -y"
OPTIONS="$DELAYOPT -e 0 -d 0 -y"

if [ -n "$1" ]; then
        SOPTIONS="-y";
        OPTIONS="-y";
fi

if [ -f /var/lock/subsys/yum ]; then
        /usr/bin/yum $SOPTIONS update yum
        /usr/bin/yum $OPTIONS update
        if [ -d /etc/yum/groups ]; then
                cd /etc/yum/groups;
                for i in *; do
                        /usr/bin/yum $OPTIONS groupupdate $i
                done
        fi
        /usr/bin/yum -e 0 -d 0 -y clean
fi

RUNNING_KERNEL=`/bin/uname -r`
RUNNING_KERNEL=${RUNNING_KERNEL%smp}  # Strip trailing "smp"
NEWEST_INSTALLED_KERNEL=`/bin/rpm -q kernel --qf '%{version}-%{release}\n' \
        | sort -g | tail -n 1`
DEFAULT_KERNEL_FILE=`/sbin/grubby --default-kernel`
DEFAULT_KERNEL_FILE=${DEFAULT_KERNEL_FILE%smp}
DEFAULT_KERNEL=`/bin/rpm -qf $DEFAULT_KERNEL_FILE --qf '%{version}-%{release}\n'`
if [ $RUNNING_KERNEL != $NEWEST_INSTALLED_KERNEL ]; then
        echo "Kernel out of date:"
        /bin/hostname;
        echo
        echo "Currently running: $RUNNING_KERNEL"
        echo "Newest installed:  $NEWEST_INSTALLED_KERNEL"
        echo "Current default:   $DEFAULT_KERNEL"
        echo
        echo "Installed kernels:"
        rpm -q kernel
        rpm -q kernel-smp
fi



More information about the Yum mailing list