[SCRIPT] CLI update auto-download and flash latest beta

Post new topic   Reply to topic    DD-WRT Forum Index -> Contributions Upload
Author Message
osm0sis
DD-WRT Novice


Joined: 28 Jul 2021
Posts: 11
Location: Canada

PostPosted: Thu Aug 05, 2021 1:03    Post subject: [SCRIPT] CLI update auto-download and flash latest beta Reply with quote
Worked out a little script to paste into telnet to make CLI updates a bit easier:
Code:

cliupdate() {
  local build_latest ddwrt firmware n platform year;
  ddwrt=http://download1.dd-wrt.com/dd-wrtv2/downloads/betas;
  year=2021;
  build_latest=$(wget -qO- $ddwrt/$year | grep href | tail -n1 | cut -d\" -f2);
  platform=tplink_archer-c7-v4;
  firmware=tplink_archer-c7-v4.bin;
  read -p "Download and flash DD-WRT \"$build_latest\" (y/n)? " n;
  case $n in
    Y|y)
      rm -f /tmp/$firmware;
      wget -P /tmp $ddwrt/$year/$build_latest$platform/$firmware \
        && write /tmp/$firmware linux;
    ;;
  esac;
  if [ $? -eq 0 ]; then
    read -p "Reboot (y/n)? " n;
    case $n in
      Y|y) reboot;;
    esac;
  fi;
}

cliupdate;


I have it set up for my TP-Link Archer C7 v4, but simply change out the platform= and firmware= values for your device and you should be set!

Enjoy! Cool
Sponsor
RobrPatty
DD-WRT User


Joined: 06 Jun 2016
Posts: 174

PostPosted: Mon Nov 29, 2021 8:41    Post subject: where in telenet Reply with quote
Not sure where to paste this script.
blkt
DD-WRT Guru


Joined: 20 Jan 2019
Posts: 5650

PostPosted: Mon Nov 29, 2021 10:08    Post subject: Reply with quote
https://www.chiark.greenend.org.uk/~sgtatham/putty/

Telnet, or SSH if configured, router IP username root.
the-joker
DD-WRT Developer/Maintainer


Joined: 31 Jul 2021
Posts: 2146
Location: All over YOUR webs

PostPosted: Mon Nov 29, 2021 13:15    Post subject: Reply with quote
You dont paste the script per say.

You copy it to /tmp on the router, make it executable and then run it.
Each time you want to upgrade again you must do same, since anything on tmp will disapear after each reboot.

TBH that script could be slightly tweaked. =)

Take care.

_________________
Saving your retinas from the burn!🔥
DD-WRT Inspired themes for routers
DD-WRT Inspired themes for the phpBB Forum
DD-WRT Inspired themes for the SVN Trac & FTP site
Join in for a chat @ #style_it_themes_public:matrix.org or #style_it_themes:discord

DD-WRT UI Themes Bug Reporting and Discussion thread

Router: ANus RT-AC68U E1 (recognized as C1)
kernel-panic69
DD-WRT Guru


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

PostPosted: Mon Nov 29, 2021 16:48    Post subject: Reply with quote
Details on the tweaks would be wonderful, and quite helpful. If said tweaks are valid, of course, lol.
_________________
"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
mwchang
DD-WRT Guru


Joined: 26 Mar 2013
Posts: 1851
Location: Hung Hom, Hong Kong

PostPosted: Thu Dec 02, 2021 15:13    Post subject: Re: [SCRIPT] CLI update auto-download and flash latest beta Reply with quote
osm0sis wrote:
Worked out a little script to paste into telnet to make CLI updates a bit easier:
Code:
....
read -p "Download and flash DD-WRT \"$build_latest\" (y/n)? " n;
  case $n in
    Y|y)
      rm -f /tmp/$firmware;
      wget -P /tmp $ddwrt/$year/$build_latest$platform/$firmware \
        && write /tmp/$firmware linux;
    ;;
  esac;
....


Didn't see any error checking (e.g. download size vs listed size)? Smile

Sometimes, the file size of a firmware was too small, indicating an error. If you flashed it, the router might be bricked.

It would be great if all builds have CRC checksum as a companion text files. Until then... Smile


_________________
Router: Asus RT-N18U (rev. A1)

Drink, Blink, Stretch! Live long and prosper! May the Force and farces be with you!

Facebook: https://www.facebook.com/changmanwai
Website: https://sites.google.com/site/changmw
SETI@Home profile: http://setiathome.berkeley.edu/view_profile.php?userid=211832
GitHub: https://github.com/changmw/changmw
kernel-panic69
DD-WRT Guru


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

PostPosted: Thu Dec 02, 2021 17:31    Post subject: Reply with quote
We will likely never see cryptographic signing, md5, sha256, crc verification information for DD-WRT ever again. Don't hold your breath. FWIW, I know how much longer it would take to parse md5sums on the number of firmware images currently built just by calculating how long it takes to do so on a full run of FreshTomato MIPS and ARM images. "Time is money".
_________________
"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: Fri Dec 03, 2021 6:10    Post subject: Re: [SCRIPT] CLI update auto-download and flash latest beta Reply with quote
mwchang wrote:
Didn't see any error checking (e.g. download size vs listed size)? Smile

Sometimes, the file size of a firmware was too small, indicating an error. If you flashed it, the router might be bricked.

Note that easyddup has a configurable minimum & maximum file size check feature. The listed size, if unusually large or small, could indicate a problem build even if it matches the file.
mwchang
DD-WRT Guru


Joined: 26 Mar 2013
Posts: 1851
Location: Hung Hom, Hong Kong

PostPosted: Sun Jul 30, 2023 15:18    Post subject: Reply with quote
kernel-panic69 wrote:
FWIW, I know how much longer it would take to parse md5sums on the number of firmware images currently built just by calculating how long it takes to do so on a full run of FreshTomato MIPS and ARM images. "Time is money".

Just do it slowly using a shell script, starting from most recent builds working backward to older builds. Anyway, this is not urgent. Smile

And if you look at:

dd-wrt/src/router/rc/check_ps.c at master · mirror/dd-wrt · GitHub
https://github.com/mirror/dd-wrt/blob/master/src/router/rc/check_ps.c#L368
Code:
   eval("fischecksum");
   eval("write", "/tmp/firmware.bin", "linux");

Anyway, it might be more comfortable not to rely on a script to flash firmware, but do it step by step typing each command. You can see their results slowly. If anything went wrong, you could stop instantly.


Related???

Hashes & Checksums - DD-WRT Wiki
https://wiki.dd-wrt.com/wiki/index.php/Hashes

DD-WRT :: View topic - Failsafe and Downloads (MD5/SHA1 Hashes for Files)
https://forum.dd-wrt.com/phpBB2/viewtopic.php?p=2874

_________________
Router: Asus RT-N18U (rev. A1)

Drink, Blink, Stretch! Live long and prosper! May the Force and farces be with you!

Facebook: https://www.facebook.com/changmanwai
Website: https://sites.google.com/site/changmw
SETI@Home profile: http://setiathome.berkeley.edu/view_profile.php?userid=211832
GitHub: https://github.com/changmw/changmw
Display posts from previous:    Page 1 of 1
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