gaenserich / hostsblock

an ad- and malware-blocking script for Linux
https://github.com/gaenserich/hostsblock
225 stars 28 forks source link

Feature request: option to check updates only #41

Open Sadi58 opened 9 years ago

Sadi58 commented 9 years ago

I don't know if this is very easy (e.g. a little modification in the "DOWNLOAD BLOCKLISTS" section of hostsblock.sh) or difficult to implement without much change in the present code, but I thought it would be very handy if we could enter a command like hostsblock.sh -v 3 -checkonly &>/tmp/hostsblock-lists-status.log to see if there are any pending updates.

Note: What I have in mind actually is to try and create, in due course, an app indicator similar to https://github.com/Sadi58/grive-indicator and https://github.com/Sadi58/indicator-chars And my "work-in-progress" to this end (adding several files under subfolder ./src/indicator/ only) is now here: https://github.com/Sadi58/hostsblock/tree/master/src/indicator

pickfire commented 8 years ago

@Sadi58 What is the progress on this? Can you implement it yourself?

Sadi58 commented 8 years ago

No progress on a possible "check-updates-only" option. I don't think I can do it.

gaenserich commented 8 years ago

There is a limitation in curl which makes this a little cumbersome. The "-z" option compares modtimes between the files on the server and the local cached file. If the former is newer than the latter, it downloads the former to replace the latter. I don't think curl will not download if it sees there is a newer remote file.

That said, I'm sure there's some sort of way to check this, albeit it would definitely add complexity. We'd have to add a bunch of new conditionals to stop any files from being written given the "check-updates-only" flag.

pickfire commented 8 years ago

@gaenserich I thought the curl -z option is implemented, but when I check it, it isn't.

I think there is an alternative to it, the -R which can show the remote file time and check it with epoch time of the file as it is better and more accurate, still need more research.