summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2015-05-25 01:19:43 -0600
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-04-17 14:46:22 -0400
commit854507251904e830272b068175df3f691c337576 (patch)
treea6604729828684168f1181bc067ff38a47951267
parent9109540a48f2c1f64bb049702b3e8d849571c487 (diff)
db-functions: use librelib instead of having copies here
-rw-r--r--db-functions68
1 files changed, 7 insertions, 61 deletions
diff --git a/db-functions b/db-functions
index 62d0d72..4a97e0b 100644
--- a/db-functions
+++ b/db-functions
@@ -34,57 +34,13 @@ fi
LOCKS=()
REPO_MODIFIED=0
-# check if messages are to be printed using color
-unset ALL_OFF BOLD BLUE GREEN RED YELLOW
-if [[ -t 2 ]]; then
- ALL_OFF="$(tput sgr0)"
- BOLD="$(tput bold)"
- BLUE="${BOLD}$(tput setaf 4)"
- GREEN="${BOLD}$(tput setaf 2)"
- RED="${BOLD}$(tput setaf 1)"
- YELLOW="${BOLD}$(tput setaf 3)"
-fi
-readonly ALL_OFF BOLD BLUE GREEN RED YELLOW
-
-plain() {
- local mesg=$1; shift
- printf "${BOLD} ${mesg}${ALL_OFF}\n" "$@"
-}
-
-msg() {
- local mesg=$1; shift
- printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@"
-}
-
-msg2() {
- local mesg=$1; shift
- printf "${BLUE} ->${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@"
-}
-
-warning() {
- local mesg=$1; shift
- printf "${YELLOW}==> WARNING:${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
-}
-
-error() {
- local mesg=$1; shift
- printf "${RED}==> ERROR${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
-}
-
-##
-# usage : in_array( $needle, $haystack )
-# return : 0 - found
-# 1 - not found
-##
-in_array() {
- local needle=$1; shift
- [[ -z $1 ]] && return 1 # Not Found
- local item
- for item in "$@"; do
- [[ $item = "$needle" ]] && return 0 # Found
- done
- return 1 # Not Found
-}
+# Used: plain, msg, msg2, warning, error, in_array, abort, die
+# Overwritten: get_full_version, cleanup
+# Ignored: stat_busy, stat_done,
+# setup_workdir, trap_abort, trap_exit,
+# lock, slock, lock_close
+# pkgver_equal, find_cached_package, check_root
+. "$(librelib common)"
##
# usage : get_full_version( $epoch, $pkgver, $pkgrel )
@@ -151,16 +107,6 @@ cleanup() {
[ "$1" ] && exit "$1"
}
-abort() {
- msg 'Aborting...'
- cleanup 0
-}
-
-die() {
- error "$*"
- cleanup 1
-}
-
trap abort INT QUIT TERM HUP
trap cleanup EXIT