mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-26 02:42:58 +02:00
xt_geoip_update: Always call the cleanup function when some step fails
Signed-off-by: Daniel Weismüller <daniel.weismueller@ipfire.org> Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
This commit is contained in:
committed by
Arne Fitzenreiter
parent
7b2d933055
commit
a18addb946
@@ -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
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
|
||||
# Remove temporary files.
|
||||
cleanup || exit $?
|
||||
# Cleanup
|
||||
cleanup || return $?
|
||||
|
||||
# Convert the ruleset.
|
||||
build || exit $?
|
||||
|
||||
# Convert GeoIP2 to lagacy.
|
||||
build_legacy || exit $?
|
||||
|
||||
# Remove temporary files.
|
||||
cleanup || exit $?
|
||||
# All done
|
||||
return 0
|
||||
}
|
||||
|
||||
# Run the main function.
|
||||
main
|
||||
main || exit $?
|
||||
|
||||
Reference in New Issue
Block a user