RPM Community Forums

Mailing List Message of <rpm-users>

Re: How to detect rpm post scriptlet failure

From: Levon Poghosyan <deimusmeister@gmail.com>
Date: Thu 13 Oct 2011 - 09:15:57 CEST
Message-ID: <CAJgCh_Fv5YXT-+emdG0v+bB0rton_s3oNBwh7D3bJpEVXu1OfA@mail.gmail.com>
Thanks for the reply.

The situation is following. I've got an application which installs bunch of
rpm packages.
Some of those packages have post scriptlet failing, so I need to know/figure
out which are failing.
Those packages are many, so I think it wont be the best solution to modify
all off them to store their post install scriptlet execution status in /var,
any other solution for this case ?

Regards,
Levon

On 12 October 2011 21:22, Jeff Johnson <n3npq.jbj@gmail.com> wrote:

>
> On Oct 12, 2011, at 11:38 AM, Levon Poghosyan wrote:
>
> > Hello,
> >
> > How can I detect if the execution of post scriptlet of the rpm package
> failed ?
>
> The simple answer here is:
>        You don't.
>
> All I mean by that is that the %post script needs to be written "robustly"
> so that the exit code is always 0.
>
> If you need/want to tell whether some specific operation "worked",
> then write a test after rpm has run for that specific operation.
>
> Another approach would be to have the %post script register its
> state somewhere in /var so that you can easily test whether the script
> "worked" or not.
>
> > I've generated the and rpm package which has a test command "lalala" in
> post install section. So during the installation it prints out information
> that command lalala was not found but the installation is still successful.
> > How do I identify this failure from post install section.
>
> A %post "scriptlet" (the only difference between script and scriptlet is
> that a
> scriplet is macro expanded and may eventually have some envvar's
> prepended instead of having RPM add to the environ directly) is
> just a script.
>
> SO use test(1) to test for existence and executability, and write that into
> the %post section directly.
>
> Because a %post is part of a package install state machine, the script
> SHOULD return 0 for all but catasstrophic faiulures.
>
> There are side-effects of returning failure from %post, the most important
> of which is that on an upgrade, the erase will be skipped if/when the
> install fails.
>
> >
> > Please note I'm not interested in failure in other places, I just need to
> be informed in post install scriptlet failed.
> >
>
> Personal;ly, I'd just write the %post script to write 1 line into
> /var/lib/application/state
> with the message
>        The %post script "succeeded"
> or (on failure)
>        The %post script "failed".
>
> I'd have to know more about what is implied by a %post success/failure
> in order to suggest some other approach.
>
> hth
>
> 73 de Jeff
>
> ______________________________________________________________________
> RPM Package Manager                                    http://rpm5.org
> User Communication List                             rpm-users@rpm5.org
>



-- 
Address  Yerevan, Baghramyan 70/75
Received on Thu Oct 13 09:15:59 2011
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.