Command to display DD-WRT version in WEBUI

Post new topic   Reply to topic    DD-WRT Forum Index -> General Questions
Author Message
mwchang
DD-WRT Guru


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

PostPosted: Tue Jun 06, 2023 9:20    Post subject: Command to display DD-WRT version in WEBUI Reply with quote
Which command produced this string "DD-WRT v3.0-r52894 std (06/06/23)" in WEBUI's Status page?

Definitely not "uname -a", which only displayed kernel version.

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


Joined: 20 Jan 2019
Posts: 5700

PostPosted: Tue Jun 06, 2023 10:09    Post subject: Reply with quote
https://forum.dd-wrt.com/phpBB2/viewtopic.php?p=1231786#1231752
https://forum.dd-wrt.com/phpBB2/viewtopic.php?p=1231835#1231823
ho1Aetoo
DD-WRT Guru


Joined: 19 Feb 2019
Posts: 3004
Location: Germany

PostPosted: Tue Jun 06, 2023 11:43    Post subject: Reply with quote
The ssh pre-authentication banner also shows the versions info.

Code:
root@DD-WRT:/tmp# cat /tmp/loginprompt
DD-WRT v3.0-r52671 std (c) 2023 NewMedia-NET GmbH
Release: 05/24/23
Board: Netgear R7800

_________________
Quickstart guides:
use Pi-Hole as simple DNS-Server with DD-WRT
VLAN configuration via GUI - 1 CPU port
VLAN configuration via GUI - 2 CPU ports (R7800, EA8500 etc)

Routers
Marvell OCTEON TX2 - QHora-322 - OpenWrt 23.05.3 - Gateway
Qualcomm IPQ8065 - R7800 - DD-WRT - WAP
mwchang
DD-WRT Guru


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

PostPosted: Tue Jun 06, 2023 12:33    Post subject: Reply with quote
blkt wrote:
https://forum.dd-wrt.com/phpBB2/viewtopic.php?p=1231786#1231752
https://forum.dd-wrt.com/phpBB2/viewtopic.php?p=1231835#1231823

ho1Aetoo wrote:
The ssh pre-authentication banner also shows the versions info.
Code:
root@DD-WRT:/tmp# cat /tmp/loginprompt
DD-WRT v3.0-r52671 std (c) 2023 NewMedia-NET GmbH
Release: 05/24/23
Board: Netgear R7800

Was expecting something simpler....

In https://svn.dd-wrt.com/browser/src/router/httpd/visuals/lib.c#L94
Code:
websWrite(wp, "DD-WRT v3.0-r%s %s%s (" BUILD_DATE ") WW", SVN_REVISION, nvram_safe_get("dist_type"), DIST_OPT);

In https://svn.dd-wrt.com/browser/src/router/lsof/dialects/linux/Makefile.orig#L48
Code:
BUILD_DATE=     $(shell date --utc --date=@$(SOURCE_DATE_EPOCH))

In https://svn.dd-wrt.com/browser/src/router/services/sysinit/sysinit.c#L2941
Code:
nvram_set("os_version", SVN_REVISION);


The WEBUI's string is "DD-WRT v3.0-r52894 std (06/06/23)"! I found that "nvram get os_date" was "May 15 2023", while "nvram get os_version" was "52894".

In https://svn.dd-wrt.com/browser/src/router/services/sysinit/defaults.c?rev=52830#L122
Code:
119            /*
120            * OS parameters
121            */
122           { "os_version", SVN_REVISION }, /* OS revision */
123           { "os_date", __DATE__ },        /* OS date */
124           { "wait_time", "5" },

"__DATE__" should have been "BUILD_DATE"? Because in https://svn.dd-wrt.com/browser/src/router/services/sysinit/init.c#L166 and in https://svn.dd-wrt.com/browser/src/router/services/sysinit/init.c#L211 , /tmp/loginprompt is created with "BUILD_DATE"!

Should we open a ticket on line 123 of defaults.c? Smile

And if "os_date" is not to be changed, should we introduce a nvram value "svn_date" or "build_date" which equals to BUILD_DATE?? A corresponding read-only value in /proc might also be useful.

_________________
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


Last edited by mwchang on Tue Jun 06, 2023 14:48; edited 3 times in total
mwchang
DD-WRT Guru


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

PostPosted: Tue Jun 06, 2023 13:37    Post subject: Reply with quote
Here is the current command-line that immitates the DD-WRT's version in the WEBUI's Status page:
Code:
echo "DD-WRT v3.0-r$(nvram get os_version) $(nvram get dist_type) ($(grep Release /tmp/loginprompt | cut -d : -f 2 | tr -d ' '))"

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


Joined: 20 Jan 2019
Posts: 5700

PostPosted: Tue Jun 06, 2023 16:00    Post subject: Reply with quote
mwchang wrote:
Should we open a ticket on line 123 of defaults.c? Smile
No.
mwchang wrote:
And if "os_date" is not to be changed, should we introduce a nvram value "svn_date" or "build_date" which equals to BUILD_DATE?? A corresponding read-only value in /proc might also be useful.
Pointless.
kernel-panic69
DD-WRT Guru


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

PostPosted: Tue Jun 06, 2023 17:38    Post subject: Reply with quote
Are those *your* answers or Sebastian's? Asking for a friend.
_________________
"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: 1858
Location: Hung Hom, Hong Kong

PostPosted: Wed Jun 07, 2023 8:09    Post subject: Reply with quote
blkt wrote:
mwchang wrote:
And if "os_date" is not to be changed, should we introduce a nvram value "svn_date" or "build_date" which equals to BUILD_DATE?? A corresponding read-only value in /proc might also be useful.
Pointless.

I agree SVN_REVISION (and hence "os_version") indirectly indicates the build date of DD-WRT. But shouldn't both "os_date" and "os_version" refer to the version of DD-WRT, not the Linux kernel?

The only concern about changing NVRAM "os_date" is possibly this:

https://svn.dd-wrt.com/browser/src/router/services/services/cron.c#L146
Code:
        if (nvram_matchi("hotss_enable", 1)) {
142   
143                   fp = fopen("/tmp/cron.d/hotss_checkalive", "w");
144   
145                   fprintf(fp,
146                           "%d * * * * root /usr/bin/wget http://tech.hotspotsystem.com/up.php?mac=`nvram get wl0_hwaddr|sed s/:/-/g`\\&nasid=%s_%s\\&os_date=`nvram get os_date|sed s/\" \"/-/g`\\&install=2\\&uptime=`uptime|sed s/\" \"/\\%%20/g|sed s/:/\\%%3A/g|sed s/,/\\%%2C/g`  -O /tmp/lastup.html\n",
147                           (currtime->tm_min + 3) % 60, nvram_safe_get("hotss_operatorid"), nvram_safe_get("hotss_locationid"));
148   
149                   fclose(fp);
150           }


Also, loginprompt should have resided in /etc (instead of /tmp) as a read-only file. Anyway, it's not that important.

_________________
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 -> General Questions 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 can attach files in this forum
You can download files in this forum