mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-01-24 05:26:28 +01:00
Implement cleanup for temporary files in iptables-restore
Add cleanup function to remove temporary files on exit.
This commit is contained in:
@@ -7,8 +7,10 @@ if [[ ! -x "${REAL_IPTABLES_RESTORE}" ]]; then
|
||||
fi
|
||||
|
||||
cleanup() {
|
||||
local exit_code=$?
|
||||
[[ -n "${RULES_FILE:-}" && -f "${RULES_FILE}" ]] && rm -f "${RULES_FILE}"
|
||||
[[ -n "${SANITIZED_FILE:-}" && -f "${SANITIZED_FILE}" ]] && rm -f "${SANITIZED_FILE}"
|
||||
return $exit_code
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
|
||||
Reference in New Issue
Block a user