RE: Dealing with rpmsave files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Your right it isn't exactly what I was looking for, but it is a nice
piece of code none the less and may come in useful.

Thanks,
Sean

------------------------------------------------------------------------
Sean P. Kane
spkane@xxxxxxxxxxxxxx
Lead Infrastructure Architect
Genomatica, Inc.
------------------------------------------------------------------------
"When we destroy something man has created we call it vandalism......
 When we destroy something that Gaia has created we call it progress."


-----Original Message-----
From: Jason L Tibbitts III [mailto:tibbs@xxxxxxxxxxx] 
Sent: Wednesday, March 19, 2003 12:17
To: kickstart-list@xxxxxxxxxx
Subject: Re: Dealing with rpmsave files


>>>>> "SPK" == Sean P Kane <spkane@xxxxxxxxxxxxxx> writes:

SPK> Is there a way to make rpm overwrite config files, since this is 
SPK> before anyone has edited themselves? Or has anyone come up with a 
SPK> clever way of cleaning this up?

Not exactly what you were looking for, but here is the script I use to
detect config files that either were overwritten or need to have changes
merged in.  -q runs quietly; the exit code indicates whether or not
changes need to be looked at.  -d produces diffs.  The idea was stolen
from a very useful feature of IRIX.

 - J<

#!/usr/bin/perl
use Getopt::Std;
getopts('dq');

$| = 1;
@DIFF = qw(/usr/bin/diff -u);
@LS   = qw(/bin/ls -l);

@configfiles = `rpm -qac`;

for $i (@configfiles) {
  chomp $i;
  $old = -f "$i.rpmsave";
  $new = -f "$i.rpmnew";
  if ($old || $new) {

    # If running quietly, we can just exit the first time we see a
difference
    if ($opt_q) {
      exit 1;
    }

    $package = `rpm -qf $i`;
    chomp $package;

    push @{$updates{$package}}, {file => $i,
				 old  => $old,
				 new  => $new,
				};
  }
}

exit 0 unless %updates;

for $package (sort keys %updates) {
  print "Updated files in package $package:\n";

  for $i (@{$updates{$package}}) {
    if ($i->{old}) {
      show ($i->{file}, "$i->{file}.rpmsave");
    }
    if ($i->{new}) {
      show ($i->{file}, "$i->{file}.rpmnew");
    }
  }
  print "\n";
}

exit 1;

sub show {
  my($old, $new) = @_;

  print "    " if $opt_d;
  system(@LS, $old);
  print "    " if $opt_d;
  system(@LS, $new);

  if ($opt_d) {
    print "Differences:\n", "="x40, "\n";
    system(@DIFF, $old, $new);
    print "="x40, "\n";
  }
}



_______________________________________________
Kickstart-list mailing list
Kickstart-list@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/kickstart-list





[Index of Archives]     [Red Hat General]     [CentOS Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux