[Yum] How to determine whether yum have changed something from a script

Matthew Miller mattdm at mattdm.org
Sat Nov 24 04:56:58 UTC 2007


On Fri, Nov 23, 2007 at 05:15:27PM +0700, Fajar A. Nugraha wrote:
> Here's the case. I need to create a script which basically runs yum -y
> update, and after runs another script whose action depends on what yum did.
> yum errors can be checked from the return code, but it seems that a
> successful update and no update at all returns the same return code : 0.
> Is there a scriptable-way to test whether yum did anything, other than
> grepping the string "No Packages marked for Update" from yum output?

Run 'yum check-update' first and check its exit code first. Then you'll be
able to distinguish between these two cases.


-- 
Matthew Miller           mattdm at mattdm.org          <http://mattdm.org/>
Boston University Linux      ------>              <http://linux.bu.edu/>



More information about the Yum mailing list