Subject: | |
From: | |
Reply To: | |
Date: | Wed, 13 Apr 2005 01:42:08 +0100 |
Content-Type: | TEXT/PLAIN |
Parts/Attachments: |
|
|
On Tue, 12 Apr 2005, Steve Traylen wrote:
> On Tue, Apr 12, 2005 at 02:13:58PM +0100 or thereabouts, Mark Nelson wrote:
> > Wouldn't it be better to have one behaviour or the other, my personal
> > one is for .rpmnew config files as this cuts down on the configuration
> > files having to be touched manually by the upgrade process.
>
> Hi Mark,
>
> This depends on the individual .spec file.
>
> If it has
>
> %config(noreplace) /etc/ssh/sshd_config
<snip>
> There is a very good summary of the different cases here:
>
> http://www-uxsup.csx.cam.ac.uk/~jw35/docs/rpm_config.html
In case it isn't obvious to anyone, you can pick out the status for each
file (the %{FILEFLAGS} option on rpmquery) to see if the file is a
%config(noreplace) or not. Just and the flag with 0x11 I think (I know I
found a table of the values at one point).
e.g. the following perl fragment is what we
use to test if an rpm would clash with changes we have made...
<snip>
open (IN, "rpmquery -p --qf '[P=%{FILENAMES} FL=%{FILEFLAGS} M=%{FILEMODES:octal} SL=\"%{FILELINKTOS}\"\n]' $i|") || die "Can't run rpmquery -lp $i\n";
while (<IN>) {
chomp;
if (/^P=(.+)\s+FL=(\d+)\s+M=(\d+)\s+SL="(.*)"/) {
my $path=$1, $flags=$2, $pmode=$3, $syml=$4;
if (defined($danger{$path})) {
if (($flags & 17) == 17) {
dprin(1, "$path overlaps but is listed as %config(noreplace) (fflags=$flags)");
} else {
$danger{$path}++;
$overlaps++;
...
<snip out more tests on the files from a potential package upgrade...>
We also check for things like matching some patterns, some permissions
changes, shared-libs, init files, and kernel files/modules then later the
code uses that info to decide if we need to take any special actions.
-- Jon
|
|
|