Next Previous Contents

43. Automated RPM notifiers

The tool "rpmwatch" creates reports based on Redhat's WWW site. As you might notice, this is only for Redhat and its RPMs. In addition to this, it does NOT work on Redhat's newer WWW pages nor sites for Mandrake, etc. Because of this, I have started implementing "AutoRPM" as shown below.

43.1 AutoRPM (the preferred solution):

- Download AutoRPM and the Perl "libnet" library from the URLs in Section 5

- Uncompress AutoROM some temporary place like /usr/src/archive/rpm-tools/


                        tar xzvf autorpm-*.tar.gz /usr/src/archive/rpm-tools

- The LibNet module is a commonly installed tool with Perl. To verify that its already installed, run:


                                find /usr/lib/perl5/ | grep FTP.pm

if nothing shows up, LibNet isn't installed

- If it isn't installed, uncompress the LibNet library to a place like


                          /usr/src/archive/cpan

                                tar xzvf libnet-*.tar.gz

- Next, got into the new libnet directory, compile, and install it:


                                cd /usr/src/archive/cpan/libnet-*
                                perl Makefile.PL
                                make
                                make test
                                make install

- Next, go into the new AutoRPM directory


                        cd /usr/src/archive/rpm-tools/autorpm-*

- Create its configuration directories


                        mkdir /etc/autorpm.d
                        mkdir /etc/autorpm.d/pools

- Copy over the program, the configuation files, and the man pages


                        cp autorpm.pl /usr/local/sbin
                        cp autorpm.conf /etc/autorpm.d
                        cp autorpm.d/* /etc/autorpm.d
                        cp pools/* /etc/autorpm.d/pools
                        cp autorpm.8 /usr/local/man/man8
                        cp autorpm.conf.5 /usr/local/man/man5

- Fix its permissions:


                        chmod 700 /etc/autorpm.d /etc/autorpm.d/pools
                        chmod 700 /usr/local/sbin/autorpm.pl

- Next, test it:

Mandrake 6.1 users:


                                /usr/local/sbin/autorpm.pl --ftp ftp.linux-mandrake.com:/pub/updates/6.1/RPMS/

Redhat 6.1 users:


                                /usr/local/sbin/autorpm.pl --ftp updates.redhat.com:/<url url="ftp:/6.1/i386/">

If that test works ok, time to tune your /etc/autorpm.d/setup:

Mandrake 6.1 users: -------------------

- Find the following lines in /etc/autorpm.d/autorpm.conf


                        /etc/autorpm.d/autorpm.conf
                        --
                        Config_File("/etc/autorpm.d/redhat-updates");
                        --

to
                        --
                        Config_File("/etc/autorpm.d/mandrake-updates");
                        --

- Create the file /etc/autorpm.d/pools/mandrake-updates . In this file, put at LEAST the following line on the top. If you want, you can add other Mandrake mirror URLs in this file as well. I have listed (2) others for an example:


                        /etc/autorpm.d/pools/mandrake-updates 
                        --
                        ftp.linux-mandrake.com:/pub/updates/6.1/RPMS
                        rpmfind.net:/linux/Mandrake/updates/6.1/RPMS
                        ftp.orst.edu:/pub/packages/linux/mandrake/updates/6.1/RPMS
                        --

- Next, create the following file. Edit as you deem fit. Please note that I'm still in the process of learning and tuning this tool, if you have comments, etc, please let me know.

/etc/autorpm.d/mandrake-updates


--
##########################################################
# This one will mirror the updates for all versions
# of Red Hat 5.0, but won't bother with the source RPMs.
# All the updates stored locally will be in architecture-
# specific directories just like on the original site.

ftppool ("mandrake-updates") {

   # Recurse through the remote FTP site if necessary
   # Recursive (Yes);

   # Compare, recursively, the remote files to this directory
   # Recursive_Compare_To_Dir ("/usr/src/archive/md61-updates");

   # Ignore any directories named 'SRPMS' when recursing.
   # Regex_Dir_Ignore ("SRPMS");

   # What to do if the remote RPM is a newer version
   # that the local copy
   action (updated) {

      # Delete whatever local file we had that was older
      # than the remote file.
      # Delete_Old_Version (Yes);

      # Store the remote file in this local directory.
      # the 'Recursive' part means that if the remote
      # file was in the /i386/ subdirectory, it will be
      # stored in a /i386/ directory locally.
      # Recursive_Store ("/usr/src/archive/md61-updates");
          Install (Interactive);
          Report (Yes);
          Report_Queues_To ("root");
          Report_To ("root");
          Report_All (Yes);
            Display_Report (Yes);
   }

   # What to do if the remote RPM has no corresponding
   # version locally (e.g. it is new)
   action (new) {
          Install (Interactive);
          Report (Yes);
          Report_Queues_To ("root");
          Report_To ("root");
          Report_All (Yes);
          Display_Report (Yes);
    #  Store_Recursive ("/usr/src/archive/md61-updates");
   }
}
--

Once you are happy with how AutoRPM runs, I recommend have it run ONCE A DAY. To do this, do the following:


        ln -s /usr/local/sbin/autorpm.pl /etc/cron.daily/autorpm

Finally, I recommend to read the "autorpm" man page and pay attention to the "auto-ignore" file. There is a lot of other interesting info in the man page so I recommend that you read it. Its well written too!

43.2 rpmwatch

Download at RPM Watch from Section 5


                rpm -Uvh rpmwatch-x.x-x.noarch.rpm

Create the file "run-rpmwatch" with the following contents:

NOTE: You need to edit the scripts to reflect your Redhat distribution installation. If you don't change the script to look to the proper URLs, your results will be worthless. On that same token, I request all the patches out there for ALL Redhat distributions though I only run 5.0. While this lets me know whats out there, some of the updated tools in 5.2 will NOT work correctly on 5.0 distributions. So, be careful and be SURE to read the "Testing RPMs before installing" at the top of Section 54 to see what files might be overwritten, etc.

/usr/local/sbin/run-rpmwatch


--
#!/bin/sh

# Version v1.2  

echo "Getting RH50 errata.."
lynx -source <url url="http://www.redhat.com/corp/support/errata/rh50-errata-general.html"> > /tmp/rh50-errata-general.html
lynx -source <url url="http://www.redhat.com/corp/support/errata/intel/rh50-errata-intel.html"> > /tmp/rh50-errata-intel.html
                
echo "Getting RH51 errata.."
lynx -source <url url="http://www.redhat.com/corp/support/errata/rh51-errata-general.html"> > /tmp/rh51-errata-general.html
lynx -source <url url="http://www.redhat.com/corp/support/errata/intel/rh51-errata-intel.html"> > /tmp/rh51-errata-intel.html

echo "Getting RH52 errata.."
lynx -source <url url="http://www.redhat.com/corp/support/errata/rh52-errata-general.html"> > /tmp/rh52-errata-general.html
lynx -source <url url="http://www.redhat.com/corp/support/errata/intel/rh52-errata-intel.html"> > /tmp/rh52-errata-intel.html

echo "Converting to TXT..."
href2txt /tmp/rh5*-errata-*.html > /tmp/rh-errata.txt

rm -f /tmp/rh5*-errata*.html

echo "Running rpmwatch.."
rpmwatch -e /tmp/rh-errata.txt

echo -e "\n\nA good site to get all Errata RPMS is:"
echo "<url url="ftp://ftp.codemeta.com/pub/mirrors/redhat/updates/"">;

rm -f rh-errata.txt

echo -e "\nDone.."
--

- Now, make "run-rpmwatch" executable by running "chmod 700 rpm-watch"

- Run it by typing in "./run-rpmwatch"

The output should look something like:


                [root@roadrunner tools]# ./run-rpmwatch 
                Getting RH50 errata..
                Converting to TXT...
                Running rpmwatch..

                .       <skipping misc text>

                FL RPM                               VERSION BUILD             UPDATE
                ----------------------------------------------------------------------
                   samba                           1.9.18p10     5                 ok
                   rpm                                 2.5.3   5.0                 ok
                   rpm-devel                           2.5.3   5.0                 ok
                 B bash                               1.14.7     6          1.14.7-11

*** NOTE: please see the bottom of this section on adding this script to a weekly CRON process!

* Regardless of the tool that you use, I'd recommend that you add it CRON to be executed once a week. Since RPMWATCH is the only tool currently running, I'll use that for an example:

Slackware:

Edit the file /var/spool/cron/crontabs/root and append the following:


                        --
                        # Run the sendlogs program at 12:00am everyday
                        02 2 * * 0 /usr/local/sbin/run-rpmwatch

Redhat users:

Create a symbolic link to point to the run-rpmwatch script:


                                ln -s /usr/local/sbin/run-rpmwatch /etc/cron.weekly

- That's it. Now, make cron re-read it's config files by doing:


Next Previous Contents