1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- #!/bin/bash
-
- . "$MKIT_DIR/include/build.sh" || die "cannot import build.sh"
- . "$MKIT_DIR/include/deploy.sh" || die "cannot import deploy.sh"
- . "$MKIT_DIR/include/release.sh" || die "cannot import release.sh"
- . "$MKIT_DIR/include/ini.sh" || die "cannot import ini.sh"
-
- debug() {
- #
- # Print debug message
- #
- $MKIT_DEBUG || return 0
- echo "MKIT_DEBUG: ${FUNCNAME[1]}()" "$@" >&2
- }
-
- debug_var() {
- #
- # Print debug message
- #
- $MKIT_DEBUG || return 0
- local __mkit_debug_var_name__
- for __mkit_debug_var_name__ in "$@";
- do
- {
- echo -n "MKIT_DEBUG: ${FUNCNAME[1]}():"
- echo -n " $__mkit_debug_var_name__"
- echo -n "='${!__mkit_debug_var_name__}'"
- echo
- } >&2
- done
- }
-
- MKIT_INI=${MKIT_INI:-mkit.ini}
- MKIT_INI_EXPAND=2
- MKIT_PKGNAME=$(ini 1value "ENV:PKGNAME")
- MKIT_PROJNAME=$(ini 1value "ENV:PROJNAME")
- MKIT_DEFAULT_MODE="644"
-
- mkit_init() {
- #
- # Do basic initialization
- #
- # Check for ini file, load variables from config.mk
- #
- test -f "$MKIT_INI" || die "cannot find mkit.ini: $MKIT_INI"
- tmp=$(mktemp)
- sed -e 's/ = /=/' < config.mk > "$tmp"
- . "$tmp"
- rm -f "$tmp"
- test -n "$(tr -d '[:space:]' <<<"$MKIT_LOCAL")" \
- || die "MKIT_LOCAL must be non-blank: '$MKIT_LOCAL'"
- }
-
- die() {
- #
- # Exit with message and non-zero exit status
- #
- echo "fatal: $*" >&2
- exit 4
- }
-
- warn() {
- #
- # Print warning message
- #
- echo "$@" >&2
- }
-
- route() {
- #
- # Call correct function based on $1
- #
- case $1 in
- build|build_manpages|clean|dist|rpmstuff|install|release_?|uninstall|vbump_?)
- $1
- ;;
- *)
- echo "usage: $(basename "$0") build|clean|dist|rpmstuff|install|uninstall" >&2
- esac
- }
|