1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #!/bin/bash
  2. #shellcheck disable=SC2034,SC1090
  3. # mkit - simple install helper
  4. # See LICENSE file for copyright and license details.
  5. die() {
  6. #
  7. # Poor man's die() (mkit.sh has better)
  8. #
  9. echo "$@" >&2 && exit 9
  10. }
  11. #
  12. # Bump size (for vbump_? and release_?)
  13. #
  14. MKIT_BUMPSIZE=${MKIT_BUMPSIZE:-1}
  15. #
  16. # Debug mode (true|false)
  17. #
  18. MKIT_DEBUG=${MKIT_DEBUG:-false}
  19. #
  20. # Default deploy mode for files
  21. #
  22. MKIT_DEFAULT_MODE="644"
  23. #
  24. # Path to MKit dir (where 'include' is)
  25. #
  26. MKIT_DIR=${MKIT_DIR:-$(dirname "$0")}
  27. #
  28. # Dry mode (true|false)
  29. #
  30. # Set to true to not install anything. Implies MKIT_DEBUG.
  31. #
  32. MKIT_DRY=${MKIT_DRY:-false}
  33. #
  34. # Path to mkit.ini
  35. #
  36. MKIT_INI=${MKIT_INI:-mkit.ini}
  37. #
  38. # Limit ini expansion depth
  39. #
  40. # To avoid endless loops, this value is subtracted each
  41. # time ini() expands a reference; when zero is reached,
  42. # no more expansions happen.
  43. #
  44. MKIT_INI_EXPAND=2
  45. #
  46. # Path to MKit local config and temp
  47. #
  48. # Typically hidden in project root, here MKit can
  49. # save its temporary lists.
  50. #
  51. MKIT_LOCAL=${MKIT_LOCAL:-.mkit}
  52. #
  53. # Package name
  54. #
  55. # Used as base for tarball and in some default tokens.
  56. #
  57. MKIT_PROJ_PKGNAME=""
  58. #
  59. # This MKit version
  60. #
  61. MKIT_VERSION=0.0.20
  62. . "$MKIT_DIR/include/mkit.sh" || die "failed to init; check if MKIT_DIR is set properly: $MKIT_DIR"
  63. case "$1" in
  64. --version-semver) echo "$MKIT_VERSION"; exit 0 ;;
  65. --version) echo "Mkit (Simple Makefile target helper) $MKIT_VERSION"
  66. exit 0 ;;
  67. esac
  68. mkit_init
  69. route "$@"