[lug] return code

Hugh Brown hugh at vecna.com
Fri Jun 7 11:43:53 MDT 2002


 In your particular case, there's an ambiguity; according to
> 
>    http://www.rpm.org/hintskinks/returncode/
> 
> the return code from rpm is the number of packages that failed to
> install.  If exactly one failed, and you're doing a redirect that
> might also fail, $? is ambiguous.
> 
> I'd suggest just capturing non-fancy output and processing it after
> the fact to figure out what happened.
> 
> t.


I'm only asking rpm about one package at a time, but rpm -q kernel glibc
has $? = 0

I am trying to make administration easier for myself.  I have a box that
mirrors the updates made to redhat.  When I have a box at a remote
location, I typically have a certain set of packages installed.  I want
to be able to find out which packages I need to scp over to the remote
box in order to keep the system up to date.  scp'ing the whole update
dir over and then doing a -Fvh is time consuming and a poor use of
bandwidth.  I decided to write a script that would take a list of rpms
(from the updates dir), check to see if the rpm was installed, then
check to see if it was more recent than what was installed.  Finally, I
would have a list of rpm's that needed scp'ing and I could update.  I'm
also doing it this way because I want to practice perl.

Hugh





More information about the LUG mailing list