OpenWrt Forum Archive

Topic: Patch Backfire to show SVN revision text in Luci screens

The content of this topic has been archived on 28 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

A compiled Backfire contains version information in /etc/banner and /etc/openwrt_release.

I noticed that the /etc/banner file that gets shown in terminal sessions, has the SVN version number. But the string shown in upper right corner of Luci config screens in the self-built Openwrt builds does not show the exact version info and the SVN revision is hard to see anywhere in Luci. (Which is a regression compared to 10.03.1-rc4, where the SVN revision is explicitly shown in the similar place.)

I browsed the Luci source and found out that it pulls the string from /etc/openwrt_release file, which was added to Backfire 9 months ago.

The Makefile for the base-files package already contains a SED command to place the correct SVN revision to /etc/banner, so I added a second command to add it also for /etc/openwrt_release (to which I also added a similar replacement seed string as in /etc/banner).

Additionally, I modified the 'getver.sh' so that it does not show the last check-in revision to Backfire branch, instead it shows the last SVN revision globally, which better reflects also the changes to packages, feeds etc.

My Luci screens now show like this in the upper right corner:

OpenWrt Backfire 10.03.SVN (r24714)
Load: 0.05 0.10 0.04
Hostname: OpenWrt

Changes done:

perus@HNVB:/Openwrt$ svn diff backfire/
Index: backfire/scripts/getver.sh
===================================================================
--- backfire/scripts/getver.sh    (revision 24919)
+++ backfire/scripts/getver.sh    (working copy)
@@ -11,7 +11,7 @@
 
 try_svn() {
     [ -d .svn ] || return 1
-    REV="$(svn info | awk '/^Last Changed Rev:/ { print $4 }')"
+    REV="$(svn info | awk '/^Revision:/ { print $2 }')"
     REV="${REV:+r$REV}"
     [ -n "$REV" ]
 }
Index: backfire/package/base-files/files/etc/openwrt_release
===================================================================
--- backfire/package/base-files/files/etc/openwrt_release    (revision 24919)
+++ backfire/package/base-files/files/etc/openwrt_release    (working copy)
@@ -1,4 +1,4 @@
 DISTRIB_ID="OpenWrt"
 DISTRIB_RELEASE="10.03"
 DISTRIB_CODENAME="backfire"
-DISTRIB_DESCRIPTION="OpenWrt Backfire 10.03"
+DISTRIB_DESCRIPTION="OpenWrt Backfire 10.03.SVN ($R)"
Index: backfire/package/base-files/Makefile
===================================================================
--- backfire/package/base-files/Makefile    (revision 24919)
+++ backfire/package/base-files/Makefile    (working copy)
@@ -364,6 +364,7 @@
         $(SED) 's/$$$$/:13848:0:99999:7:::/' $(1)/etc/shadow \
     )
     $(SED) 's,$$$$R,$(REVISION),g' $(1)/etc/banner
+    $(SED) 's,$$$$R,$(REVISION),g' $(1)/etc/openwrt_release
     mkdir -p $(1)/CONTROL
     mkdir -p $(1)/dev
     mkdir -p $(1)/etc/crontabs

The Console Rocks smile

The console rocks smile

The discussion might have continued from here.