X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=build%2Fmkversion.sh;h=3680008dfe934b7307901484f072d30ddffeddee;hp=2361e5f3b9ab19086e8f2b3e855aa2fcf5528ccc;hb=212d7be5331f9dc8c7965214cab61a59bfb8c6f6;hpb=89c8f98b12f28caf95989d99da6b6cb411f979c5 diff --git a/build/mkversion.sh b/build/mkversion.sh index 2361e5f3b..3680008df 100755 --- a/build/mkversion.sh +++ b/build/mkversion.sh @@ -1,20 +1,40 @@ #!/bin/sh -local variant +if svn info >/dev/null 2>/dev/null; then + if [ "${4%%/*}" = "branches" ]; then + variant="LuCI ${4##*[-/]} Branch" + elif [ "${4%%/*}" = "tags" ]; then + variant="LuCI ${4##*[-/]} Release" + else + variant="LuCI Trunk" + fi +elif git status >/dev/null 2>/dev/null; then + tag="$(git describe --tags 2>/dev/null)" + branch="$(git symbolic-ref --short -q HEAD 2>/dev/null)" -if [ "${4%%/*}" = "branches" ]; then - variant="LuCI ${4##*[-/]} Branch" -elif [ "${4%%/*}" = "tags" ]; then - variant="LuCI ${4##*[-/]} Release" + if [ -n "$tag" ]; then + variant="LuCI $tag Release" + elif [ "$branch" != "master" ]; then + variant="LuCI ${branch##*-} Branch" + else + variant="LuCI Master" + fi else - variant="LuCI Trunk" + variant="LuCI" fi cat < $1 +local pcall, dofile, _G = pcall, dofile, _G + module "luci.version" -distname = "${2:-OpenWrt}" -distversion = "${3:-Development Snapshot}" +if pcall(dofile, "/etc/openwrt_release") and _G.DISTRIB_DESCRIPTION then + distname = "" + distversion = _G.DISTRIB_DESCRIPTION +else + distname = "${2:-OpenWrt}" + distversion = "${3:-Development Snapshot}" +end luciname = "$variant" luciversion = "${5:-svn}"