Viktor Dukhovni: > On Thu, Sep 11, 2014 at 02:20:41AM +0200, Bostjan Skufca wrote: > > > I am sending this email because I think that we need to do something > > about it, and hope that this will help communicate valid ideas around. > > It is not difficult to merge main.cf fragments without creating > duplicate definitions of parameters. The warnings are useful for > users who accidentally define the same setting twice. > > > Does anyone else think this "issue" needs attention? > > A simple merge script will suffice:
I sent a solution that uses "postconf -n >file" to produce a file without duplicates. Wietse > -- > Viktor. > > #! /usr/pkg/bin/perl -w > > sub parse { > my ($s, $l) = @_; > if ($s =~ m{^(\S+?)\s*=\s*(.*?)\s*$}) { > $dict{$1} = $2; > } else { > print STDERR $s, "\n"; > die sprintf("%s: malformed setting at line %d\n", $ARGV, $l); > } > } > while (<>) { > chomp; > next if (/^\s*(#|$)/); > if (m{^\s}) { $buf .= $_; next } > parse($buf, $line) if defined($buf); > $buf = $_; $line = $.; > } continue { > if (eof) { > parse($buf, $line) if defined($buf); > close ARGV; > undef $buf; > } > } > foreach $k (sort keys %dict) { > printf "%s = %s\n", $k, $dict{$k}; > } >