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

Re: Upgrades from one major release to the next



>>>>> "YY" == Yuan Yijun <bbbush yuan gmail com> writes:

YY> If yum/rpm would send a detailed mail to all users indicate that
YY> what configurations are saved to .rpmold, .rpmnew, etc. and what
YY> are replaced then I could believe in yum/rpm more.

I use the following script, which will tell you about any rpmsave or
rpmnew files and can spam you with diffs as well.

#!/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";
  }
}

 - J<


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