Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Reviewed-by: Peter Müller <peter.mueller@ipfire.org>
Reviewed-by: Michael Tremer <michael.tremer@ipfire.org>
sub ipset_restore ($) {
my ($ccode) = @_;
sub ipset_restore ($) {
my ($ccode) = @_;
- # Run ipset and restore the list of the given country code.
- run("$IPSET restore < $Location::Functions::ipset_db_directory/$ccode.ipset4");
+ my $file_prefix = "ipset4";
+ my $db_file = "$Location::Functions::ipset_db_directory/$ccode.$file_prefix";
+
+ # Check if the generated file exists.
+ if (-f $db_file) {
+ # Run ipset and restore the list of the given country code.
+ run("$IPSET restore < $db_file");
+ }