mkversion.sh 921 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/bin/sh
  2. if svn info >/dev/null 2>/dev/null; then
  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. elif git status >/dev/null 2>/dev/null; then
  11. tag="$(git describe --tags 2>/dev/null)"
  12. branch="$(git symbolic-ref --short -q HEAD 2>/dev/null)"
  13. if [ -n "$tag" ]; then
  14. variant="LuCI $tag Release"
  15. elif [ "$branch" != "master" ]; then
  16. variant="LuCI ${branch##*-} Branch"
  17. else
  18. variant="LuCI Master"
  19. fi
  20. else
  21. variant="LuCI"
  22. fi
  23. cat <<EOF > $1
  24. local pcall, dofile, _G = pcall, dofile, _G
  25. module "luci.version"
  26. if pcall(dofile, "/etc/librecmc_release") and _G.DISTRIB_DESCRIPTION then
  27. distname = ""
  28. distversion = _G.DISTRIB_DESCRIPTION
  29. else
  30. distname = "${2:-libreCMC}"
  31. distversion = "${3:-Development Snapshot}"
  32. end
  33. luciname = "$variant"
  34. luciversion = "${5:-svn}"
  35. EOF