Skip to content

Instantly share code, notes, and snippets.

@chihchun
Last active May 5, 2017 15:31
Show Gist options
  • Save chihchun/2a07a5f45d373befc343e27befeddb24 to your computer and use it in GitHub Desktop.
Save chihchun/2a07a5f45d373befc343e27befeddb24 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl
use strict;
my $config = shift(@ARGV);
my $P = "kernel-config-compare";
my %values = ();
# Load up the current configuration values -- FATAL if this fails
print "$P: loading $config\n";
open(CONFIG, "<$config") || die "$P: $config: open failed -- $! -- aborting\n";
while (<CONFIG>) {
# Pull out values.
/^#*\s*(CONFIG_\w+)[\s=](.*)$/ or next;
$values{$1} = $2;
}
close(CONFIG);
for my $commonconfig (@ARGV) {
# Load the config for compare
print "$P: loading $commonconfig\n";
open(CONFIG, "<$commonconfig") || die "$P: $commonconfig: open failed -- $! -- aborting\n";
while (<CONFIG>) {
# Pull out values.
/^#*\s*(CONFIG_\w+)[\s=](.*)$/ or next;
if($values{$1} ne $2) {
print "$P: ($values{$1} != $2): $commonconfig - $1\n";
}
}
close(CONFIG);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment