rh-errata - download updates for RH Linux from an FTP site

Description:

This program is used to get update and errata files from an ftp site (presumably a mirror of Red Hat's own site). The program has a number of useful features including:

While this program was designed to support Red Hat Linux, it will probably work on any system that is RPM based. Note that this program requires rpm version 3.0 or later.

NOTE: You must be the superuser to run this script since you will likely want to download the RPM files into a directory that is not world writable (such as /usr/local/lib).

Usage:

        rh-errata -v version [-i] [-d dir] [-n attempts] [-k kernel] [-m user]
        rh-errata -v version -r [-d dir] [-m user]
        rh-errata -v version -c [-d dir] [-m user]
        rh-errata -h | --help

Options:

        -v version      Get updates for "version".
        -i              Intelligent mode.  In this mode, rh-errata
                        will only download the newest versions of the 
                        packages that are installed on the machine
                        performing the download.  This mode also sets
                        the kernel architecture automatically overiding
                        the -k option.  Use intelligent mode if you are
                        only maintaining a single machine.
        -d dir          Set root directory for download to "dir" rather than
                        the default /usr/local/lib
        -n attempts     Set number of download attempts.  This will cause
                        rh-errata to make a download attempt, wait sixty
                        seconds and try again for the specified number of
                        attempts (default is one attempt).  This feature is
                        useful for busy FTP sites.
        -k kernel       Kernel architecture
        -m user         Mail results to "user".
        -r              Report which updates need to be applied rather than
                        retrieving files.
        -c              Cleans the repository of obsolete and corrupt
                        packages.
        -h, --help      Display this help message and exit.

Examples:

        rh-errata -v 7.2

Retrieve all RPM files for version 7.2 that have not already been downloaded. Use this method if you wish to maintain a complete mirror of updates. Note that constucting a complete mirror the first time may take a very, very long time if you have a slow connection. If the incoming directory /usr/local/lib/RH7.2-errata does not exist, the user will be prompted to create it.

        rh-errata -v 7.2 -n 50

Like above, except rh-errata will make 50 attempts at downloading before giving up with an error.

        rh-errata -v 6.2 -i

Retrieve RPM files for version 6.2 using "intelligent mode". In this mode, rh-errata will only download packages that are installed on the machine running rh-errata. Intelligent mode will attempt (in a rudimentrary way) to only download the newest version of each package.

Intelligent mode also sets the kernel architecture (overriding the -k option) automatically from the value returned from the "arch" command. Use intelligent mode only if you are maintaining a single machine. If the incoming directory /usr/local/lib/RH6.2-errata does not exist, the user will be prompted to create it.

        rh-errata -v 6.2 -k i586

Retrieve RPM files for version 6.2. In addition, retrieve any files that are specific to the i586 architecture such as kernel files. Note that the -k option will only succeed on Red Hat versions 6.0 or later.

        rh-errata -v 7.2 -r -m root

Check which files in the 7.2 directory need to be installed and mail the report to the superuser. If the incoming directory /usr/local/lib/RH7.2-errata does not exist, the script will terminate with an error.

        rh-errata -v 6.2 -c

The "-c" option performs just like the "-r" option except that any package that is obsolete (meaning that there is newer package already installed) or corrupt (meaning that it fails the md5 checksum test) is deleted from the respository. This option is useful for cleaning out old items in the respository that build up over time.

        rh-errata -v 6.0 -d $HOME/rpms

Retrieve RPM files for version 6.0 and place them in $HOME/rpms/RH6.0-errata rather than the default directory /usr/local/lib/RH6.0-errata. If the directory $HOME/rpms does not exist, the script will terminate with an error.

Typical Use:

I suggest that you use rh-errata in a cron script as follows:

        rh-errata -v 7.2
        rh-errata -v 7.2 -r -m root

The first invocation performs the file retrieval, the second produces a status report and mails it to the superuser. The -i option could be added to the first line to reduce the number of files maintained in the respository.

Installation:

rh-errata is fully self-contained. To install, just copy the rh-errata script into the directory of your choice. /usr/local/bin or /usr/local/sbin would be good.

Note that it may be necessary to change the FTP site specified by the HOST and TARGET constants in the retrieve_files function. For a list of Red Hat mirror sites see: http://www.redhat.com/download/mirror.html

Tested With:

rh-errata is known to work with Red Hat Linux 6.2, 7.0 and 7.2 Note that rh-errata requires rpm version 3.0 or greater which is newer than the version originally shipped with RH Linux v5.x.

Copyright:

Copyright 2000-2002, William Shotts, Jr. <bshotts@users.sourceforge.net>

This software is part of the LinuxCommand.org project, a site for Linux education and advocacy devoted to helping users of legacy operating systems migrate into the future.

You may contact the LinuxCommand.org project at:

        http://www.linuxcommand.org

License:

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

$Id: rh-errata.README,v 1.8 2002/07/28 12:50:08 bshotts Exp $