use colors on messages
This commit is contained in:
parent
e4a3c05d83
commit
d9f5462b34
33
abuild
33
abuild
|
@ -25,20 +25,41 @@ PKGDEST=${PKGDEST:-$startdir}
|
||||||
|
|
||||||
default_cmds="sanitycheck builddeps clean fetch md5check unpack rootpkg"
|
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
|
# functions
|
||||||
msg() {
|
msg() {
|
||||||
local fake="${FAKEROOTKEY:+(fakeroot) }"
|
local prompt="$GREEN>>>${NORMAL}"
|
||||||
local name="${subpkgname:-$pkgname}"
|
local fake="${FAKEROOTKEY:+${BLUE}(fakeroot)${NORMAL} }"
|
||||||
[ -z "$quiet" ] && echo ">>> ${fake}${name}:" "$@" >&2
|
local name="${STRONG}${subpkgname:-$pkgname}${NORMAL}"
|
||||||
|
[ -z "$quiet" ] && printf "${prompt} ${fake}${name}: $@\n" >&2
|
||||||
}
|
}
|
||||||
|
|
||||||
warning() {
|
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() {
|
die() {
|
||||||
quiet=
|
error "$@"
|
||||||
msg "$@" >&2
|
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,3 +4,6 @@ export CXXFLAGS="$CFLAGS"
|
||||||
export PATH=:/usr/i386-gentoo-linux-uclibc/binutils-bin/2.18:$PATH
|
export PATH=:/usr/i386-gentoo-linux-uclibc/binutils-bin/2.18:$PATH
|
||||||
|
|
||||||
export MAKEFLAGS=-j2
|
export MAKEFLAGS=-j2
|
||||||
|
|
||||||
|
# remove line below to disable colors
|
||||||
|
USE_COLORS=1
|
||||||
|
|
Loading…
Reference in New Issue