Storing autoap.sh in NVRAM on V24_SP2 Standard

Post new topic   Reply to topic    DD-WRT Forum Index -> Contributions Upload
Author Message
pcgear
DD-WRT Novice


Joined: 16 Jul 2006
Posts: 5
Location: Naples, FL

PostPosted: Fri Oct 16, 2009 15:46    Post subject: Storing autoap.sh in NVRAM on V24_SP2 Standard Reply with quote
I have been running autoap.sh from nvram on V24_sp2 standard. Here is what I did if anyone would like to give it a try.

Download the autoap.sh file and open it on your pc. Now shrink it to as small as possible. Remove all comments, extra spaces, and blank lines. I also removed the code to read the nvram variable from the first function. If you are careful you can get the file to less than 11k. Check your available nvram (nvram show) to confirm your text is going to fit before proceeding. If the file is too big you will brick your router.

Replace the 4 special characters \,$,&," with \\,\$,\&,\". Make sure you start with \ so the other replaces are not messed up.

Add the nvram set and commit to the start and end of the file. Your file should look somethink like this:

Code:

nvram set autoap-code="
#!/bin/sh
aap_aplimit=20
aap_checkfreq=2
.....rest of code....
[ \"\$(nvram get autoap_rescannow)\" -gt 0 ] && aap_varupdate && no_ap=0
done
"
nvram commit


Copy and paste your text into either the telnet or ssh command line.

Add this to your startup command:
Code:

`cd /tmp;/bin/sleep 30;nvram get autoap-code > autoap.sh;
chmod 777 ./autoap.sh;./autoap.sh;done` &


restart your router and check for proper script execution.
Sponsor
redhawk0
DD-WRT Guru


Joined: 04 Jan 2007
Posts: 11563
Location: Wherever the wind blows- North America

PostPosted: Mon Oct 19, 2009 11:28    Post subject: Re: Storing autoap.sh in NVRAM on V24_SP2 Standard Reply with quote
pcgear wrote:

Replace the 4 special characters \,$,&," with \\,\$,\&,\". Make sure you start with \ so the other replaces are not messed up.


I don't really understand what you mean here...can you elaborate/expand on this.

There are a lot of those characters in the code...are you saying every instance needs to be preceded by a \ character.

redhawk

_________________
The only stupid question....is the unasked one.
JFKFC
DD-WRT Novice


Joined: 16 Nov 2011
Posts: 1

PostPosted: Wed Nov 16, 2011 23:25    Post subject: Reply with quote
I know this is an old thread, but it really did solve all of my problems I was having with AutoAP. I no longer have to wait for the router to find an AP to auto-download the script, or mess with Samba, or install an SD card for JFFS. I don't have to deal with loading old or gimped firmware, either. AutoAP just loads up from nvram and it's good to go. Here are a couple notes from my experience:

1) For some reason, it gets hung up when looking for nvram 'autoap_' variables you set via the command line (the OP mentioned this briefly). So I just erased the 'aap_varupdate' function from the script, as well as the two places it is called on later in the script. The function itself is the very first one and looks like:

    aap_varupdate ()
    {
    ... code ...
    }

With that gone, now if I need to change an autoap variable, I have to do so in the top part of the script itself, where all of the 'aap_...' vars are listed. After I change them, I do a 'nvram unset autoap-code' to clear autoap from nvram, then 'nvram show' to check free space, and then I do the 'nvram set autoap-code=" (...code...)' as per the original instructions.

2) Don't forget to get rid of all of the comments, which take up nearly half of the script. There are also a ton of unnecessary spaces in there; you can get rid of them by replacing all of the double spaces with singe spaces in your editor a few times until they are gone. You can also save space by taking long English phrases like "Successfully collected access point scan data, analysing..." and trimming them down to "APs found..." and so on.

3) The & characters should NOT be proceeded by a \. Just do the find/replace for all of the \, $, and " characters so they become \\, \$, and \" respectively.

4) Maybe someone out there can figure out a way to store a gzipped version of the script within a nvram variable, which could then be ungzipped and run from tmp at boot. I know somebody made it so you can gzip your firewall scripts, could that work for AutoAP as well?


So anyway, maybe it's not the most elegant solution in the world, but it works for me and my WRT54GL. I don't know what the rules are for posting edited scripts, so I'm not going to post my trimmed down version unless I get the go ahead. Besides, I don't know what bugs are lurking in it, and I can't be doing tech support on something I barely understand.
somo
DD-WRT User


Joined: 04 Sep 2010
Posts: 128

PostPosted: Tue Dec 06, 2011 18:50    Post subject: Reply with quote
thanks JFKFC, the more info the better.

BTW, the autoap thread is not loading the last page now (pg.99)

should we start a new one linked to the original?
eeff11
DD-WRT User


Joined: 23 Jan 2013
Posts: 116

PostPosted: Mon Aug 19, 2013 3:54    Post subject: Reply with quote
This autoap.sh needs to be modified for use with the latest build of Atheros platform.
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> Contributions Upload All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum