|
|
close $makeconf; | close $makeconf; |
} | } |
| |
|
my $sourcing = 0; |
eval { | eval { |
# USE comment start/end (start/end of newline character at the end, specifically) | # USE comment start/end (start/end of newline character at the end, specifically) |
# default to end of make.conf, to handle make.confs without #USE= | # default to end of make.conf, to handle make.confs without #USE= |
|
|
/\G$IDENT/gc or die; | /\G$IDENT/gc or die; |
my $name = $1; | my $name = $1; |
/\G$BLANK/gc; | /\G$BLANK/gc; |
|
if($name ne 'source') { |
/\G$ASSIG/gc or die; | /\G$ASSIG/gc or die; |
/\G$BLANK/gc; | /\G$BLANK/gc; |
|
} else { |
|
$sourcing = 1; |
|
} |
die if pos == length; | die if pos == length; |
my $valstart = pos; | my $valstart = pos; |
/\G(?:$BNUQV|$SQVAL|$BNDQV)+/gc or die; | /\G(?:$BNUQV|$SQVAL|$BNDQV)+/gc or die; |
|
|
}; | }; |
die "Parse error when writing make.conf - did you modify it while ufed was running?\n" if $@; | die "Parse error when writing make.conf - did you modify it while ufed was running?\n" if $@; |
| |
|
print STDERR <<EOF if $sourcing; |
|
Warning: source command found in /etc/make.conf. Flags may |
|
be saved incorrectly if the sourced file modifies them. |
|
EOF |
{ | { |
open my $makeconf, '>', '/etc/make.conf' or die "Couldn't open /etc/make.conf\n"; | open my $makeconf, '>', '/etc/make.conf' or die "Couldn't open /etc/make.conf\n"; |
print $makeconf $_; | print $makeconf $_; |
|
|
/\G$IDENT/gc or die; | /\G$IDENT/gc or die; |
my $name = $1; | my $name = $1; |
/\G$BLANK/gc; | /\G$BLANK/gc; |
|
if($name ne 'source') { |
/\G$ASSIG/gc or die; | /\G$ASSIG/gc or die; |
/\G$BLANK/gc; | /\G$BLANK/gc; |
|
} |
die if pos == length; | die if pos == length; |
my $value = ''; | my $value = ''; |
for(;;) { | for(;;) { |
|
|
last | last |
} | } |
} | } |
|
if($name eq 'source') { |
|
open my $f, '<', $value or die; |
|
my $pos = pos; |
|
substr($_, pos, 0) = do { |
|
local $/; |
|
my $text = <$f>; |
|
die if not defined $text; |
|
$text; |
|
}; |
|
pos = $pos; |
|
close $f or die; |
|
} else { |
$env{$name} = $value; | $env{$name} = $value; |
|
} |
} | } |
}; | }; |
die "Parse error in $fname\n" if $@; | die "Parse error in $fname\n" if $@; |