DEFAULT=SL
i386=`ls ../../$DEFAULT/$1.i?86.rpm 2>/dev/null`
rpmarch=`rpm -qp --queryformat "%{arch}" $2`
ok=`ls ../../$DEFAULT/$1.$rpmarch.rpm`
if [ -z "$ok" ] ; then
     ok2=`ls ../../../archive/notsupported/$1`
     if [ ! -z "$ok2" ] ; then
        echo "should go in ../../../archive/notsupported/ ,move it over there?"
        echo "Or you can enter skip and I will skip it"
        read new
        if [ -n "$new" ] ; then
               if [ $new = "skip" ] ; then
                       echo "Skipping  -->  $2 "
               fi
        else
          mv -v $2 ../../../notsupported/RPMS/
          echo -e "\t$2" >> notsupported.log
        fi
        exit
     else
        echo "This is a new one do you want me to copy it over to ../../$DEFAULT/ now"
        echo "Or you can enter skip and I will skip it"
        read new
        if [ -n "$new" ] ; then
               if [ $new = "skip" ] ; then
                       echo "Skipping  -->  $2 "
               fi
        else
               mv -v $2 ../../$DEFAULT/
               echo -e "\t$2" >> new.log
        fi
        exit
     fi # -z $ok
fi
okbase=`basename $ok`
myarch=`uname -p`
if [ ! -z "$i386" ] ; then
  if [  "$rpmarch"  = "$myarch" ] ; then
     i386arch=`rpm -qp --queryformat "%{arch}" $i386 `
     newrpm=`rpm -qp --queryformat "%{name}-%{version}-%{release}.$i386arch.rpm " $2`
     if [  ! -s ../../$DEFAULT/$newrpm ] ; then
       echo "There seems to be a i?86 version of this that we do not have"
       echo "$newrpm $i386" >> i386.log
     fi
  fi
fi
echo "old one"
echo "$okbase"
echo "Press enter if ok  --> $2 ,  enter skip if you want to skip it"
me=""
read me
if [ -n "$me" ] ; then
       if [ $me = "skip" ] ; then
               echo "Skipping  -->  $2 "
       fi
else
       echo "okbase is $okbase"
       if [ -z "$okbase" ] ; then
               echo "base rpm name is null, skipping"
       else
               if [ -z "$2" ] ; then
                       echo "rpm name is null, skipping"
               else
                       mv -v ../../$DEFAULT/$okbase  ../../../archive/obsolete/
                       mv -v $2 ../../$DEFAULT/
                       ln -sf ../../$DEFAULT/$2 ../security/$2
                       echo -e "\t$2" >> errata.log
# remove old version out of RedHat/RPMS/
                       if [ -s ../security/$okbase ] ; then
                               rm ../security/$okbase
                       fi
               fi
       fi
fi