mkit.sh 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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, resolve
  16. # and check for PREFIX
  17. #
  18. test -f "$MKIT_INI" || die "cannot find mkit.ini: $MKIT_INI"
  19. tmp=$(mktemp)
  20. sed -e 's/ = /=/' < config.mk > $tmp
  21. . $tmp
  22. rm -f $tmp
  23. PREFIX="$(readlink -f "$PREFIX")"
  24. test -d "$PREFIX" || die "PREFIX points to bad directory: $PREFIX"
  25. }
  26. die() {
  27. #
  28. # Exit with message and non-zero exit status
  29. #
  30. echo "fatal: $@" >&2
  31. exit 4
  32. }
  33. warn() {
  34. #
  35. # Print warning message
  36. #
  37. echo "$@" >&2
  38. }
  39. route() {
  40. #
  41. # Call correct function based on $1
  42. #
  43. case $1 in
  44. build|build_manpages|clean|dist|install|release_?|uninstall)
  45. $1
  46. ;;
  47. *)
  48. echo "usage: $(basename $0) build|clean|dist|install|uninstall" >&2
  49. esac
  50. }