Last active
May 5, 2017 15:31
-
-
Save chihchun/2a07a5f45d373befc343e27befeddb24 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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