Eric Shubert <ejs@xxxxxxxxxx> writes: > On 01/02/2014 11:34 AM, James Antill wrote: >> Eric Shubert <ejs@xxxxxxxxxx> writes: >> >>> Let me try to explain a little better what's going on. For example, my >>> clamav package runs "freshclam" during the %post section, in order to >>> update virus definitions. The freshclam program outputs a progress >>> bar, so you can see how the download is going as it progresses. This >>> works fine when using the rpm command. >> >> This is broken, it's an error for rpm packages to output anything in >> %post/%postun ... > > Since when is output from an rpm script considered an error? That's > news to me (which is, ironically, nothing new). ;) Can you point me to > some documentation which explains this? It's been considered broken forever, although you are far from the only person to want a progress. The main reasons it's considered broken are: 1. rpms are supposed to be non-interactive, Eg. mock/kickstart/etc. where the user can't see them. 2. Because of #1 there is no API for communicating with the user from a scriptlet. So even for "interactive" things like yumex, anaconda, PK, etc. ... the options are: Open a terminal like screen and show all the output. Ignore it all just like #1. > If %post scripts are prohibited from using stdout/stderr, how then are > such scripts supposed to report progress (and/or problems)? Obviously if something goes wrong that you didn't expect, outputting something to stderr is better than doing nothing. At worst it'll be the same, but it allows things like "yum history" to show that something went wrong and save the text for the user. There is no good way for a scriptlet to pass progress info. up to higher levels. >> and you'll see that "yum history" will flag any >> transaction without output as problematic. > > Why exactly is that? > What purpose does this serve? So the user can find any error messages that have happened, and actually read them. > I could of course remove the pertinent %post processing from the rpm > and run it external to yum, but that sort of defeats the purpose of > having %post processing in general. > > Out of curiosity, how does (or doesn't) yum handle %verify script output? yum-plugin-verify, and the API behind it, doesn't run verify scripts. And from the rpm book: http://www.rpm.org/max-rpm/s1-rpm-inside-scripts.html#S2-RPM-INSIDE-VERIFYSCRIPT-SCRIPT Normally RPM will only display error output from a verification script; the output sent to stdout is only displayed when the verification is run in verbose mode. > Is there any sort of best practice (I'm likely missing) for > accomplishing this sort of thing? I'd like to do things in a typical > manner, but I'm finding yum to be somewhat prohibitive in this area. If you have something like database initialization, that requires user interaction ... it's common to just not do it at rpm time. -- James Antill -- james@xxxxxxx _______________________________________________ Yum mailing list Yum@xxxxxxxxxxxxxxxxx http://lists.baseurl.org/mailman/listinfo/yum