I've been tired for some time of watching rpmnew and rpmsave files. I've been looking for some tool, but did not find any, so I wrote my own.
http://miroslav.suchy.cz/fedora/rpmconf/rpmconf
Before I spend more times on this script, I would like to hear your opinion. Do you find it useful? Did it already exists and I miss it in my search? Do you see any bugs there?
What it does: - run "rpmconf --help" and you will see :) - it search all config file of all installed packages and check if file with .rpmsave or .rpmnew exists. - It allows you to see diff of this file against current file. - It allows you to keep current version or the other one (rpmsave or rpmnew one). - it deletes .rpmsave and .rpmnew files which are identical to current file - after your choice it deletes the unwanted file.
And what it does not do: - it do not delete anything. At least until you comment out DEBUG variable on begging of script. - it does not search for *all* rpmsave and rpmnew files. It only search for installed configuration files. If package has been uninstalled and rpmsave has been left behind, then I do not care. If rpmsave or rpmnew has been created in past and now the config file is not presented in package any more, then I do not care too.
And before you comment out DEBUG variable, obvious question. Do you have backups? :)
On Fri, 2009-06-12 at 14:30 +0200, Miroslav Suchý wrote:
I've been tired for some time of watching rpmnew and rpmsave files. I've been looking for some tool, but did not find any, so I wrote my own.
http://miroslav.suchy.cz/fedora/rpmconf/rpmconf
Before I spend more times on this script, I would like to hear your opinion. Do you find it useful? Did it already exists and I miss it in my search?
http://learn.clemsonlinux.org/wiki/Gentoo:etc-update
That's etc-update, originates from Gentoo, and handles rpmnew/rpmsave files (I think it just matches any filenames in /etc that look to be variants of each other).
Mandriva has rather simple handling of these files in its graphical package manager, rpmdrake:
http://svn.mandriva.com/cgi-bin/viewvc.cgi/soft/rpmdrake/trunk/Rpmdrake/rpmn...
it more or less just shows you a diff between the old and new configs, and asks which you'd like to use. No editing / reconciliation is possible. And it's in perl. =)
There may be others, but those are the ones that spring to mind.
(btw, if anyone's wondering why there's always a blank line above my sig now, this appears to be a 'feature' of Evolution in Rawhide...it includes a blank line before the separator in the signature block).
On 12/06/09 17:00, Adam Williamson wrote:
On Fri, 2009-06-12 at 14:30 +0200, Miroslav Suchý wrote:
I've been tired for some time of watching rpmnew and rpmsave files. I've been looking for some tool, but did not find any, so I wrote my own.
http://miroslav.suchy.cz/fedora/rpmconf/rpmconf
Before I spend more times on this script, I would like to hear your opinion. Do you find it useful? Did it already exists and I miss it in my search?
There is something similar in Fedora, yum-plugin-merge-conf (not installed by default)
currently is supports vi(m)
Now if you could modify this to use Meld lets say: meld-1.2.1-3.fc11.noarch : Visual diff and merge tool there would be a gui version.
But, what I would say is, if you want go ahead, that is the beauty of F\l\OSS *choice*
Maybe with your also Meld as a frontend?
Frank
Hi,
from these tools only Gentoo looks to me to do the right thing - one has to do a 3-files merge. Just having the old modified file and the new unmodified files has no solution how to do the automatic merge = how to get the new configuration file with all the local changes of the old file brought in.
rpm should save originals of all the configuration files it installs. On Fedora I have to save them by hand before modifying any config file (I save them to <name>-orig files). Then by hand (or by the automated attached script) do the diff/patch merge.
http://miroslav.suchy.cz/fedora/rpmconf/rpmconf http://svn.mandriva.com/cgi-bin/viewvc.cgi/soft/rpmdrake/trunk/Rpmdrake/rpmn... yum-plugin-merge-conf (not installed by default)
All these tools require human interaction even in the case a fully automated ("95% safe") merge is possible. Moreover the human can never be sure if (s)he did not forget to merge in some of the changes from the old version of the file.
Not sure if this one but maybe Gentoo dispatch-conf does the right thing.
Regards, Jan
#! /bin/sh set -ex for base in "$@";do base=`echo $base|sed 's/[.]rpmnew$//'` test -f $base test -f $base.rpmnew test ! -f $base.orig test ! -f $base.rej
if test ! -f $base-orig then cmp $base $base.rpmnew mv -f $base.rpmnew $base continue fi
if diff -u $base-orig $base.rpmnew | patch -f $base then test ! -f $base.rej rm -f $base.orig mv -f $base.rpmnew $base-orig continue fi test -f $base.orig test -f $base.rej mv -f $base.orig $base rm -f $base.rej exit 1 done echo OK
On Sun, 14 Jun 2009, Jan Kratochvil wrote:
Hi,
from these tools only Gentoo looks to me to do the right thing - one has to do a 3-files merge. Just having the old modified file and the new unmodified files has no solution how to do the automatic merge = how to get the new configuration file with all the local changes of the old file brought in.
rpm should save originals of all the configuration files it installs. On Fedora I have to save them by hand before modifying any config file (I save them to <name>-orig files). Then by hand (or by the automated attached script) do the diff/patch merge.
If you want to have all config files of all pkgs you're installing saved into a safe location it would not be a very complicated yum plugin to do it.
-sv