From 953dcf3b0d1011bc73daa92d19cf5b3479bd709a Mon Sep 17 00:00:00 2001 From: BrPrs <93455507+BrPrS@users.noreply.github.com> Date: Mon, 15 Jul 2024 09:42:15 +0330 Subject: [PATCH] fix(): Add trap to restore resolv.conf.backup on SIGINT (#32) * add trap to restore resolv.conf.backup on SIGINT Edit last echo of trap to be prettier a bit. --- best403unlocker | 1 + 1 file changed, 1 insertion(+) diff --git a/best403unlocker b/best403unlocker index 8b3e552..6ecb8ce 100755 --- a/best403unlocker +++ b/best403unlocker @@ -1,6 +1,7 @@ #!/usr/bin/env bash DATABASE=best403unlocker_database_$(date +%s) DATABASE_PATH=/tmp/$DATABASE +trap 'echo -e "\n";sudo cat /etc/resolv.conf.bakup > /etc/resolv.conf;rm /etc/resolv.conf.bakup; echo -e "/etc/resolv.conf is changed to default.\nExiting..."; exit' SIGINT # Functions check_run_with_root_accsses(){ if [ "$EUID" -ne 0 ]; then