]> git.ipfire.org Git - people/stevee/ipfire-2.x.git/commitdiff
update-ipblocklists: Adjust code to work with latest
authorStefan Schantl <stefan.schantl@ipfire.org>
Fri, 14 Apr 2023 16:15:22 +0000 (18:15 +0200)
committerStefan Schantl <stefan.schantl@ipfire.org>
Sun, 3 Mar 2024 11:56:02 +0000 (12:56 +0100)
ipblocklist-function.pl changes

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
src/scripts/update-ipblocklists

index a17b4799914e835d36eebb8cc3c1c1bb3ca08674..4eb1edb7f81cb926664d545e94e528adfc6ee5aa 100644 (file)
@@ -93,7 +93,7 @@ foreach my $blocklist (@blocklists) {
        }
        
        # Try to download and update the blocklist.
-       my $return = &IPblocklist::download_and_create_blocklist($blocklist);
+       my $return = &IPblocklist::download_blocklist($blocklist);
 
        # Check if we got a return code.
        if ($return) {
@@ -110,10 +110,10 @@ foreach my $blocklist (@blocklists) {
                }
        } else {
                # Get the filename of the blocklist.
-               my $ipset_db_file = &IPblocklist::get_ipset_db_file($blocklist);
+               my $cached_file = &IPblocklist::get_cached_blocklist_file($blocklist);
 
                # Set the correct ownership.
-               &IPblocklist::set_ownership($ipset_db_file);
+               &IPblocklist::set_ownership($cached_file);
 
                # Log successfull update.
                &_log_to_syslog("<INFO> Successfully updated $blocklist blocklist.");
@@ -128,23 +128,8 @@ if (@updated_blocklists) {
        # Set correct ownership to the modified file.
        &IPblocklist::set_ownership($IPblocklist::modified_file);
 
-       # Loop through the array.
-       foreach my $updated_blocklist (@updated_blocklists) {
-               # Get the blocklist file.
-               my $ipset_db_file = &IPblocklist::get_ipset_db_file($updated_blocklist);
-
-               # Call safe system function to reload/update the blocklist.
-               &General::safe_system("ipset", "restore", "-f", "$ipset_db_file");
-
-               # The set name contains a "v4" as suffix.
-               my $set_name = "$updated_blocklist" . "v4";
-
-               # Swap the sets to use the new one.
-               &General::safe_system("ipset", "swap", "$set_name", "$updated_blocklist");
-
-               # Destroy the old blocklist.
-               &General::safe_system("ipset", "destroy", "$set_name");
-       }
+       # Regenerate blocklists.
+       &IPblocklist::load_blocklists();
 }
 
 END {