#SITERPMDIR=SITERPMS #SLRPMS=RPMS if [ -s locations.include ] ; then . locations.include >/dev/null 2>&1 else echo "Need locations.include to continue" exit 1 fi echo '' echo "# listed below are obsolete rpms in $ARCH/sites/Fermi/$SITERPMDIR" echo '# things preceeded by # may need your help' echo '' cd ../../$SITERPMDIR for siterpm in *.rpm; do SITERPMname=`rpm -qp --qf "%{name}" $siterpm` SITERPMarch=`rpm -qp --qf "%{arch}" $siterpm` SITERPMversion=`rpm -qp --queryformat "%{epoch}:%{version}-%{release}" $siterpm` POSSIBLERPMS=`cd ../$SLRPMS; ls ${SITERPMname}* 2>/dev/null` for slrpm in ${POSSIBLERPMS}; do SLname=`rpm -qp --qf "%{name}" ../$SLRPMS/$slrpm` SLarch=`rpm -qp --qf "%{arch}" ../$SLRPMS/$slrpm` SLversion=`rpm -qp --queryformat "%{epoch}:%{version}-%{release}" ../$SLRPMS/$slrpm` if [[ "$SLname" == "$SITERPMname" ]]; then if [[ "$SLarch" == "$SITERPMarch" ]]; then # first check to see if this is already in SL, if so things are easy if [[ "$SITERPMversion" == "$SLversion" ]]; then diff ../$SLRPMS/$slrpm $siterpm >/dev/null 2>&1 if [[ $? -eq 0 ]]; then # the files are the same therefore dont need siterpm echo $siterpm else echo "# $siterpm is in ../$SLRPMS/ but isn't the exact same rpm" fi else # so SL doesn't have the exact rpm in SITERPMS, but does it have a newer one? RPMVERCMPOUT=`rpmdev-vercmp ../$SLRPMS/$slrpm ../$SITERPMDIR/$siterpm` RC=$? if [[ $RC -eq 11 ]]; then # siterpm is obsolete echo $siterpm elif [[ $RC -eq 12 ]]; then # siterpm is newer # don't do anything, need a line here or syntax error echo "# SL has older rpm than $siterpm" >/dev/null else echo "# $siterpm wrong values from rpmdev-vercmp=>$RC is strange I ran: rpmdev-vercmp ../$SLRPMS/$slrpm $siterpm" fi fi fi fi done done