Red Hat Bugzilla – Bug 830631
[Patch] Disables yum-rhn-plugin a little bit safer in %post in client entitlement rpms' spec template
Last modified: 2013-12-17 15:08:48 EST
Created attachment 590810 [details]
Disables yum-rhn-plugin a little bit safer in %post in client entitlement rpms' spec template
Description of problem:
Currently, client entitlement rpms disabling yum-rhn-plugin in its %post w/
using sed and mv combination anytime but it should become safer like the
patch attached, IMHO.
Version-Release number of selected component (if applicable):
The patch I posted may also 'fix' the following rpmlint warning
and error, I guess:
rhui-client-entitlement-rhui-2.0.noarch: W: dangerous-command-in-%post mv
rhui-client-entitlement-rhui-2.0.noarch: E: use-tmp-in-%post
I think this has been fixed at least in the rh-amazon-rhui-client.
Fix can be pulled from there.
Its not fixed in the general rhui code afaik.
Hi guys, just noticed that using sed leads to the situation that the file date time will be anyway changed regardless it was modified or not. So every time when a client conf rpm will be installed, rhnplugin.conf will be changed even if no changes in fact have been made. And this could be a bit confusing. So maybe it will be better to use something like :
grep -iP "enabled = (0|false|off)" rhnplugin.conf || sed ...
# rpm -q --scripts rhel5c1
postinstall scriptlet (using /bin/sh):
if [ "$1" = "1" ]; then # 'install', not 'upgrade'
# Disable RHN plugin
if [ -f /etc/yum/pluginconf.d/rhnplugin.conf ]; then
grep -iP "enabled = (0|false|off)" /etc/yum/pluginconf.d/rhnplugin.conf || sed -i.save -e 's/^enabled.*/enabled = 0/g' /etc/yum/pluginconf.d/rhnplugin.conf || :
The small issue here is: 'grep -iP "enabled = (0|false|off)"' prints matching line to stdout, so during package install we can see:
# rpm -i rhel5c1-2.0-1.noarch.rpm
enabled = 0
I would suggest adding '-q' switch to this grep to avoid any output.
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.