mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-05-11 09:48:24 +02:00
Make firewall convert scripts more robust.
The converter scripts procude a lot of error, when they get executed on a system with a previously installed version of the New Firewall or they get run twice. In this case the scripts will detect that their input files are missing and will exit with an error message. The scripts now also check if the input files are empty (no corresponding rules created) and will exit with an nothing to do message.
This commit is contained in:
@@ -36,6 +36,17 @@ my ($key,$flag,$prot,$ipfireport,$target,$targetport,$active,$alias,$source,$rem
|
||||
my ($key1,$flag1,$prot1,$ipfireport1,$target1,$targetport1,$active1,$alias1,$source1,$remark1);
|
||||
my $count=0;
|
||||
my $jump;
|
||||
|
||||
if (! -e "$portfwconfig") {
|
||||
print "Config file for portforward not found. Exiting!\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (! -s "$portfwconfig") {
|
||||
print "Empty portforward configuration file. Nothing to do. Exiting...\n";
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if(! -d "/var/log/converters"){ mkdir("/var/log/converters");}
|
||||
open(FILE, $portfwconfig) or die 'Unable to open config file.';
|
||||
my @current = <FILE>;
|
||||
|
||||
Reference in New Issue
Block a user