]> git.ipfire.org Git - people/mfischer/ipfire-2.x.git/blobdiff - src/scripts/update-location-database
Merge branch 'master' into next
[people/mfischer/ipfire-2.x.git] / src / scripts / update-location-database
index ebed5a095bd6b609f9f61f3d24ab075afda86d73..24970dc084e30ee032332430f1f39c84acb6b947 100644 (file)
@@ -2,7 +2,7 @@
 ###############################################################################
 #                                                                             #
 # IPFire.org - A linux based firewall                                         #
-# Copyright (C) 2019 IPFire Development Team <info@ipfire.org>                #
+# Copyright (C) 2007-2022  IPFire Team  <info@ipfire.org>                     #
 #                                                                             #
 # This program is free software: you can redistribute it and/or modify        #
 # it under the terms of the GNU General Public License as published by        #
@@ -21,6 +21,8 @@
 
 eval $(/usr/local/bin/readhash /var/ipfire/proxy/settings)
 
+UPDATE_INTERVAL="weekly"
+
 # Proxy settings.
 # Check if a proxy should be used.
 if [[ $UPSTREAM_PROXY ]]; then
@@ -39,7 +41,11 @@ if [[ $UPSTREAM_PROXY ]]; then
 fi
 
 # Get the latest location database from server.
-/usr/bin/location-downloader update
+if /usr/bin/location update --cron=$UPDATE_INTERVAL; then
+       # Call location and export all countries in an ipset compatible format.
+       if /usr/bin/location export --directory=/var/lib/location/ipset --family=ipv4 --format=ipset; then
 
-# Call initscript to reload the firewall.
-/etc/init.d/firewall reload
+               # Call initscript to reload the firewall.
+               /etc/init.d/firewall reload
+       fi
+fi