mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
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.
This commit is contained in:
parent
de6c3db01f
commit
f02ab0ca9a
1 changed files with 20 additions and 4 deletions
|
|
@ -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} = \∅
|
||||
}
|
||||
#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} == \∅
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue