Use 'date' format for compiletime rather than localtime format

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2016-05-06 13:28:22 -07:00
parent d4df67966d
commit 0d16b2820a
7 changed files with 25 additions and 13 deletions

View File

@ -244,7 +244,7 @@ sub create_arptables_load( $ ) {
emit "exec 3>\${VARDIR}/.arptables-input"; emit "exec 3>\${VARDIR}/.arptables-input";
my $date = localtime; my $date = compiletime;
unless ( $test ) { unless ( $test ) {
emit_unindented '#'; emit_unindented '#';
@ -294,7 +294,7 @@ sub create_arptables_load( $ ) {
# #
sub preview_arptables_load() { sub preview_arptables_load() {
my $date = localtime; my $date = compiletime;
print "#\n# Generated by Shorewall $globals{VERSION} - $date\n#\n"; print "#\n# Generated by Shorewall $globals{VERSION} - $date\n#\n";

View File

@ -8575,7 +8575,7 @@ sub create_netfilter_load( $ ) {
enter_cat_mode; enter_cat_mode;
my $date = localtime; my $date = compiletime;
unless ( $test ) { unless ( $test ) {
emit_unindented '#'; emit_unindented '#';
@ -8683,7 +8683,7 @@ sub preview_netfilter_load() {
enter_cat_mode1; enter_cat_mode1;
my $date = localtime; my $date = compiletime;
print "#\n# Generated by Shorewall $globals{VERSION} - $date\n#\n"; print "#\n# Generated by Shorewall $globals{VERSION} - $date\n#\n";
@ -8919,7 +8919,7 @@ sub create_stop_load( $ ) {
enter_cat_mode; enter_cat_mode;
unless ( $test ) { unless ( $test ) {
my $date = localtime; my $date = compiletime;
emit_unindented '#'; emit_unindented '#';
emit_unindented "# Generated by Shorewall $globals{VERSION} - $date"; emit_unindented "# Generated by Shorewall $globals{VERSION} - $date";
emit_unindented '#'; emit_unindented '#';

View File

@ -90,7 +90,7 @@ sub generate_script_1( $ ) {
if ( $test ) { if ( $test ) {
emit "#!$config{SHOREWALL_SHELL}\n#\n# Compiled firewall script generated by Shorewall-perl\n#"; emit "#!$config{SHOREWALL_SHELL}\n#\n# Compiled firewall script generated by Shorewall-perl\n#";
} else { } else {
my $date = localtime; my $date = compiletime;
emit "#!$config{SHOREWALL_SHELL}\n#\n# Compiled firewall script generated by Shorewall $globals{VERSION} - $date\n#"; emit "#!$config{SHOREWALL_SHELL}\n#\n# Compiled firewall script generated by Shorewall $globals{VERSION} - $date\n#";
@ -600,7 +600,7 @@ EOF
# Generate info_command() # Generate info_command()
# #
sub compile_info_command() { sub compile_info_command() {
my $date = localtime; my $date = compiletime;
emit( "\n", emit( "\n",
"#", "#",

View File

@ -84,6 +84,8 @@ our @EXPORT = qw(
require_capability require_capability
report_used_capabilities report_used_capabilities
kernel_version kernel_version
compiletime
); );
our @EXPORT_OK = qw( $shorewall_dir initialize shorewall); our @EXPORT_OK = qw( $shorewall_dir initialize shorewall);
@ -681,6 +683,8 @@ our %ipsets; # All required IPsets
# #
our %filecache; our %filecache;
our $compiletime;
sub process_shorewallrc($$); sub process_shorewallrc($$);
sub add_variables( \% ); sub add_variables( \% );
# #
@ -1172,6 +1176,10 @@ sub initialize( $;$$) {
%shorewallrc1 = %shorewallrc unless $shorewallrc1; %shorewallrc1 = %shorewallrc unless $shorewallrc1;
add_variables %shorewallrc1; add_variables %shorewallrc1;
$compiletime = `date`;
chomp $compiletime;
} }
my @abbr = qw( Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec ); my @abbr = qw( Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec );
@ -1184,6 +1192,10 @@ sub all_ipsets() {
sort keys %ipsets; sort keys %ipsets;
} }
sub compiletime() {
$compiletime;
}
# #
# Create 'currentlineinfo' # Create 'currentlineinfo'
# #

View File

@ -302,7 +302,7 @@ sub convert_blacklist() {
if ( @rules ) { if ( @rules ) {
my $fn1 = find_writable_file( 'blrules' ); my $fn1 = find_writable_file( 'blrules' );
my $blrules; my $blrules;
my $date = localtime; my $date = compiletime;
if ( -f $fn1 ) { if ( -f $fn1 ) {
open $blrules, '>>', $fn1 or fatal_error "Unable to open $fn1: $!"; open $blrules, '>>', $fn1 or fatal_error "Unable to open $fn1: $!";
@ -393,7 +393,7 @@ sub convert_routestopped() {
my ( @allhosts, %source, %dest , %notrack, @rule ); my ( @allhosts, %source, %dest , %notrack, @rule );
my $seq = 0; my $seq = 0;
my $date = localtime; my $date = compiletime;
my ( $stoppedrules, $fn1 ); my ( $stoppedrules, $fn1 );
@ -421,7 +421,7 @@ EOF
first_entry( first_entry(
sub { sub {
my $date = localtime; my $date = compiletime;
progress_message2 "$doing $fn..."; progress_message2 "$doing $fn...";
print( $stoppedrules print( $stoppedrules
"#\n" , "#\n" ,

View File

@ -368,7 +368,7 @@ sub setup_conntrack($) {
if ( $convert ) { if ( $convert ) {
my $conntrack; my $conntrack;
my $empty = 1; my $empty = 1;
my $date = localtime; my $date = compiletime;
if ( $fn ) { if ( $fn ) {
open $conntrack, '>>', $fn or fatal_error "Unable to open $fn for notrack conversion: $!"; open $conntrack, '>>', $fn or fatal_error "Unable to open $fn for notrack conversion: $!";

View File

@ -2166,7 +2166,7 @@ sub convert_tos($$) {
if ( my $fn = open_file 'tos' ) { if ( my $fn = open_file 'tos' ) {
first_entry( first_entry(
sub { sub {
my $date = localtime; my $date = compiletime;
progress_message2 "Converting $fn..."; progress_message2 "Converting $fn...";
print( $mangle print( $mangle
"#\n" , "#\n" ,
@ -2332,7 +2332,7 @@ sub setup_tc( $ ) {
first_entry( first_entry(
sub { sub {
my $date = localtime; my $date = compiletime;
progress_message2 "Converting $fn..."; progress_message2 "Converting $fn...";
print( $mangle print( $mangle
"#\n" , "#\n" ,