Edit: All credit goes to Macskeeball, mstombs, mraneri, the host of pgl.yoyo.org and everyone else who helped!! The above script works. As I stated before I cannot post in the other thread for some reason and I wanted to ask the below question:

There still exists the issue of having NO adblocking at all upon reboot and list host being down; I am going to try to resolve by making a single backup to jffs and have the script use that if necessary. Unless someone has a better idea ??

There still exists the issue of having NO adblocking at all upon reboot and list host being down; I am going to try to resolve by making a single backup to jffs and have the script use that if necessary. Unless someone has a better idea ??

Click to expand...

I guess I can't do this with my script! Maximum Wan Up script size is 4096 bytes and I can't put anymore into it. I suppose I need to take out some "features"

Edit: Ok I took out alot of things (I wish I didn't have to) but here is my "Lean Version" I am working with

You can do it, you just can't do it with the current firmware. Or is that a limitation on the actual file size? I planned on placing my script in the init.d directory and have it run after the network up script.

Note: I am using OpenWRT and not tomato, but its all about the same.

EDIT: It also looks like I will need to change the cru statement, since OpenWRT does not have this feature.

Instructions
========================================================
This requires that you already have a known good adblock.conf downloaded, otherwise you may have to ftp the file from your computer.

You only have to do this one time! Or if you feel the backup needs to be updated, do it again at a later date.

1. Edit scripts from this page and save them to your computer.

2. Using a web browser - log into your router

3. Go to administration > admin access

4. Enable (and start) the Telnet Daemon

5. Administration > jffs2
Enable jffs2, click on format/erase, wait then click save at the bottom of the page

6. Telnet into the router (open a command prompt, then run "telnet routerIP" with your router IP, of course ) and log in

This thread is getting a little complicated for some to follow.....peeps posting bits of scripts all over.....can it be pulled together at all?

Click to expand...

Well there is basically just 3 versions (Fat:first version listed, Lean, and Lean Backup), I was considering doing the "Fat Backup" version but I figured people could just add in the function; "usebackup" themselves.

Why can't the "fat" script be stored in JFFS too and called during bootup?

Click to expand...

As far as adding to jffs.. you can do that (you HAVE to do that for "fat backup" version) but I don't know if everyone knows how to ftp files to the router or adding files by other means... and didn't feel like writing all instructions for that, If someone wants to post all that; feel free.

I have mine set to download MVPS list as default and pgl as backup here is my log

Click to expand...

I'm all confused with what's going on here. But it really doesn't matter.
You may want to consider, when MVPS is not available, to use the previous MVPS list (except when you don't have ANY list... i.e. after a reboot)

Could the script backup the file to jffs before it tries updating from the site?
Then if unsuccessful it can pull the file back from jffs.

Click to expand...

Yes it could provided it already has a list file downloaded. The problem would be when you reboot, its gone... so you can't really backup if it's not there, you could check in script to see if it exists (if [ -x /file ]) first before trying to back up.

On another note, I am wondering if it would be of any advantage to parse MVPS's list into the Dnsmasq (address=) format and use mvps list in dnsmasq??

=========================================================
Edit:
Well here is Mvps list being parsed into dnsmasq format... I don't know if this helps with performance, but figured worth trying.

REMEMBER TO CHANGE CRU STATEMENT TO YOUR OWN INTERVAL and CHANGE the Dnsmasq Custom config box to conf-file=/etc/adblock.conf

yaqui, the only problem with the changing MVPS host list into a dnsmasq list is it will include quite a few duplicates (all the doubleclick entries could be just one statement). Not sure if it will create any speed issues.

yasui, I tried to redirect to 0.0.0.0 instead of 127.0.0.1 because I don't have a web server on my computer, and the response comes faster. you can test with http://0.0.0.0
I replaced the 2nd 127.0.0.1 in the downloadmvps function to try it on the router.
but I don't know sed, so I can't really update downloadpgl.

yasui, I tried to redirect to 0.0.0.0 instead of 127.0.0.1 because I don't have a web server on my computer, and the response comes faster.

Click to expand...

I agree. This is a great improvement. For some reason 0.0.0.0 comes back faster for me too. I've updated my script to use sed as shown above by yaqui to remove the comments at the end of the lines as well as replace 127.0.0.1's with 0.0.0.0's. You can find the update in about 5 minutes over on that thread, HERE.

Thanks to yaqui for the sed syntax and sroquette for discovering the performance improvement. (Note, the improvement isn't on the router, it's on my windows machines, which for some reason delay 1/2 a second or so before returning on 127.0.0.1).

yaqui, the only problem with the changing MVPS host list into a dnsmasq list is it will include quite a few duplicates (all the doubleclick entries could be just one statement). Not sure if it will create any speed issues.

Click to expand...

I've been working on sed and awk statements to remove a bunch of duplicates... kind of difficult to do because generalizing the statements is not working out so well. It seems like it will work better with a list of the main duplicates to be removed, which is not the ideal situation.

Edit: So far (as far as generalized statements) I came up with 2 new sed lines and updated the other to 0.0.0.0, What they do is described in the comments. I figure with DNSmasq you don't need the www's and after removing them there was a bunch of *easily* removed duplicates.

The other duplicates are proving more difficult because sometimes removing part of one line is not what you want on the next!! ie.. 'ads.yahoo.com' might get changed to 'yahoo.com' !

Cut and paste this function in place of the previous if you want to use it:

I agree. This is a great improvement. For some reason 0.0.0.0 comes back faster for me too. I've updated my script to use sed as shown above by yaqui to remove the comments at the end of the lines as well as replace 127.0.0.1's with 0.0.0.0's. You can find the update in about 5 minutes over on that thread, HERE.

Thanks to yaqui for the sed syntax and sroquette for discovering the performance improvement. (Note, the improvement isn't on the router, it's on my windows machines, which for some reason delay 1/2 a second or so before returning on 127.0.0.1).

Aren't these forums great!?!

- Mike

Click to expand...

hehe sure
but a problem could occur with the hosts file if you do a global replace.
the first line of the mvps file is "127.0.0.1 localhost" which may be important. I don't know what kind of problem can happen if you replace this line.
it's still working on windows, but I don't know if the router uses it.