]> git.ipfire.org Git - people/stevee/ipfire-2.x.git/commitdiff
ids-functions.pl: Add cleanup_tmp_directory() function.
authorStefan Schantl <stefan.schantl@ipfire.org>
Wed, 31 Mar 2021 08:45:14 +0000 (10:45 +0200)
committerStefan Schantl <stefan.schantl@ipfire.org>
Sun, 19 Dec 2021 12:22:59 +0000 (13:22 +0100)
As the name of the function already says, it is responsible to
delete all temporary files after ruleset generation.

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

index 1602c42a966bc6109dbc9d855e79aff4023bfbbe..7d2ae802e2379df09982b7311b118851a035471c 100644 (file)
@@ -603,8 +603,7 @@ sub oinkmaster () {
        &merge_sid_msg(@enabled_providers);
 
        # Cleanup temporary directory.
-       # XXX - not implemented yet.
-       # &cleanup_tmp_directory();
+       &cleanup_tmp_directory();
 }
 
 #
@@ -741,6 +740,17 @@ sub merge_sid_msg (@) {
        close(FILE);
 }
 
+#
+## Function to cleanup the temporary IDS directroy.
+#
+sub cleanup_tmp_directory () {
+       # Load rmtree() function from file path perl module.
+       use File::Path 'rmtree';
+
+       # Delete temporary directory and all containing files.
+       rmtree([ "$tmp_directory" ]);
+}
+
 #
 ## Function to do all the logging stuff if the downloading or updating of the ruleset fails.
 #