libs/web: rework cbi field validation, let validators return custom error messages...
[project/luci.git] / build / mkversion.sh
1 #!/bin/sh
2
3 local variant
4
5 if [ "${4%%/*}" = "branches" ]; then
6 variant="LuCI ${4##*[-/]} Branch"
7 elif [ "${4%%/*}" = "tags" ]; then
8 variant="LuCI ${4##*[-/]} Release"
9 else
10 variant="LuCI Trunk"
11 fi
12
13 cat <<EOF > $1
14 local pcall, dofile, _G = pcall, dofile, _G
15
16 module "luci.version"
17
18 if pcall(dofile, "/etc/openwrt_release") and _G.DISTRIB_DESCRIPTION then
19 distname = ""
20 distversion = _G.DISTRIB_DESCRIPTION
21 else
22 distname = "${2:-OpenWrt}"
23 distversion = "${3:-Development Snapshot}"
24 end
25
26 luciname = "$variant"
27 luciversion = "${5:-svn}"
28 EOF