Otherwize the distrevision may be displayed twice if it contains some special matching patterns.(For example I am using "git-$hash" in my own OpenWrt branch.) Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
24 lines
534 B
Bash
Executable file
24 lines
534 B
Bash
Executable file
#!/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
|