diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2009-01-03 10:05:12 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2009-01-03 10:05:12 +0000 |
commit | e48c520d54ce487c69105009be0408c9bcf0d6b4 (patch) | |
tree | 902611b534f37b870575a3ae767228f14c4ae4c4 /abuild | |
parent | 395a795126bcf0a683420db47a9afc0d672fe8ff (diff) | |
download | abuild-e48c520d54ce487c69105009be0408c9bcf0d6b4.tar.gz abuild-e48c520d54ce487c69105009be0408c9bcf0d6b4.tar.bz2 abuild-e48c520d54ce487c69105009be0408c9bcf0d6b4.tar.xz abuild-e48c520d54ce487c69105009be0408c9bcf0d6b4.zip |
abuild: move functions to a shared lib
Diffstat (limited to 'abuild')
-rwxr-xr-x | abuild | 47 |
1 files changed, 14 insertions, 33 deletions
@@ -14,6 +14,20 @@ abuild_ver=0.9 MAKEAPK_CONF=${MAKEAPK_CONF:-/etc/abuild.conf} [ -f "$MAKEAPK_CONF" ] && . "$MAKEAPK_CONF" +# source functions +# if abuild was not run from PATH, then look for func lib at same location +if [ -z "$FUNCLIB" ]; then + FUNCLIB="${0##/*}/functions.sh" + [ -f "$FUNCLIB" ] || FUNCLIB=/usr/share/abuild/functions.sh +fi + +if ! [ -f "$FUNCLIB" ]; then + echo "$FUNCLIB: not found" >&2 + exit 1 +fi +. "$FUNCLIB" + + startdir="$PWD" srcdir=${srcdir:-"$startdir/src"} pkgdir=${pkgdir:-"$startdir/pkg"} @@ -25,39 +39,6 @@ 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 prompt="$GREEN>>>${NORMAL}" - local fake="${FAKEROOTKEY:+${BLUE}(fakeroot)${NORMAL} }" - local name="${STRONG}${subpkgname:-$pkgname}${NORMAL}" - [ -z "$quiet" ] && printf "${prompt} ${fake}${name}: $@\n" >&2 -} - -warning() { - 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 -} - set_xterm_title() { if [ "$TERM" = xterm ]; then printf "\033]0;$1\007" >&2 |