mirror of
https://gitlab.com/shorewall/code.git
synced 2025-06-20 01:37:59 +02:00
Evaluate a variable at compile-time rather than at run-time
Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
3aac252645
commit
16457ce85b
@ -1674,17 +1674,26 @@ sub compile_updown() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( @$optional ) {
|
if ( @$optional ) {
|
||||||
my $interfaces = join '|', map $interfaces{$_}->{physical}, @$optional;
|
my @interfaces = map $interfaces{$_}->{physical}, @$optional;
|
||||||
|
my $interfaces = join '|', @interfaces;
|
||||||
$interfaces =~ s/\+/*/;
|
|
||||||
|
|
||||||
|
if ( $interfaces =~ s/\+/*/ || @interfaces > 1 ) {
|
||||||
emit( "$interfaces)",
|
emit( "$interfaces)",
|
||||||
' if [ "$COMMAND" = up ]; then',
|
' if [ "$COMMAND" = up ]; then',
|
||||||
' echo 0 > ${VARDIR}/${1}.state',
|
' echo 0 > ${VARDIR}/${1}.state',
|
||||||
' else',
|
' else',
|
||||||
' echo 1 > ${VARDIR}/${1}.state',
|
' echo 1 > ${VARDIR}/${1}.state',
|
||||||
' fi',
|
' fi' );
|
||||||
'',
|
} else {
|
||||||
|
emit( "$interfaces)",
|
||||||
|
' if [ "$COMMAND" = up ]; then',
|
||||||
|
" echo 0 > \${VARDIR}/$interfaces.state",
|
||||||
|
' else',
|
||||||
|
" echo 1 > \${VARDIR}/$interfaces.state",
|
||||||
|
' fi' );
|
||||||
|
}
|
||||||
|
|
||||||
|
emit( '',
|
||||||
' if [ "$state" = started ]; then',
|
' if [ "$state" = started ]; then',
|
||||||
' COMMAND=restart',
|
' COMMAND=restart',
|
||||||
' progress_message3 "$g_product attempting restart"',
|
' progress_message3 "$g_product attempting restart"',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user