]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/commitdiff
ids-functions.pl: Introduce drop_dl_rulesfile().
authorStefan Schantl <stefan.schantl@ipfire.org>
Wed, 31 Mar 2021 09:26:24 +0000 (11:26 +0200)
committerStefan Schantl <stefan.schantl@ipfire.org>
Sun, 19 Dec 2021 12:23:00 +0000 (13:23 +0100)
This tiny function is used, to delete the stored rulesfile in case a
provider will be deleted.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
config/cfgroot/ids-functions.pl

index 89fee83ff934123a2b96ea6baa7df25e20ab8acd..ef4c74a578f1403c021b985b3d261784f37c8c81 100644 (file)
@@ -837,6 +837,22 @@ sub _get_dl_rulesfile($) {
        return $rulesfile;
 }
 
+#
+## Tiny function to delete the stored ruleset file or tarball for a given provider.
+#
+sub drop_dl_rulesfile ($) {
+       my ($provider) = @_;
+
+       # Gather the full path and name of the stored rulesfile.
+       my $rulesfile = &_get_dl_rulesfile($provider);
+
+       # Check if the given rulesfile exists.
+       if (-f $rulesfile) {
+               # Delete the stored rulesfile.
+               unlink($rulesfile) or die "Could not delete $rulesfile. $!\n";
+       }
+}
+
 #
 ## Function to check if the IDS is running.
 #