The current configuration update system force to ship two versions of
the same file in a package (foo.conf and foo.conf.dist). The attached
patch allow to use sysconftool against a pair of file with arbitrary
extension, so as to use foo.conf.rpmnew files created by rpm during
post-installation. Please merge.
--- sysconftool~        2005-09-17 05:06:41.000000000 +0200
+++ sysconftool 2006-04-17 17:40:03.000000000 +0200
@@ -27,12 +27,12 @@
 {
     my $filename=shift @ARGV;
 
-    $filename =~ s/\.dist$//;
+    my ($suffix) = $filename =~ s/\.(\w+)$//;
 
     my $rc;
 
     eval {
-       $rc=sysconftool($filename, $noclobber, $force);
+       $rc=sysconftool($filename, $noclobber, $force, $suffix);
     } ;
 
     if ($@)
@@ -52,16 +52,17 @@
     my $filename=shift;
     my $noclobber=shift;
     my $force=shift;
+    my $suffix=shift;
 
     my $distfile=new IO::File;
 
-    die "$filename.dist: $!\n" if ! $distfile->open("< $filename.dist");
+    die "$filename.$suffix: $!\n" if ! $distfile->open("< $filename.$suffix");
 
     my ($distheader, $distver);
 
     ($distheader, $distver)= sysconftool_readver($distfile);
 
-    die "$filename.dist: configuration header not found.\n" unless $distver;
+    die "$filename.$suffix: configuration header not found.\n" unless $distver;
 
     my $oldfile=new IO::File;
 
@@ -153,7 +154,7 @@
        (print $newfile $distheader) || die $!;
 
        sysconftool_writeout($newfile, $distfile, \%old_settings,
-                            \%old_version, "$filename.dist");
+                            \%old_version, "$filename.$suffix");
     } ;
 
     if ($@)

Reply via email to