]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blobdiff - src/initscripts/networking/red.up/99-geoip-database
99-geoip-database: Fix download
[people/pmueller/ipfire-2.x.git] / src / initscripts / networking / red.up / 99-geoip-database
index 335006a690a4009eb7d0fe268b5306171315ca52..9b024a8d0c82fd74cd1cf93397a31bce440c67f0 100644 (file)
@@ -1,22 +1,19 @@
 #!/bin/bash
 
-# Get the GeoIP database if no one exists yet.
+# Get the GeoIP database if no one exists yet
 
-DIR="/usr/share/xt_geoip/*"
+database_exists() {
+       local file
+       for file in /usr/share/xt_geoip/*.iv4; do
+               [ -e "${file}" ] && return 0
+       done
 
-found=false
-
-# Check if the directory contains any data.
-for i in $DIR; do
-       # Ignore "." and ".."
-       if [ -d "$i" ]; then
-               found=true
-               break
-       fi
-done
+       # Does not exist
+       return 1
+}
 
 # Download ruleset if none has been found.
-if ! ${found}; then
+if ! database_exists; then
        /usr/local/bin/xt_geoip_update >/dev/null 2>&1 &
 fi