summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-lua-runtime/src/mkversion.sh
diff options
context:
space:
mode:
Diffstat (limited to 'modules/luci-lua-runtime/src/mkversion.sh')
-rwxr-xr-xmodules/luci-lua-runtime/src/mkversion.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/modules/luci-lua-runtime/src/mkversion.sh b/modules/luci-lua-runtime/src/mkversion.sh
new file mode 100755
index 0000000000..e2d02c1c74
--- /dev/null
+++ b/modules/luci-lua-runtime/src/mkversion.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+cat <<EOF > $1
+local pcall, dofile, _G = pcall, dofile, _G
+
+module "luci.version"
+
+if pcall(dofile, "/etc/openwrt_release") and _G.DISTRIB_DESCRIPTION then
+ distname = ""
+ distversion = _G.DISTRIB_DESCRIPTION
+ if _G.DISTRIB_REVISION then
+ distrevision = _G.DISTRIB_REVISION
+ if not distversion:find(distrevision,1,true) then
+ distversion = distversion .. " " .. distrevision
+ end
+ end
+else
+ distname = "OpenWrt"
+ distversion = "Development Snapshot"
+end
+
+luciname = "${3:-LuCI}"
+luciversion = "${2:-Git}"
+EOF