Get firmware date from command line

Post new topic   Reply to topic    DD-WRT Forum Index -> Marvell MVEBU based Hardware (WRT1900AC etc.)
Author Message
i8ts17
DD-WRT Novice


Joined: 25 Jul 2017
Posts: 6

PostPosted: Mon Apr 05, 2021 12:04    Post subject: Get firmware date from command line Reply with quote
Hi. When you ssh in you see something like this:
BusyBox v1.33.0 (2021-03-04 02:03:13 +07) built-in shell (ash)

Or at top of GUI:
Firmware: DD-WRT v3.0-r45891 std (03/04/21)

Or uname -a
Linux DD-WRT 4.9.258 #2465 SMP Thu Mar 4 02:00:54 +07 2021 armv7l DD-WRT

I was wondering if we can get it from the command line. Just -> 3/4/21 which is my current.

With:
nvram show 2>&1 | grep -m1 "os_version="
I can get:
os_version=45891

I tried:
x=$(busybox /bin/ash -v)
but it hangs...

Was thinking -> x=$(uname -a)
Then sed,grep,awk it and translate 'Mar' to '03'
but that is a bit much

Is there any nvram var or something I could use to get the date part?
Worked on it but could not get it so thought I'd ask here.

Thanks..

_________________
wrt32000acm
DD-WRT v3.0-r45891 std (03/04/21)
openvpn server
Sponsor
i8ts17
DD-WRT Novice


Joined: 25 Jul 2017
Posts: 6

PostPosted: Thu Apr 08, 2021 16:20    Post subject: Reply with quote
Answering my own post. I got it and it was right in front of me. When you SSH in say with Putty at the top it says:
Pre-authentication banner message from server:
| DD-WRT v3.0-r45891 std (c) 2021 NewMedia-NET GmbH
| Release: 03/04/21
| Board: Linksys WRT3200ACM

That info comes from:
/tmp/loginprompt

So:
the_date=$(cat /tmp/loginprompt | sed -n '2 p' | cut -d ' ' -f 2 | tr -s '/' '-')

echo $the_date returns:
03-04-21

Maybe someone will expand on it. Still don't know where DD-WRT gets it. I figure it must set it up internally somehow.

_________________
wrt32000acm
DD-WRT v3.0-r45891 std (03/04/21)
openvpn server
kernel-panic69
DD-WRT Guru


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

PostPosted: Thu Apr 08, 2021 19:13    Post subject: Reply with quote
The firmware date is set during the compile and build process, if I am not mistaken.
_________________
"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
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 12888
Location: Netherlands

PostPosted: Thu Apr 08, 2021 20:23    Post subject: Reply with quote
kernel-panic69 wrote:
The firmware date is set during the compile and build process, if I am not mistaken.


Correct

I have build 46301 running but my date differs as it was build today

_________________
Routers:Netgear R7000, R6400v1, R6400v2, EA6900 (XvortexCFE), E2000, E1200v1, WRT54GS v1.
Install guide R6400v2, R6700v3,XR300:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800/XR500: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087
i8ts17
DD-WRT Novice


Joined: 25 Jul 2017
Posts: 6

PostPosted: Thu Apr 08, 2021 21:28    Post subject: Reply with quote
Thank you for the responses. Understood now.
_________________
wrt32000acm
DD-WRT v3.0-r45891 std (03/04/21)
openvpn server
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> Marvell MVEBU based Hardware (WRT1900AC etc.) 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