diff options
author | Marvin Borner | 2023-08-29 15:44:16 +0200 |
---|---|---|
committer | Marvin Borner | 2023-08-29 15:46:00 +0200 |
commit | 8f6e86ee72a20fc9bbac62d71e0921b152eaa0bb (patch) | |
tree | 2feb0ee3276bc24ab847a57938fd9fc281b260d7 /.scripts/adblock | |
parent | e6e5c70f6cc741e0edee2f0c1de07909d1c91edc (diff) |
Sync
Not much tbh. I'm fairly happy with my setup
Diffstat (limited to '.scripts/adblock')
-rwxr-xr-x | .scripts/adblock | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/.scripts/adblock b/.scripts/adblock index 3fdbb97..a6d7c44 100755 --- a/.scripts/adblock +++ b/.scripts/adblock @@ -1,9 +1,21 @@ #!/bin/bash -if grep -Fxq "##START" /etc/hosts; then - sudo sed -i "/##START/,/##END/s/#\(.\)/\1/" /etc/hosts +if grep -xq "^##START" /etc/hosts; then + echo "enabling..." + sudo sed -i "/^##START/,/^##END/s/#\(.\)/\1/" /etc/hosts + sudo mv /etc/opensnitchd/adblock/stevenblack /etc/opensnitchd/adblock/stevenblack.txt + while true; do + sleep 0.5s + dig adservice.google.com &>/dev/null || break + done notify-send "Enabled adblock!" else - sudo sed -i "/#START/,/#END/s/./#&/" /etc/hosts + echo "disabling..." + sudo sed -i "/^#START/,/^#END/s/./#&/" /etc/hosts + sudo mv /etc/opensnitchd/adblock/stevenblack.txt /etc/opensnitchd/adblock/stevenblack + while true; do + sleep 0.5s + dig adservice.google.com &>/dev/null && break + done notify-send "Disabled adblock!" fi |