mkit.sh 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/bin/bash
  2. . "$MKIT_DIR/include/build.sh" || die "cannot import build.sh"
  3. . "$MKIT_DIR/include/deploy.sh" || die "cannot import deploy.sh"
  4. . "$MKIT_DIR/include/release.sh" || die "cannot import release.sh"
  5. . "$MKIT_DIR/include/ini.sh" || die "cannot import ini.sh"
  6. MKIT_INI=${MKIT_INI:-mkit.ini}
  7. MKIT_INI_EXPAND=2
  8. MKIT_PKGNAME=$(ini 1value "ENV:PKGNAME")
  9. MKIT_PROJNAME=$(ini 1value "ENV:PROJNAME")
  10. MKIT_DEFAULT_MODE="644"
  11. mkit_init() {
  12. #
  13. # Do basic initialization
  14. #
  15. # Check for ini file, load variables from config.mk
  16. #
  17. test -f "$MKIT_INI" || die "cannot find mkit.ini: $MKIT_INI"
  18. tmp=$(mktemp)
  19. sed -e 's/ = /=/' < config.mk > "$tmp"
  20. . "$tmp"
  21. rm -f "$tmp"
  22. test -n "$(tr -d '[:space:]' <<<"$MKIT_LOCAL")" \
  23. || die "MKIT_LOCAL must be non-blank: '$MKIT_LOCAL'"
  24. }
  25. die() {
  26. #
  27. # Exit with message and non-zero exit status
  28. #
  29. echo "fatal: $*" >&2
  30. exit 4
  31. }
  32. warn() {
  33. #
  34. # Print warning message
  35. #
  36. echo "$@" >&2
  37. }
  38. route() {
  39. #
  40. # Call correct function based on $1
  41. #
  42. case $1 in
  43. build|build_manpages|clean|dist|install|release_?|uninstall)
  44. $1
  45. ;;
  46. *)
  47. echo "usage: $(basename "$0") build|clean|dist|install|uninstall" >&2
  48. esac
  49. }