First DD-WRT forum post

Source: http://www.dd-wrt.com/phpBB2/viewtopic.php?t=44324
Post Author: frater
Post Date: Dec 21, 2008 11:35

When DD-WRT does a backup of the settings this is done in a binary way. Even if no variables have changed and the hardware has not changed, it is not totally safe to restore this binary backup on another version.

I'm saving these variables to a script. This was not my idea, but the other implementation on this forum was saving more than it should.

This script also creates some variables that don't really exist. I previously wrote a script that was able to avoid this, but it had a terrible speed-impact. The variables it creates (makes up) comes from data containing a "=". This really is not a problem.

I'm deliberately skipping some variables that contain hardware-specific data. This way it is safe to restore these settings on different hardware.
After an upgrade you can run this restore-script and be up and running in no time.
Update to use VARFILE

Source: http://www.dd-wrt.com/phpBB2/viewtopic.php?p=285231#285231
Post Author: frater
Post Date: Apr 06, 2009 19:39

This is the script which runs every night on my router...

cat /opt/usr/sbin/backupessential
Update sed line

Source: http://www.dd-wrt.com/phpBB2/viewtopic.php?p=289367#289367
Post Author: frater
Post Date: Apr 16, 2009 19:00

or even better..
  echo -n "${data}" |  sed -e 's/[$`"\]/\\&/g' | tee -ia  ${TO_ALL} >> ${bfile}
Add support for vars_preferred

Source: http://www.dd-wrt.com/phpBB2/viewtopic.php?p=291362#291362
Post Author: frater
Post Date: Apr 22, 2009 13:28

An include-file was what I first wrote, but this means you're missing out on variables that are getting introduced in the future. But if one, like me, is doing a regular compare this will not get unnoticed.

Someone in this thread prefers code that's coming directly from me and because I don't want to support someone else's code I have written a "include" as well.

So.. here it is... test away
Update all_files creation step and remove blank variable check

Source: http://www.dd-wrt.com/phpBB2/viewtopic.php?p=301390#301390
Post Author: frater
Post Date: May 16, 2009 16:04
Add comments and header line to TO_PREFERRED (by hardwarewizard)

Source: http://www.dd-wrt.com/phpBB2/viewtopic.php?p=326981#326981
Post Author: hardwarewizard
Post Date: Jul 24, 2009 2:12

i added comments to what i believe to be a good working script check it out and let me know what should be added this way other people can understand the script better.
Add -r to sort command

Source: http://www.dd-wrt.com/phpBB2/viewtopic.php?p=328013#328013
Post Author: frater
Post Date: Jul 26, 2009

Thanks hardwarewizard for adding the comments, finding the "feature" in DD-WRT and adding PREFERRED to that echo line (cosmetic).

Here's the script that should take care of the order in which the variables are written.
Add command-line arguments

Source: http://www.dd-wrt.com/phpBB2/viewtopic.php?p=328060#328060
Post Author: frater
Post Date: Jul 26, 2009 14:05

SUGGESTION: You might want to add a command line switch to enable/disable the last section (tar and ftp).

Alright then....
Additional comments and cleanup by hardwarewizard

Source: http://www.dd-wrt.com/phpBB2/viewtopic.php?p=328222#328222
Post Author: hardwarewizard
Post Date: Jul 26, 2009 20:54

this is an updated version and attached the files as well added the exclude wl_ variables.

let me know whats wrong or what i should add
Change /opt/var to /opt/vars and add more vars_preferred by DHC_DarkShadow

Source: http://www.dd-wrt.com/phpBB2/viewtopic.php?p=341016#341016
Post Author: DHC_DarkShadow
Post Date: Aug 26, 2009

Ok I downloaded the zip on page 10 extracted the files and put them all on the router as they where with the exception of editing backupvars.sh at this line,

FOLDER=/opt/var/backups

I changed var to vars, and it does not populate the dangerous.sh file.

Edit: It appears that all that is supposed to populate "dangerous.sh" gets included in "essential.sh"

I have included the files that do work. Don't know if this will help figure out the difference.
New location for script at http://wd.mirmana.com/backupessential

Source: http://www.dd-wrt.com/phpBB2/viewtopic.php?p=508022#508022
Post Author: frater
Post Date: Nov 20, 2010 10:42
Retrieved: 2011-12-09

I have updated the script once more....
I added the flavour 'minimal' and some code that will delete the last saved config if it's (about) the same as the current one.
I think it may help in keeping things organized....

I have also written a script that will automatically restore the settings after a factory reset. It's not yet sturdy enough for publishing and it has a problem I can't fix in optware....

/opt is not mounted after a factory reset, so I need to mount it first

wget -O /opt/usr/sbin/backupessential http://wd.mirmana.com/backupessential