summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2004-09-19 21:21:26 +0000
committerdes <des@FreeBSD.org>2004-09-19 21:21:26 +0000
commita327ab2ee1e532b5b11b3d67bf08e12d42b18597 (patch)
tree495b656bfd65aa5fa978a201c29188816d30febf /tools
parenta58cafd11e24a1ef73abb296f763f5aab599e03e (diff)
downloadFreeBSD-src-a327ab2ee1e532b5b11b3d67bf08e12d42b18597.zip
FreeBSD-src-a327ab2ee1e532b5b11b3d67bf08e12d42b18597.tar.gz
Recognize options with values. If an option is present in both GENERIC
and the custom kernel, but its value has been modified, it will now be kept in its correct spot instead of being moved to the bottom.
Diffstat (limited to 'tools')
-rwxr-xr-xtools/tools/genericize/genericize.pl24
1 files changed, 20 insertions, 4 deletions
diff --git a/tools/tools/genericize/genericize.pl b/tools/tools/genericize/genericize.pl
index 6a74f86..5c8f025 100755
--- a/tools/tools/genericize/genericize.pl
+++ b/tools/tools/genericize/genericize.pl
@@ -32,6 +32,8 @@
use strict;
use Getopt::Std;
+sub EMPTY() {}
+
MAIN:{
my %opts;
getopts('c', \%opts);
@@ -51,10 +53,11 @@ MAIN:{
$machine = $value;
} elsif ($keyword eq 'ident') {
$ident = $value;
+ } elsif ($keyword eq 'options' && $value =~ m/(\w+)=(.+)/) {
+ $config{$keyword}->{$1} = $2;
} else {
- $config{$keyword}->{$value} = 1;
+ $config{$keyword}->{$value} = \&EMPTY;
}
- #print "$keyword $value\n";
}
}
@@ -83,7 +86,17 @@ MAIN:{
unless ($value eq $machine);
} elsif ($keyword eq 'ident') {
$line =~ s/$value/$ident/;
- } elsif ($config{$keyword}->{$value}) {
+ } elsif ($keyword eq 'options' && $value =~ m/(\w+)=(.+)/ &&
+ $config{$keyword}->{$1} != \&EMPTY) {
+ $value = $1;
+ if ($config{$keyword}->{$value} ne $2) {
+ my ($old, $new) = ($2, $config{$keyword}->{$value});
+ $line =~ s{=$old}{=$new};
+ }
+ delete($config{$keyword}->{$value});
+ delete($config{$keyword})
+ unless %{$config{$keyword}};
+ } elsif (defined($config{$keyword}->{$value})) {
delete($config{$keyword}->{$value});
delete($config{$keyword})
unless %{$config{$keyword}};
@@ -108,7 +121,10 @@ MAIN:{
} elsif (length($keyword) == 7) {
print " ";
}
- print "\t$value\n";
+ print "\t$value";
+ print "=$config{$keyword}->{$value}"
+ unless $config{$keyword}->{$value} == \&EMPTY;
+ print "\n";
}
}
}
OpenPOWER on IntegriCloud