From Fedora Project Wiki

rpmupdates

The rpmupdates script is a small bash program that updates the RPMs in you tree. Put your updated RPMs in new/new/. This script will compare them to the RPMs in i386/Fedora/RPMS/. If the RPMs in new/new/ are newer, this script will move the old RPMs to olddir/, and copy the new RPMs to i386/Fedora/RPMS/ and new/done. If they are not newer, it will move them to new/ and give a warning message. I have seen several perl programs that do the same thing, but I would really like to see a python program that could be included with anaconda.

Move the rpmupdates script to /fedora (or /dvd), and run it from that directory.

diff -urN anaconda-9.2/scripts/rpmupdates anaconda-9.2.new/scripts/rpmupdates
--- anaconda-9.2/scripts/rpmupdates   1969-12-31 16:00:00.000000000 -0800
+++ anaconda-9.2.new/scripts/rpmupdates   2003-01-22 16:21:22.000000000 -0800
@@ -0,0 +1,85 @@
+#!/bin/bash
+#
+# UPDATES_DIR   The directory that contains the updates
+# RPM1DIR   The original RH tree
+# RPM2DIR   Disc 2 of the tree
+# ARCH      Arch
+# EXTRA_DIR   The directory that contains extra RPMS
+# OLDDIR   All old rpms will be dumped here
+
+RPM1DIR=i386/Fedora/RPMS
+UPDATES_DIR=new/new
+OLDDIR=olddir
+DONE_DIR=new/done
+EXTRA_DIR=extra
+# DEBUG=0
+
+    echo NOTICE: beginning to apply updated packages to ${RPM1DIR}
+    echo NOTICE: from ${UPDATES_DIR}  ### and ${EXTRA_DIR}
+    echo NOTICE: this may take a few minutes
+    echo
+
+    if [<nop>[ ! -d <nop>$OLDDIR ] <nop>  ; then
+            echo making directory $OLDDIR
+            mkdir $OLDDIR
+    fi
+
+    if [<nop>[ $DEBUG ] <nop> 
+    then
+   echo 'in update_cd'
+   echo PWD = <code>pwd</code>
+   echo RPM1DIR=$RPM1DIR
+   echo ARCH=$ARCH
+   echo UPDATES_DIR=$UPDATES_DIR
+   echo
+    fi
+    allow_null_glob_expansion=1
+
+#    for rpm in ${UPDATES_DIR}/*.rpm ${EXTRA_DIR}/*.rpm  ; do
+    for rpm in ${UPDATES_DIR}/*.rpm; do
+   RPMDIR=${RPM1DIR}
+#    NAME=<code>rpm --qf '%{NAME}' -qp $rpm --nosignature --nodigest</code> for BETAs (4x)
+        NAME=<code>rpm --qf '%{NAME}' -qp $rpm</code>
+        ARCH=<code>rpm --qf '%{ARCH}' -qp $rpm</code>
+        unset OLDNAME
+        for oldrpm in ${RPM1DIR}/${NAME}*.${ARCH}.rpm ; do
+            if [<nop>[ x<code>rpm --qf '%{NAME}' -qp $oldrpm</code> = x$NAME ] <nop> ; then
+               if [<nop>[ x<code>rpm --qf '%{ARCH}' -qp $oldrpm</code> = x$ARCH ] <nop> ; then
+                   OLDNAME=$oldrpm
+         RPMDIR=${RPM1DIR}
+                   break
+      fi
+            fi
+        done
+
+   if [<nop>[ ! -d $DONE_DIR ] <nop> ;then
+      echo Making $DONE_DIR
+      mkdir $DONE_DIR
+   fi
+
+        if [<nop>[ -z $OLDNAME ] <nop> ; then
+            echo $NAME $ARCH is new
+            cp -pv $rpm $RPMDIR
+       mv $rpm $DONE_DIR
+        else
+            if [<nop>[ x<code>basename $rpm</code> != x<code>basename $OLDNAME</code> ] <nop> 
+       then
+      if [<nop>[ $DEBUG ] <nop> 
+          then
+              echo mv $OLDNAME $OLDDIR
+                   echo cp -pv $rpm $RPMDIR
+         echo mv $rpm $DONE_DIR
+          else
+                   mv $OLDNAME $OLDDIR
+                   #echo removing $OLDNAME
+                   #rm $OLDNAME
+                   cp -pv $rpm $RPMDIR
+         mv $rpm $DONE_DIR
+      fi
+            else
+           echo NOTICE:    <code>basename $rpm</code> update already applied
+      echo NOTICE:   Now moving <code>basename $rpm</code> to new/
+      mv $rpm new
+            fi
+        fi
+    done