diff options
-rwxr-xr-x | abuild | 33 | ||||
-rw-r--r-- | abuild.conf | 3 |
2 files changed, 30 insertions, 6 deletions
@@ -25,20 +25,41 @@ PKGDEST=${PKGDEST:-$startdir} default_cmds="sanitycheck builddeps clean fetch md5check unpack rootpkg" +#colors +if [ -n "$USE_COLORS" ]; then + NORMAL="\033[1;0m" + STRONG="\033[1;1m" + RED="\033[1;31m" + GREEN="\033[1;32m" + YELLOW="\033[1;33m" + BLUE="\033[1;34m" +fi + + # functions msg() { - local fake="${FAKEROOTKEY:+(fakeroot) }" - local name="${subpkgname:-$pkgname}" - [ -z "$quiet" ] && echo ">>> ${fake}${name}:" "$@" >&2 + local prompt="$GREEN>>>${NORMAL}" + local fake="${FAKEROOTKEY:+${BLUE}(fakeroot)${NORMAL} }" + local name="${STRONG}${subpkgname:-$pkgname}${NORMAL}" + [ -z "$quiet" ] && printf "${prompt} ${fake}${name}: $@\n" >&2 } warning() { - echo ">>> Warning:" "$@" >&2 + local prompt="${YELLOW}>>> WARNING: ${NORMAL}" + local fake="${FAKEROOTKEY:+${BLUE}(fakeroot)${NORMAL} }" + local name="${STRONG}${subpkgname:-$pkgname}${NORMAL}" + printf "${prompt} ${fake}${name}: $@\n" >&2 +} + +error() { + local prompt="${RED}>>> ERROR: ${NORMAL}" + local fake="${FAKEROOTKEY:+${BLUE}(fakeroot)${NORMAL} }" + local name="${STRONG}${subpkgname:-$pkgname}${NORMAL}" + printf "${prompt} ${fake}${name}: $@\n" >&2 } die() { - quiet= - msg "$@" >&2 + error "$@" exit 1 } diff --git a/abuild.conf b/abuild.conf index 586e5ad..aba818a 100644 --- a/abuild.conf +++ b/abuild.conf @@ -4,3 +4,6 @@ export CXXFLAGS="$CFLAGS" export PATH=:/usr/i386-gentoo-linux-uclibc/binutils-bin/2.18:$PATH export MAKEFLAGS=-j2 + +# remove line below to disable colors +USE_COLORS=1 |