So question, sugestion, idea, outburst - could there be an option created in saving the configuration that would only save those parameters that are "typed" in, and not the NVRAM values, so this task could be avoided? Possibly that is getting too far away from the stock FW, but just thought I'd ask.
Thanks!
In general this would work, but success would depend on the particular two firmware versions involved. The structure/format of "typed in" values, especially those which have a series of fields per value (like IP reservations, for example) may change between two releases. (They usually don't, but could.) So that's an example of a setting that could *usually* be imported without problem in most firmware upgrades (or downgrades), but might cause problems in a specific upgrade where data structure differed.
In other words, any comprehensive script that saved/restored values would have to be reviewed, tested, validated, and perhaps updated for every "combination" of two firmware versions involved (upgrade and downgrade). That's a big, complex task.
Of course the fewer settings addressed, the less likelihood of it causing a problem. And there are only a few settings that are really cumbersome to re-input, so the focus should be on those.
For myself, I created a couple of scripts that save/restore the few specific settings that take me the most time to re-input after a reset to defaults. One script saves everything in nvram for future reference, then saves selected entries into a file which will later be restored. The second script does the actual import/restore of that second file. The scripts reside (and store/retrieve their files) from a USB stick.
Those scripts are attached.
DISCLAIMER: I am not a Linux guy nor a script-writer by trade, so these can probably be improved a lot -- but they work for me.
I stole the concept from a post Merlin made quite a while back, then hacked together the scripts the best I could.
Note that you will need to change the path to files, depending on which mount point is assigned (sda1 or sda2) and what subfolder you create for your files.
--Script to export settings--
Code:
#!/bin/sh
FN="/mnt/sda1/Settings/AllSettings.txt"
nvram show >$FN
FN="/mnt/sda1/Settings/settings.txt"
echo "vts_rulelist=`nvram get vts_rulelist`" >$FN
echo "dhcp_staticlist=`nvram get dhcp_staticlist`" >>$FN
echo "dhcp_static_x=`nvram get dhcp_static_x`" >>$FN
echo "dhcp_start=`nvram get dhcp_start`" >>$FN
echo "dhcp_end=`nvram get dhcp_end`" >>$FN
echo "ipv6_service=`nvram get ipv6_service`" >>$FN
echo "lan_ipaddr=`nvram get lan_ipaddr`" >>$FN
echo "lan_ipaddr_rt=`nvram get lan_ipaddr_rt`" >>$FN
echo "lan_netmask=`nvram get lan_netmask`" >>$FN
echo "lan_netmask_rt=`nvram get lan_netmask_rt`" >>$FN
--Script to import selected settings--
Code:
#!/bin/sh
FN="/mnt/sda1/Settings/settings.txt"
while read line
do
echo ${line}
nvram set ${line} || exit 1
done < $FN
nvram commit