Allow compile to STDOUT

This commit is contained in:
Tom Eastep 2009-04-21 09:41:23 -07:00
parent e465fea86a
commit b6090948dd
3 changed files with 27 additions and 3 deletions

View File

@ -1084,6 +1084,14 @@ sub create_temp_object( $$ ) {
my ( $objectfile, $export ) = @_; my ( $objectfile, $export ) = @_;
my $suffix; my $suffix;
if ( $objectfile eq '-' ) {
$verbose = -1;
$object = undef;
open( $object, '>&STDOUT' ) or fatal_error "Open of STDOUT failed";
$file = '-';
return 1;
}
eval { eval {
( $file, $dir, $suffix ) = fileparse( $objectfile ); ( $file, $dir, $suffix ) = fileparse( $objectfile );
}; };
@ -1118,9 +1126,12 @@ sub finalize_object( $ ) {
my $export = $_[0]; my $export = $_[0];
close $object; close $object;
$object = 0; $object = 0;
if ( $file ne '-' ) {
rename $tempfile, $file or fatal_error "Cannot Rename $tempfile to $file: $!"; rename $tempfile, $file or fatal_error "Cannot Rename $tempfile to $file: $!";
chmod 0700, $file or fatal_error "Cannot secure $file for execute access"; chmod 0700, $file or fatal_error "Cannot secure $file for execute access";
progress_message3 "Shorewall configuration compiled to $file" unless $export; progress_message3 "Shorewall configuration compiled to $file" unless $export;
}
} }
# #

View File

@ -4,6 +4,8 @@ Changes in Shorewall 4.3.10
2) Add WIDE_TC_MARKS option. 2) Add WIDE_TC_MARKS option.
3) Allow compile to STDOUT.
Changes in Shorewall 4.3.9 Changes in Shorewall 4.3.9
1) Logging rules now create separate chain. 1) Logging rules now create separate chain.

View File

@ -104,6 +104,17 @@ None.
column) must be >= 65536 (0x10000) and must be a multiple of 65536 column) must be >= 65536 (0x10000) and must be a multiple of 65536
(0x1000, 0x20000, 0x30000, ...). (0x1000, 0x20000, 0x30000, ...).
2. In the 'shorewall compile' command, the filename '-' is now causes
the compiled script to be written to Standard Out. As a side
effect, the effective VERBOSITY is set to -1 (silent).
Examples:
shorewall compile -- - # Compile /etc/shorewall and send the
# output to STDOUT
shorewall compile . - # Compile the current working directory
# and send the output to STDOUT
---------------------------------------------------------------------------- ----------------------------------------------------------------------------
N E W F E A T U R E S IN 4 . 3 N E W F E A T U R E S IN 4 . 3
---------------------------------------------------------------------------- ----------------------------------------------------------------------------