diff options
author | Alexandre Oliva <lxoliva@fsfla.org> | 2018-02-27 20:48:03 +0000 |
---|---|---|
committer | Alexandre Oliva <lxoliva@fsfla.org> | 2018-02-27 20:48:03 +0000 |
commit | ddb203b5a8a958e5a19e8d79712fd89065fed5c3 (patch) | |
tree | 4a7f4d0cede6ba610f6ebe00d24aa9b95ba0719a /freed-ora/tags/f27/4.15.6-300.fc27.gnu/merge.pl | |
parent | 27605092d9f33eaec72b76df828dd5712d0dcf0c (diff) | |
download | linux-libre-raptor-ddb203b5a8a958e5a19e8d79712fd89065fed5c3.tar.gz linux-libre-raptor-ddb203b5a8a958e5a19e8d79712fd89065fed5c3.zip |
tag 4.15.6-300.fc27.gnu
Diffstat (limited to 'freed-ora/tags/f27/4.15.6-300.fc27.gnu/merge.pl')
-rwxr-xr-x | freed-ora/tags/f27/4.15.6-300.fc27.gnu/merge.pl | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/freed-ora/tags/f27/4.15.6-300.fc27.gnu/merge.pl b/freed-ora/tags/f27/4.15.6-300.fc27.gnu/merge.pl new file mode 100755 index 000000000..8c318156a --- /dev/null +++ b/freed-ora/tags/f27/4.15.6-300.fc27.gnu/merge.pl @@ -0,0 +1,66 @@ +#! /usr/bin/perl + +my @args=@ARGV; +my %configvalues; +my @configoptions; +my $configcounter = 0; + +# optionally print out the architecture as the first line of our output +my $arch = $args[2]; +if (defined $arch) { + print "# $arch\n"; +} + +# first, read the override file + +open (FILE,"$args[0]") || die "Could not open $args[0]"; +while (<FILE>) { + my $str = $_; + my $configname; + + if (/\# ([\w]+) is not set/) { + $configname = $1; + } elsif (/([\w]+)=/) { + $configname = $1; + } + + if (defined($configname) && !exists($configvalues{$configname})) { + $configvalues{$configname} = $str; + $configoptions[$configcounter] = $configname; + $configcounter ++; + } +}; + +# now, read and output the entire configfile, except for the overridden +# parts... for those the new value is printed. + +open (FILE2,"$args[1]") || die "Could not open $args[1]"; +while (<FILE2>) { + my $configname; + + if (/\# ([\w]+) is not set/) { + $configname = $1; + } elsif (/([\w]+)=/) { + $configname = $1; + } + + if (defined($configname) && exists($configvalues{$configname})) { + print "$configvalues{$configname}"; + delete($configvalues{$configname}); + } else { + print "$_"; + } +} + +# now print the new values from the overridden configfile +my $counter = 0; + +while ($counter < $configcounter) { + my $configname = $configoptions[$counter]; + if (exists($configvalues{$configname})) { + print "$configvalues{$configname}"; + } + $counter++; +} + +1; |