Tag Archives: /jffs/dns/disable_adds.sh

How to configure Cisco Linksys WRT54G v.2 to run Pixelserv on DD-WRT

Cisco Linksys WRT54G v.2
Cisco Linksys WRT54G v.2

This is how I was able to implement the solution given by Aviad Raviv found here How to Remove Advertisements with Pixelserv on DD-WRT

 

I am not going to go through his tutorial or how to get DD-WRT onto your Cisco Linksys WRT54G v.2. Aviad did a wonderful job, for the most part, and there are plenty of DD-WRT tutorials out there. I followed every step that Aviad wrote up, downloaded what he said to download, made every configuration as it was laid out but I could not get the disable_ads.sh script to run. I kept getting errors like these

In the WRT54G commands GUI:

sh: eval: line 1: /jffs/dns/disable_adds.sh: not found

 

And this in the SSH CLI

root@Deadend:~# sh /jffs/dns/disable_adds.sh
: not foundisable_adds.sh: line 10: {
ad_blocker_script:
: not foundisable_adds.sh: line 12: }
: not foundisable_adds.sh: line 13:
: not foundisable_adds.sh: line 15: {
/jffs/dns/disable_adds.sh: line 189: syntax error: end of file unexpected (expecting "then")

I spent a few hours trying this and that, permissions, and manually editing the file with Notepad++ and / or vi. Nothing worked. I knew about the big Indian / little Indian situation when working with files to be run on a Unix / Linux system with a Windows system. I have never run into that issue while using Notepad++ though. This was making me crazy, plus I could not remember ever even opening that file before I uploaded it to my WRT54G so what was the deal. Well as a last ditch effort I tried to run dos2unix on the file on the WRT54G … well that program is not on the WRT54G, to save space I am sure. So I uploaded the disable_ads.sh file to my CentOS 6 box and tried to run dos2unix … well it wasn’t there, I did a minimal install when I setup that box so I got:

-bash: dos2linux: command not found

Thankfully that machine is connected to the Internet and a quick

sudo yum install dos2unix -y

got it installed. I then dos2unix’ed the disable_ads.sh file and migrated it back to the WRT54G; BTW the file size changed from 10KB to 9KB so something was changed for sure. After putting this new version of the sh script on the WRT54G I rebooted it. When it came back up I checked WinSCP and the files that were to be created on first run of the script were there just as Aviad said they would be.

 

To recap if you are not getting success with running the disable_ads.sh script after going through Aviad’s tutorial then you need to run it through dos2unix and re-upload to your router. I assume this could be a problem on other routers not just the Cisco Linksys WRT54G v.2.

 

I would have made this post as a comment on Aviad’s tutorial but it was not open for comments. Hope others will find this and it help them .

 

BONUS:

I spent quite some time making up this file. It is a¬†personal-ads-list.conf with 3,595 blocked sites, mostly adult sites. I grabbed the initial list from jacop_’s post, then I formatted it to work with Pixelsrv. When you upload and reboot the router it will take some time, maybe 10 minutes or more for Pixelsrv to parse through the list.