easyddup a simple upgrade/downgrade utility

Post new topic   Reply to topic    DD-WRT Forum Index -> Contributions Upload
Goto page 1, 2, 3 ... 19, 20, 21  Next
Author Message
yoyoma2
DD-WRT User


Joined: 24 Sep 2016
Posts: 371

PostPosted: Thu Dec 26, 2019 4:48    Post subject: easyddup a simple upgrade/downgrade utility Reply with quote
WARNING: This is a beta version (updating firmware by any method has some risks).

Former Kong users know ddup. Here is easyddup, written from scratch, for BrainSlayer builds.

Features:

o Menu driven firmware download
o Secure https firmware download
o Automatic hardware identification (usually: see -r option)
o Caching of previous downloads
o Option to erase nvram or not
o Preserve basic settings (LAN and username/password)
o Possibility to save & automatically restore user settings
o Possibility to get email notifications of new builds
o Supports FAT and ext USB storage
o In place installation even if subnet not 192.168.1.x
o Store some basic settings in an ini file
o Multi-part setting for faster curl downloads

HELP NEEDED: The file nvram-dd-wrt.ini lists the user settings variables that are stored in the restore point. When you find settings that you regularly enter manually that are missing let me know and I'll add them or better yet make the changes and I'll integrate them. There will be a lot missing at first...

Credits:

Uses a modified version of this no longer maintained project. That project seemed to be quite a time saver as discussed here. The included QuickStart.txt file is from that project.

Used multipart curl download script from here and the progress reporting from here.

Got the basic idea and 50% of the easyddup name from Kong's ddup but no code.

Help:

easyddup -h

Easy ddd-wrt update Utility
easyddup.sh Version 0.9
Options: -h this help msg
-c Return count of available versions (does nothing)
-d Downgrade (default is to upgrade)
-f Force download even if build is cached
-m maxcount Search at most maxcount versions ahead/behind current
-n No firmware will be written but everything else is done
-p cache Path to local build cache (default ./fwcache)
-q Quiet (use with -c to check for updates silently)
-r rev Specify revision folder suffix (BRICK DANGER!!!)
-R rev Opposite of -r, revision suffix to strip
-w wipe individual cache items or -W to wipe all
-y xxxx Use year xxxx (default is current year)

Install:

mkdir -p /path/to/where/easyddup/subdirectory/is/wanted
cd /path/to/where/easyddup/subdirectory/is/wanted
cp /my/downloads/easyddup.tgz .
tar zxvf easyddup.tgz

The easyddup subdirectory is created and contains the required files.

Run:

You should already have a BrainSlayer build installed. (can sort of work from Kong).
You need USB storage so beginners might want to read this guide.

To upgrade:

easyddup.sh

To downgrade:

easyddup.sh -d

To restore user settings:
After initial reboot, enable USB support and run nvram-restore-latest.sh or the restore script with the date/time of your choice. Reboot and your settings are back.

Tips:
o You can answer q to any prompt to quit
o Read the warning about passwords in QuickStart.txt
o Turning on multi-part curl may speed up downloads considerably


Last edited by yoyoma2 on Thu Mar 14, 2024 17:49; edited 55 times in total
Sponsor
yoyoma2
DD-WRT User


Joined: 24 Sep 2016
Posts: 371

PostPosted: Thu Dec 26, 2019 15:16    Post subject: Reply with quote
Edit: Since the forums don't allow four attachments to a single post, the VERSION.txt file is attached to this 2nd post instead of the OP which already has three attachments. The VERSION.txt file is used by the new easyddup self update feature.

Alozaros wrote:
basically this is CLI update option....So, i don't see a necessity of it

Lets compare my situation for a downgrade from problematic build:

With easyddup:

1) Run easyddup (my past builds are all cached) so visually it's obvious to return to any previous one. No download for cached ones so it's fast and easy on dd-wrt's servers.
2) Say 'y' to save/restore basic settings and erase nvram
3) After reboot run nvram-restore-latest.sh and reboot

Without easyddup:

1) Go to other building an retrieve router from difficult to access location.
2) Return to desk in office
3) Disconnect computer from network and connect to router
4) Find old stable build or hammer dd-wrt's servers and perform update with reset and reboot
5) Reconfigure my computer's LAN to 192.168.1.x subnet
6) Connect to the router and set the admin password and correct LAN settings and reboot.
7) Reconfigure my computer's LAN to correct LAN settings
Cool Go through all of the dd-wrt settings that I use and re-enter them one by one. Turns out the most stable build was not one I had previously installed. Do not forget any or make any mistakes!
9) Reconnect computer to network
10) Return router to other building and reconnect everything

The huge gain is eliminating the time consuming/error prone step 8. For this to work for everyone, nvram-dd-wrt.ini will need some additions as mentioned in the OP.

As for signatures that's up to BS to provide them.


Last edited by yoyoma2 on Thu Mar 14, 2024 17:51; edited 5 times in total
kernel-panic69
DD-WRT Guru


Joined: 08 May 2018
Posts: 14125
Location: Texas, USA

PostPosted: Thu Dec 26, 2019 16:04    Post subject: Reply with quote
Awesome work. Looking forward to seeing how this evolves.
_________________
"Life is but a fleeting moment, a vapor that vanishes quickly; All is vanity"
Contribute To DD-WRT
Pogo - A minimal level of ability is expected and needed...
DD-WRT Releases 2023 (PolitePol)
DD-WRT Releases 2023 (RSS Everything)

----------------------
Linux User #377467 counter.li.org / linuxcounter.net


Last edited by kernel-panic69 on Fri Mar 19, 2021 18:57; edited 1 time in total
Alozaros
DD-WRT Guru


Joined: 16 Nov 2015
Posts: 6410
Location: UK, London, just across the river..

PostPosted: Thu Dec 26, 2019 17:04    Post subject: Reply with quote
yoyoma2 wrote:
Alozaros wrote:
basically this is CLI update option....So, i don't see a necessity of it

Lets compare my situation for a downgrade from problematic build:

With easyddup:

1) Run easyddup (my past builds are all cached) so visually it's obvious to return to any previous one. No download for cached ones so it's fast and easy on dd-wrt's servers.
2) Say 'y' to save/restore basic settings and erase nvram
3) After reboot run nvram-restore-latest.sh and reboot

Without easyddup:

1) Go to other building an retrieve router from difficult to access location.
2) Return to desk in office
3) Disconnect computer from network and connect to router
4) Find old stable build or hammer dd-wrt's servers and perform update with reset and reboot
5) Reconfigure my computer's LAN to 192.168.1.x subnet
6) Connect to the router and set the admin password and correct LAN settings and reboot.
7) Reconfigure my computer's LAN to correct LAN settings
Cool Go through all of the dd-wrt settings that I use and re-enter them one by one. Turns out the most stable build was not one I had previously installed. Do not forget any or make any mistakes!
9) Reconnect computer to network
10) Return router to other building and reconnect everything

The huge gain is eliminating the time consuming/error prone step 8. For this to work for everyone, nvram-dd-wrt.ini will need some additions as mentioned in the OP.

As for signatures that's up to BS to provide them.



1. too much bias in this compere
2. cli update eliminates all those struggles described above
3. normally cli update keeps all the settings, but you can erase them if so
4. i haven't seen stable build, all is beta
5. Kongs ddup was great only cause sig checks
6. if you push BS to provide sig it will be great way to update firmware... plus...
7. Kong was saying that he provides sig check only because his auto ddup
could be exploited

_________________
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
kernel-panic69
DD-WRT Guru


Joined: 08 May 2018
Posts: 14125
Location: Texas, USA

PostPosted: Thu Dec 26, 2019 17:34    Post subject: Reply with quote
@Alozaros, current CLI update methods can be exploited. That is why <Kong> added the cryptographic signature and check. It would be great if we could get BS to cryptographically sign firmware images to verify them, though.
_________________
"Life is but a fleeting moment, a vapor that vanishes quickly; All is vanity"
Contribute To DD-WRT
Pogo - A minimal level of ability is expected and needed...
DD-WRT Releases 2023 (PolitePol)
DD-WRT Releases 2023 (RSS Everything)

----------------------
Linux User #377467 counter.li.org / linuxcounter.net
yoyoma2
DD-WRT User


Joined: 24 Sep 2016
Posts: 371

PostPosted: Thu Dec 26, 2019 17:58    Post subject: Reply with quote
kernel-panic69 wrote:
@Alozaros, current CLI update methods can be exploited.
Note that easyddup uses https only.
kernel-panic69
DD-WRT Guru


Joined: 08 May 2018
Posts: 14125
Location: Texas, USA

PostPosted: Thu Dec 26, 2019 18:11    Post subject: Reply with quote
yoyoma2 wrote:
kernel-panic69 wrote:
@Alozaros, current CLI update methods can be exploited.
Note that easyddup uses https only.


That is one step in the correct direction, but crypto signature would be great as an added measure of security.

_________________
"Life is but a fleeting moment, a vapor that vanishes quickly; All is vanity"
Contribute To DD-WRT
Pogo - A minimal level of ability is expected and needed...
DD-WRT Releases 2023 (PolitePol)
DD-WRT Releases 2023 (RSS Everything)

----------------------
Linux User #377467 counter.li.org / linuxcounter.net
yoyoma2
DD-WRT User


Joined: 24 Sep 2016
Posts: 371

PostPosted: Thu Dec 26, 2019 19:31    Post subject: Reply with quote
@Alozaros: Erasing nvram is just better. Sure most things work most of the time but I simply prefer the best option. You do what you prefer.

Alozaros wrote:
2. cli update eliminates all those struggles described above
3. normally cli update keeps all the settings, but you can erase them if so
Tell me how to access my router remotely after it has the wrong subnet.
Alozaros wrote:
4. i haven't seen stable build, all is beta
I wasn't clear. All builds are obviously beta but reading individual build threads informs you which ones are more "stable" than others.
Alozaros wrote:
5. Kongs ddup was great only cause sig checks
6. if you push BS to provide sig it will be great way to update firmware... plus...
7. Kong was saying that he provides sig check only because his auto ddup
could be exploited
Well easyddup uses https only (Kong's ddup used http). Microsoft uses https only for downloading Win10 ISO's so it will be difficult to convince BS that more security is needed for dd-wrt.

No one is forcing anyone to use easyddup although help improving it would be greatly appreciated as mentioned in the OP. The old underlying nvram save/restore tool revived by easyddup, was so appreciated that it generated over 800 mostly positive comments so it can't be all bad.
Alozaros
DD-WRT Guru


Joined: 16 Nov 2015
Posts: 6410
Location: UK, London, just across the river..

PostPosted: Thu Dec 26, 2019 22:05    Post subject: Reply with quote
erasing nvram before and after is not the best option in the world....
well its good for the developers, but it fries the nvram, i destroyed an old 1043v2 like that, doing a
rests before and after, nope its not necessary unless
there are serious changes, mem locations changes or so...I do not recommend over doing it...its BAD

and yep will be more than happy to see easyddup in action again and BS supporting it.... Twisted Evil Rolling Eyes

_________________
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
Alozaros
DD-WRT Guru


Joined: 16 Nov 2015
Posts: 6410
Location: UK, London, just across the river..

PostPosted: Thu Dec 26, 2019 22:14    Post subject: Reply with quote
kernel-panic69 wrote:
@Alozaros, current CLI update methods can be exploited. That is why <Kong> added the cryptographic signature and check. It would be great if we could get BS to cryptographically sign firmware images to verify them, though.


yep i know ... Twisted Evil Evil or Very Mad tried that in the past...
but now we all trust BS...FTP and https site...it is what it is...

back in the days there was a thread about if someone
corrupts a flash file and adds a code to it, than that code will get into the BS mess, and that code has only a 1% chance to work... Embarassed heheehe...
so if you dont trust the source, than do not flash.. stay at home next to the stove its X mass..

_________________
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
yoyoma2
DD-WRT User


Joined: 24 Sep 2016
Posts: 371

PostPosted: Fri Jan 03, 2020 3:16    Post subject: Reply with quote
Uploaded a new version of easyddup in the OP. The description of the attachment includes the date of the version. Although easyddup.sh -h prints a version number, it won't be changed for every tweak during alpha.

Changes:

Add a check to see if there are no builds available for the requested year. This helps in the first few days of the year before a single build is available or if an invalid year is attempted: easyddup.sh -y 1984
yoyoma2
DD-WRT User


Joined: 24 Sep 2016
Posts: 371

PostPosted: Thu Jan 09, 2020 3:24    Post subject: Reply with quote
New version posted in OP.

Changes:

Added option -n which prevents burning the firmware (kind of like gnu make -n goes through the motions without executing commands). You won't be asked to continue with an all caps YES and you won't reboot at the end unless you answer y to erasing nvram and writing the firmware is skipped at the end.

This is useful if you want to download new builds to your local cache but don't want to burn it just yet. More importantly you can create a restore point without upgrading your firmware. You can also tweak which variables are stored in the restore point without burning the firmware.

BTW the warning about bricking your router is there but it hasn't happened once here even while writing easyddup.
yoyoma2
DD-WRT User


Joined: 24 Sep 2016
Posts: 371

PostPosted: Thu Feb 04, 2021 0:23    Post subject: Reply with quote
New version posted in OP.

Changes:

Strip letters from version number.

While fixing samba 3.6 in the community build, I used a working copy with modifications in which case subversion adds a trailing 'M' to the version number. This broke the email notifications of new dd-wrt builds. Irrelevant fix unless you build your own dd-wrt version with modifications.


Last edited by yoyoma2 on Sun Aug 21, 2022 14:28; edited 2 times in total
IONK
DD-WRT Guru


Joined: 19 Aug 2011
Posts: 951

PostPosted: Sat Mar 06, 2021 3:14    Post subject: Reply with quote
Thanks for the great script.
My router is DIR-868L Rev.A1, and the firmware folder is "dlink-dir868l-reva" https://download1.dd-wrt.com/dd-wrtv2/downloads/betas/2021/03-04-2021-r45891/dlink-dir868l-reva/
Currently I need to manually add the "-reva" text to the script so that it can check for new version. Is there any better solution for this?

EDIT:
Code:
root@RB:~# nvram get DD_BOARD
Dlink-DIR868L


Code:
root@RB:~# nvram show | grep rev
boardrev=0x1110
size: 46449 bytes (19087 left)
pci/1/0/sromrev=9
wl1_corerev=42
sromrev=8
wl1.1_country_rev=0
0:regrev=0
pci/1/1/sromrev=9
wl0_country_rev=0
0:sromrev=11
wl1_country_rev=0
wl2_country_rev=0
1:regrev=0
1:sromrev=11
pci/1/0/regrev=0
pci/2/1/sromrev=11
sshd_authorized_keys=ssh-rsa ***deleted***
wl_corerev=
pci/2/1/boardrev=0x1450
wl_country_rev=0
wl0_corerev=29
pci/1/1/regrev=0
pci/2/1/regrev=0

_________________
▫ RSS feed for DD-WRT releases (2024): https://rsseverything.com/feed/7d36ab68-7733-46c3-bd8a-9c54c5cef08c.xml
easyddup - A simple upgrade/downgrade utility by yoyoma2 --- as featured in 📌 Reference Links, stickies retired back to forum (Moderator's Pick 🌟)
yoyoma2
DD-WRT User


Joined: 24 Sep 2016
Posts: 371

PostPosted: Sat Mar 06, 2021 5:33    Post subject: Reply with quote
What board variables exist?
Code:
nvram show | grep -i board

If there's no portable way for the script to automatically figure out the directory name for revisions for all vendors, how about a new board or revision argument eg:

easyddup.sh -b dlink-dir868l-revb

or

easyddup.sh -r revb

Still better than having to hack the script.
Goto page 1, 2, 3 ... 19, 20, 21  Next Display posts from previous:    Page 1 of 21
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