diff options
author | des <des@FreeBSD.org> | 2006-01-30 10:46:01 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2006-01-30 10:46:01 +0000 |
commit | e4d6027c5e91c513881af0ef86a618441ab37adc (patch) | |
tree | 2eead0815cd876a12f8cb67d8cf10a80a7724075 /tools | |
parent | 8681571f4b31d56dd2b9466b46fa73006ab2f459 (diff) | |
download | FreeBSD-src-e4d6027c5e91c513881af0ef86a618441ab37adc.zip FreeBSD-src-e4d6027c5e91c513881af0ef86a618441ab37adc.tar.gz |
Avoid triggering autovivification of %config entries, which would result in
an empty addenda section.
Handle kernel configs that lack a "machine" line by guessing at the location
of GENERIC (assuming that it is in the same directory as the config file)
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/tools/genericize/genericize.pl | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/tools/tools/genericize/genericize.pl b/tools/tools/genericize/genericize.pl index c9446bb..2f8d694 100755 --- a/tools/tools/genericize/genericize.pl +++ b/tools/tools/genericize/genericize.pl @@ -46,7 +46,6 @@ MAIN:{ chomp(); s/\s*(\#.*)?$//; next unless $_; - #print("$_\n"); my ($keyword, $values) = split(' ', $_, 2); foreach my $value (split(/,\s*/, $values)) { if ($keyword eq 'machine') { @@ -61,7 +60,12 @@ MAIN:{ } } - my $generic = "/usr/src/sys/$machine/conf/GENERIC"; + my $generic; + if ($machine) { + $generic = "/usr/src/sys/$machine/conf/GENERIC"; + } else { + ($generic = $ARGV) =~ s|([^/])+$|GENERIC|; + } local *GENERIC; open(GENERIC, "<", $generic) or die("$generic: $!\n"); @@ -87,7 +91,7 @@ MAIN:{ } elsif ($keyword eq 'ident') { $line =~ s/$value/$ident/; } elsif ($keyword eq 'options' && $value =~ m/(\w+)=(.+)/ && - defined($config{$keyword}->{$1}) && + $config{$keyword} && $config{$keyword}->{$1} && $config{$keyword}->{$1} != \&EMPTY) { $value = $1; if ($config{$keyword}->{$value} ne $2) { @@ -97,7 +101,7 @@ MAIN:{ delete($config{$keyword}->{$value}); delete($config{$keyword}) unless %{$config{$keyword}}; - } elsif (defined($config{$keyword}->{$value})) { + } elsif ($config{$keyword} && $config{$keyword}->{$value}) { delete($config{$keyword}->{$value}); delete($config{$keyword}) unless %{$config{$keyword}}; |