Commit e48c520d authored by Natanael Copa's avatar Natanael Copa

abuild: move functions to a shared lib

parent 395a7951
......@@ -5,6 +5,7 @@ DISTFILES=Makefile abuild abuild.conf APKBUILD.proto
prefix ?= /usr
sysconfdir ?= /etc
datadir ?= $(prefix)/share/$(PACKAGE)
P=$(PACKAGE)-$(VERSION)
......@@ -13,12 +14,13 @@ help:
@echo "usage: make install [ DESTDIR=<path> ]"
@echo " make dist"
install: abuild abuild.conf APKBUILD.proto
install: abuild abuild.conf APKBUILD.proto functions.sh
mkdir -p $(DESTDIR)/$(prefix)/bin $(DESTDIR)/$(sysconfdir) \
$(DESTDIR)/$(prefix)/share/abuild
$(DESTDIR)/$(datadir)
cp abuild $(DESTDIR)/$(prefix)/bin/
cp abuild.conf $(DESTDIR)/$(sysconfdir)/
cp APKBUILD.proto $(DESTDIR)/$(prefix)/share/abuild
cp functions.sh $(DESTDIR)/$(datadir)/
dist: $(P).tar.gz
......
......@@ -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
......
#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
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment