123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- #!/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"
-
- MKIT_INI=${MKIT_INI:-mkit.ini}
- MKIT_INI_EXPAND=2
- MKIT_PROJ_PKGNAME=""
- MKIT_DEFAULT_MODE="644"
-
- _valid_targets() {
- #
- # List valid routes
- #
- echo build
- echo build_manpages
- echo clean
- echo debstuff
- echo dist
- echo install
- echo release_x
- echo release_y
- echo release_z
- echo rpmstuff
- echo uninstall
- echo vbump_x
- echo vbump_y
- echo vbump_z
- }
-
- 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
- }
-
- die() {
- #
- # Exit with message and non-zero exit status
- #
- echo "fatal: $*" >&2
- exit 4
- }
-
- mkit_init() {
- #
- # Do basic initialization
- #
- # Check for ini file and some variables
- #
- MKIT_PROJ_PKGNAME=$(ini 1value "project:pkgname")
- test -f "$MKIT_INI" || die "cannot find mkit.ini: $MKIT_INI"
- test -n "$(tr -d '[:space:]' <<<"$MKIT_LOCAL")" \
- || die "MKIT_LOCAL must be non-blank: '$MKIT_LOCAL'"
- }
-
- route() {
- #
- # Call correct function based on $1
- #
- if _valid_targets | grep -qwx "^$1";
- then
- "$1"
- else
- {
- echo "usage: $(basename "$0") TARGET"
- echo
- echo "valid targets:"
- _valid_targets | sed 's/^/ /'
- } >&2
- fi
- }
-
- warn() {
- #
- # Print warning message
- #
- echo "$@" >&2
- }
|