Skip to content

Commit 6faabd1

Browse files
author
SMKRV
committed
refactor: Enhanced MD5 source validation for more reliable change detection, and upgraded filtration mechanisms
fix: shellcheck errors
1 parent ec7d06f commit 6faabd1

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

scripts/mikrotik-domain-filter-bash.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export LOG_FILE
8080
export DNS_MAX_RETRIES
8181

8282
# Global variables for statistics
83-
declare -i TOTAL_DOMAINS=0
83+
# declare -i TOTAL_DOMAINS=0
8484

8585
# Enable debugging
8686
# exec 2>"${WORK_DIR}/debug.log"
@@ -147,7 +147,6 @@ release_lock() {
147147
}
148148

149149
# Signal handling
150-
trap trap_cleanup EXIT
151150
trap 'log "Script interrupted"; trap_cleanup' INT TERM
152151

153152
init_directories() {
@@ -340,7 +339,8 @@ trap_cleanup() {
340339
}
341340

342341
save_state() {
343-
local temp_state="${STATE_DIR}/state_$(date +%s).tmp"
342+
local temp_state
343+
temp_state="${STATE_DIR}/state_$(date +%s).tmp"
344344
local main_md5 special_md5
345345

346346
log "Saving state..."
@@ -1479,7 +1479,7 @@ check_updates_needed() {
14791479
log "WARNING: Failed to clean temporary files"
14801480
fi
14811481

1482-
return $(( update_needed == true ? 0 : 1 ))
1482+
return $(( update_needed == 1 ? 0 : 1 ))
14831483
}
14841484

14851485
# Helper function to restore backups
@@ -1724,4 +1724,5 @@ if ! main "$@"; then
17241724
exit 1
17251725
fi
17261726

1727+
trap_cleanup
17271728
exit 0

0 commit comments

Comments
 (0)