build: better not use a local var, it breaks various shells
[project/luci.git] / build / mkversion.sh
1 #!/bin/sh
2
3 if [ "${4%%/*}" = "branches" ]; then
4 variant="LuCI ${4##*[-/]} Branch"
5 elif [ "${4%%/*}" = "tags" ]; then
6 variant="LuCI ${4##*[-/]} Release"
7 else
8 variant="LuCI Trunk"
9 fi
10
11 cat <<EOF > $1
12 local pcall, dofile, _G = pcall, dofile, _G
13
14 module "luci.version"
15
16 if pcall(dofile, "/etc/openwrt_release") and _G.DISTRIB_DESCRIPTION then
17 distname = ""
18 distversion = _G.DISTRIB_DESCRIPTION
19 else
20 distname = "${2:-OpenWrt}"
21 distversion = "${3:-Development Snapshot}"
22 end
23
24 luciname = "$variant"
25 luciversion = "${5:-svn}"
26 EOF