DEFAULT=SL echo `date` >> errata.log echo `date` >> new.log echo `date` >> i386.log mv *debuginfo*.rpm ../../debuginfo/RPMS/ /bin/mv -f *src.rpm ../../../../SRPMS/vendor/errata/ for i in *.rpm do if [ -f ../../../$DEFAULT/RPMS/$i ] ; then echo "Already have $i in SL/RPMS, so deleting it." rm $i continue fi if [ -f ../../obsolete/RPMS/$i ] ; then echo "Already have $i in obsolete/RPMS, so deleting it." rm $i continue fi NEWNAME=`rpm -qp $i --qf "%{name}"` NEWARCH=`rpm -qp $i --qf "%{arch}"` NEWRPMVERSION=`rpm -qp --queryformat "%{epoch}:%{version}-%{release}" $i ` OLDRPM="" cd ../../../SL/RPMS/ > /dev/null LIST=`ls -1 ${NEWNAME}* 2> /dev/null` for line in $LIST do OLDNAME=`rpm -qp $line --qf "%{name}"` if [ "${OLDNAME}" == "${NEWNAME}" ] ; then OLDARCH=`rpm -qp $line --qf "%{arch}"` if [ "${OLDARCH}" == "${NEWARCH}" ] ; then OLDRPM="$line" OLDRPMVERSION=`rpm -qp --queryformat "%{epoch}:%{version}-%{release}" $OLDRPM ` #echo "Found a match: $line" fi fi done cd - > /dev/null if [ "$OLDRPM" == "" ] ; then echo "" echo "new: $i" echo "I could not find a match for this. Should I just move it in?" echo "Enter skip if I should skip this one" read new if [ -n "$new" ] ; then if [ $new = "skip" ] ; then echo "... Skipping" fi else echo "Moving it in" mv -v $i ../../../$DEFAULT/RPMS/ echo -e "\t$i" >> new.log fi else echo "" NEWERISNEWER=0 echo "old: $OLDRPM" echo "new: $i" RESULT=`./rpmdev-vercmp $OLDRPMVERSION $NEWRPMVERSION` EXITCODE=$? if [ $EXITCODE -eq 12 ] ; then # right side was newer echo "I think that the NEW rpm is newer , should I go ahead?" NEWERISNEWER=1 else if [ $EXITCODE -eq 11 ] ; then # left side was newer echo "I think that the OLD rpm is newer , should I leave it?" NEWERISNEWER=0 else echo "I do know know which version is newer" echo "RPM Comparision is $RESULT" break fi fi echo "Enter skip if I should skip this one" read new if [ -n "$new" ] ; then if [ $new = "skip" ] ; then echo "... Skipping" fi else if [ $NEWERISNEWER -eq 1 ] ; then echo "Replacing old with new" mv -v ../../../$DEFAULT/RPMS/$OLDRPM ../../obsolete/RPMS/ mv -v $i ../../../$DEFAULT/RPMS/ echo -e "\t$i" >> errata.log else echo "Leaving old" fi fi fi done