http://archive.linux.or.jp/JF/JFdocs/RedHat-CD-HOWTO-5.html
cat updateCD.sh #! /bin/bash # This script updates rpms in a RedHat distribution found in $RPMDIR. # The old rpms will be placed in $OLDDIR. # The new rpms should be located in $UPDDIR. # The architechture is $ARCH. #RHVERSION=5.2 ARCH=i386 #CDDIR=/jaz/redhat-${RHVERSION} UPDDIR=/inst/ftp.miraclelinux.com/pub/Miracle/ia32/standard/2.1/updates/RPMS RPMDIR=/tmp/newMiracleRPM OLDDIR=/tmp/oldMiracleRPM if [ ! -d $OLDDIR ] ; then echo making directory $OLDDIR mkdir $OLDDIR fi allow_null_glob_expansion=1 for rpm in ${UPDDIR}/*.rpm ; do NAME=`rpm --queryformat "%{NAME}" -qp $rpm` unset OLDNAME for oldrpm in ${RPMDIR}/${NAME}*.rpm ; do if [ `rpm --queryformat "%{NAME}" -qp $oldrpm` = "$NAME" ]; then OLDNAME=$oldrpm; break fi done if [ -z "$OLDNAME" ]; then echo $NAME is new cp -pv $rpm $RPMDIR else if [ `basename $rpm` != `basename $OLDNAME` ]; then mv $OLDNAME $OLDDIR cp -pv $rpm $RPMDIR fi fi done