The temporary files were never being cleaned up after the script has finished compiling the database.
Signed-off-by: Daniel Weismüller daniel.weismueller@ipfire.org --- src/scripts/xt_geoip_update | 1 - 1 file changed, 1 deletion(-)
diff --git a/src/scripts/xt_geoip_update b/src/scripts/xt_geoip_update index 9ea66e006..f3ba8a52e 100644 --- a/src/scripts/xt_geoip_update +++ b/src/scripts/xt_geoip_update @@ -140,7 +140,6 @@ function main() {
# Convert GeoIP2 to lagacy. build_legacy || exit $? - return 0
# Remove temporary files. cleanup || exit $?
Since we have some systems that are restricted to only 2GB of space on /, we need to move this to where we have enough space.
Signed-off-by: Daniel Weismüller daniel.weismueller@ipfire.org --- src/scripts/xt_geoip_update | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/scripts/xt_geoip_update b/src/scripts/xt_geoip_update index f3ba8a52e..f633229fb 100644 --- a/src/scripts/xt_geoip_update +++ b/src/scripts/xt_geoip_update @@ -19,7 +19,7 @@ # # ###############################################################################
-TMP_PATH=$(mktemp -d) +TMP_PATH=$(mktemp -dp /var/tmp) TMP_FILE=$(mktemp -p $TMP_PATH)
SCRIPT_PATH=/usr/local/bin
These already exist
Signed-off-by: Daniel Weismüller daniel.weismueller@ipfire.org --- src/scripts/xt_geoip_update | 6 ------ 1 file changed, 6 deletions(-)
diff --git a/src/scripts/xt_geoip_update b/src/scripts/xt_geoip_update index f633229fb..6c0b70db0 100644 --- a/src/scripts/xt_geoip_update +++ b/src/scripts/xt_geoip_update @@ -35,9 +35,6 @@ eval $(/usr/local/bin/readhash /var/ipfire/proxy/settings) function download() { echo "Downloading latest GeoIP ruleset..."
- # Create temporary directory. - mkdir -pv $TMP_PATH - # Proxy settings. # Check if a proxy should be used. if [[ $UPSTREAM_PROXY ]]; then @@ -84,9 +81,6 @@ function install() { }
function build_legacy() { - # Create temporary directory. - mkdir -pv $TMP_PATH - echo "Convert database to legacy GeoIP.dat ..." cat $DB_PATH/GeoLite2-Country-Blocks-IPv4.csv | \ $DB1_PATH/bin/geolite2-to-legacy-csv.sh $DB1_PATH/bin/countryInfo.txt > \
Signed-off-by: Daniel Weismüller daniel.weismueller@ipfire.org --- src/scripts/xt_geoip_update | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-)
diff --git a/src/scripts/xt_geoip_update b/src/scripts/xt_geoip_update index 6c0b70db0..ebd266533 100644 --- a/src/scripts/xt_geoip_update +++ b/src/scripts/xt_geoip_update @@ -117,27 +117,22 @@ function cleanup() { }
function main() { - # Download ruleset. - download || exit $? + local func + for func in download install build build_legacy; do + if ! ${func}; then + # Cleanup any temporary data + cleanup
- if ! install; then - # Do cleanup. - cleanup || exit $? - exit 1 - fi - - # Remove temporary files. - cleanup || exit $? - - # Convert the ruleset. - build || exit $? + return 1 + fi + done
- # Convert GeoIP2 to lagacy. - build_legacy || exit $? + # Cleanup + cleanup || return $?
- # Remove temporary files. - cleanup || exit $? + # All done + return 0 }
# Run the main function. -main +main || exit $?