S98yum

Synopsys


#
# Configure yum to use a local repository
#

Script


echo "%Post: Configuring yum to use local respository"

# We need an rsync that pulls down the fedora updates to a local repo

SRV=`host -t SRV _tsltd._fcupdates._tcp.$DOMAINNAME | grep $NODENAME`

if [ "$OS" == "fc4" ]; then
    UPDATESRV=`echo $SRV | cut -d" " -f8 | cut -d"." -f1`
else
    UPDATESRV=`echo $SRV | cut -d" " -f6 | cut -d"." -f1`
fi

if [ "$NODENAME" == "$UPDATESRV" ]; then
    echo > /etc/cron.daily/fedora-updates <<EOF
#!/bin/sh
# Rsync fedora updates

rsync -auv --delete --exclude 'debug/*' rsync://rsync.mirrorservice.org/download.fedora.redhat.com/pub/fedora/linux/core/updates/4/i386/ /export/OS/fedora/4/updates/4/i386/
rsync -auv --delete --exclude 'debug/*' rsync://rsync.mirrorservice.org/download.fedora.redhat.com/pub/fedora/linux/core/updates/4/x86_64/ /export/OS/fedora64/4/updates/4/x86_64/
rsync -auv --delete --exclude 'debug/*' rsync://rsync.mirrorservice.org/download.fedora.redhat.com/pub/fedora/linux/core/updates/3/i386/ /export/OS/fedora/3/updates/3/i386/
EOF
fi

# Configure all machines to pull thier updates from the update server
# using the /net automount

if [ "$OS" == "fc4" ]; then

if [ `uname -p` == "x86_64" ]; then
    $arch=fedora64
else
    $arch=fedora
fi

mv /etc/yum.repos.d/fedora-updates.repo /etc/yum.repos.d/fedora-updates.repo-$VERSION
cat > /etc/yum.repos.d/fedora-updates.repo <<EOF
[updates-released]
name=Fedora Core \$releasever - \$basearch - Released Updates
baseurl=file:///net/updates/export/OS/$arch/current/updates/\$releasever/\$basearch/
enabled=1
gpgcheck=1
EOF

# the gpgcheck means that we *MUST* install the fedora GPG key before running
# any updates
rpm --import /usr/share/doc/fedora-release-$RELEASE/RPM-GPG-KEY-fedora

fi

Examples and Testing


# updates are installed using
# yum [-y] upgrade
# (-y	answer all questions with yes)
#
# Must add "updates" as a CNAME to the machine that contains the updates



Marked up in XHTML - ©2005 Thoughtful Solutions Ltd.