On Fri, 9 Jul 1999, Thomas J. Hamman wrote:

> On Fri, 09 Jul 1999, Jerome ALET wrote:
> > On Fri, 9 Jul 1999, Steven wrote:
> > > rm old_package_name   ???
> > 
> > just what I've done waiting for the answer.
> > 
> > > I bet someone clever could write a script to copy all packages from
> > > ../updates to Mandrake/RPMS and then delete the old ones -- unfortunately
> > > that rules me out.

  I went to www.redhat.com and searched for redhat iso and got a link to a
site I don't have up right now.  I got this script from that link. It
updates rpms and deletes old ones.


#! /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=6.0
ARCH=i386
CDDIR=/vmware/redhat
RPMDIR=${CDDIR}/${ARCH}/RedHat/
RPMSUPDDIR=${CDDIR}/updates/${ARCH}
OLDDIR=${CDDIR}/old

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

# Copy new boot image files to the right place...
for newfile in ${UPDDIR}/images/* ; do
        file=${CDDIR}$/${ARCH}/images/$(basename ${newfile})
  if [ $newfile -nt $file ] ; then
      cp -pv $newfile $file  
  fi
done

exit 0



--------------------
bug

Reply via email to