Created
July 7, 2020 14:31
-
-
Save rambotech/d1e2486228c5e972c3c9c8936920f2fc to your computer and use it in GitHub Desktop.
Backup DD-WRT NVRAM settings to a shell script for easy restore.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# make a full restore shell script for the current nvram settings | |
FILE=$HOSTNAME-restore-sh | |
nvram show | grep = | grep -v -e =$ | awk -F'=' '{print $1}' | sort -f | (IFS=''; while read VAR; do VAL=$(nvram get ${VAR}); [ -n "$VAL" ] && printf 'nvram set %s='\''%s'\''\n' ${VAR} ${VAL/\'/\'\\\'\'}; done) > $FILE | |
nvram save >> $FILE | |
nvram commit >> $FILE | |
# insert an scp statement, etc, to copy the content to a storage location. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment