So does \| and | count as beginning and end of statement, and the ^ means at the beginning of line and $ means at the end of line? And !d means delete anything not matching? And ; means start of second statement?
Also @Wizballs someone on IRC explained that we can get whether service is enabled using 'service adblock-oisd enabled' and then checking $?. So a line could be placed inside Scheduled Tasks to call 'service adblock-oisd start' if $? is 0, i.e. adblock-oisd service is enabled.
Hey yeah that's what geat about this community everyone helps each other. Definitely there is always room for more options, everyone has different wants/needs. Plus if everyone's project can improve/benefit from others works, then even better!
simp-adb will always have it place with a nice Luci interface etc. There's a few thing I would (selfishly) like to see in there, but that is totally up to @stangri and his direction with that already awesome work.
Personally I'm focused on oisd for it's hands-free ease of use. Don't care if a few ads get through, and websites work and don't break (especially for the family)
I'm thinking it would be best to not delete the blocklist on DNSMasq restart because if for whatever reason it restarted (by https-dns-proxy for example) then you now running with no blocklist at all until the next refresh.
The current OISD full list is only 8.3MB. If a user is that short on RAM they aren't doing this anyway.
An alternative might be to modify the dnsmasq service file to gunzip and then store back to gzip the log file upon restart like what I've implemented in my script when replacing old oisd.txt with new one in case the checks fail.
Not sure if this is the best thing to be doing, but that's part of my first draft. Suggestions welcome!
If this fails, then if a previous oisd.txt was available (stored as .gz file to avoid eating up too much RAM) it will fallback to that, recheck, and if checks succeed then stick with the previous oisd.txt. If even those checks based on the previous oisd.txt fail, it will then fallback to not using any oisd.txt at all.
My script retains the oisd.txt in /tmp/dnsmasq.d/ to avoid any issues with external dnsmasq restarts and only uses the .gz store when attempting to swap out to a new oisd.txt in case the swap fails so that it can revert back to the old one.
And you need something to check if "oisd" is working. So for example take the last address line from the blocklist and check if that is blocked. That would be a proper indicator I think.
But only from the perspective of compatibility. IMHO sh/ash/dash are way to restricted, as if they aim to make creating useful programs in shell hard to steer people to other languages
It sure feels that way doesn't it? As you progress (assuming that you are not a veteran shell programmer) that bar will drop significantly. But something like this should not suffer because of it
Yes this - test after apply oisd.txt. I'm leaning towards internet connectivity as an absolute priority, especially with cctv and home automation etc. Side effect is for example, if the internet dropped out momentarily at exactly the wrong time, this would of course restart dnsmasq without oisd.txt.
But yeah any feedback on if this is actually needed or a better way? Eg would there ever be a case where dnsmasq is running but internet is blocked due to a bad oisd.txt??
OK your comment about sh preyed on my mind. After all, the premise of my script is that it is supposed to be super simple - and the bash dependency undermined that. So I switched from bash over to sh: