Posted: Fri Sep 16, 2022 7:12 Post subject: [SOLVED - AGAIN]Format for setting multi-line nvram values
If I'm in an SSH session for dd-wrt and I want to set an nvram value that contains newlines, what is the proper way to do that?
I know that if I'm setting something that is a single line with no spaces, I don't need quotes, i.e.:
Code:
nvram set some_key=singlevalue
and if I'm setting values that contain spaces, then I need to add quotes:
Code:
nvram set list_ips="192.168.1.1 192.168.1.3"
But if I've got something that has newlines in it, like say the pptpd_auth key, then what is the proper way to enter that? As long as I put an opening quote, can I hit enter as needed like in a typical linux shell and it will continue the line?
Code:
nvram set pptpd_auth="bruce * pass1 *<ENTER>
bob * pass2 *<ENTER>
alice * pass3 *"<ENTER>
I'd just try it, but I don't want to mess anything up and thought I would ask first.
Joined: 16 Nov 2015 Posts: 6414 Location: UK, London, just across the river..
Posted: Fri Sep 16, 2022 8:48 Post subject:
this way works for me either nvram or in GUI
/opt/etc/init.d/rc.unslung start; sleep 10; sh /tmp/.rc_custom
there was a request i made once .. but couldn't find the thread atm
there ware few other options offered too.. _________________ Atheros
TP-Link WR740Nv1 ---DD-WRT 55179 WAP
TP-Link WR1043NDv2 -DD-WRT 55303 Gateway/DoT,Forced DNS,Ad-Block,Firewall,x4VLAN,VPN
TP-Link WR1043NDv2 -Gargoyle OS 1.15.x AP,DNS,QoS,Quotas
Qualcomm-Atheros
Netgear XR500 --DD-WRT 55460 Gateway/DoH,Forced DNS,AP Isolation,4VLAN,Ad-Block,Firewall,Vanilla
Netgear R7800 --DD-WRT 55460 Gateway/DoT,AD-Block,Forced DNS,AP&Net Isolation,x3VLAN,Firewall,Vanilla
Netgear R9000 --DD-WRT 55363 Gateway/DoT,AD-Block,AP Isolation,Firewall,Forced DNS,x2VLAN,Vanilla
Broadcom
Netgear R7000 --DD-WRT 55460 Gateway/SmartDNS/DoH,AD-Block,Firewall,Forced DNS,x3VLAN,VPN
NOT USING 5Ghz ANYWHERE
------------------------------------------------------
Stubby DNS over TLS I DNSCrypt v2 by mac913
How could I forget your welcoming spirit <lol> _________________ "The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep." - Robert Frost
"I am one of the noticeable ones - notice me" - Dale Frances McKenzie Bozzio
@Alozaros, I was looking over that old thread and I saw the issue you were having with wget. Did you try quoting the URL to see if wget would then retrieve it properly?
Thanks everyone for your responses. I wrote a perl script to parse a dump from an
Code:
nvram show
and I wanted to make an option to have it output all of them as properly formatted
Code:
nvram set xxxxx
lines.
I certainly wouldn't use that to restore an entire backup, but there are some items that are a little tedious to reconfigure when wiping nvram like static leases, wi-fi mac filters, port forwards, etc., that being able to just copy and paste via the CLI would make easier.
Joined: 16 Nov 2015 Posts: 6414 Location: UK, London, just across the river..
Posted: Sat Sep 17, 2022 8:48 Post subject:
brucehvn wrote:
@Alozaros, I was looking over that old thread and I saw the issue you were having with wget. Did you try quoting the URL to see if wget would then retrieve it properly?
wget works as intended it was a user error.. as ISP blocks port 80 http if i don't pay my bill on time _________________ Atheros
TP-Link WR740Nv1 ---DD-WRT 55179 WAP
TP-Link WR1043NDv2 -DD-WRT 55303 Gateway/DoT,Forced DNS,Ad-Block,Firewall,x4VLAN,VPN
TP-Link WR1043NDv2 -Gargoyle OS 1.15.x AP,DNS,QoS,Quotas
Qualcomm-Atheros
Netgear XR500 --DD-WRT 55460 Gateway/DoH,Forced DNS,AP Isolation,4VLAN,Ad-Block,Firewall,Vanilla
Netgear R7800 --DD-WRT 55460 Gateway/DoT,AD-Block,Forced DNS,AP&Net Isolation,x3VLAN,Firewall,Vanilla
Netgear R9000 --DD-WRT 55363 Gateway/DoT,AD-Block,AP Isolation,Firewall,Forced DNS,x2VLAN,Vanilla
Broadcom
Netgear R7000 --DD-WRT 55460 Gateway/SmartDNS/DoH,AD-Block,Firewall,Forced DNS,x3VLAN,VPN
NOT USING 5Ghz ANYWHERE
------------------------------------------------------
Stubby DNS over TLS I DNSCrypt v2 by mac913
Joined: 31 Jul 2021 Posts: 2146 Location: All over YOUR webs
Posted: Sat Sep 17, 2022 16:52 Post subject:
brucehvn wrote:
Thanks everyone for your responses. I wrote a perl script to parse a dump from an
Code:
nvram show
and I wanted to make an option to have it output all of them as properly formatted
Code:
nvram set xxxxx
lines.
I certainly wouldn't use that to restore an entire backup, but there are some items that are a little tedious to reconfigure when wiping nvram like static leases, wi-fi mac filters, port forwards, etc., that being able to just copy and paste via the CLI would make easier.
You can script that to restore the desired nvram entries, its what I do essentially, but my script is a bit fast and loose not something Im going to share at this time.