From 678983d2623d7ed700a70634089eef1c9f0b9b21 Mon Sep 17 00:00:00 2001 From: Andrew Fyfe Date: Wed, 29 Aug 2007 10:49:24 +0100 Subject: scripts/*.sh.in: Clean up and fix a few bugs repo-add, repo-remove: 'bsdtar -c * | ...' doesn't work (you need '-f -'). Code clean up eliminated this bug. Removed the multiple checksum support, pacman now only supports MD5, so there's no need for the database to contain multiple checksums. Quote all variables containing file/dir names to prevent paths containing spaces from causing problems. Add msg, warning and error functions. General code clean up. pacman-optimize: Use a sub-directory in /tmp for working files to make it easier to clean up at the end. Add quotes round $@ in die and die_r, otherwise printf can't display the message correctly. makepkg: Disable colour output if stderr is not a tty. Signed-off-by: Andrew Fyfe --- scripts/makepkg.sh.in | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'scripts/makepkg.sh.in') diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index cd5dbf54..d5b41144 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -66,7 +66,7 @@ PACMAN_OPTS= plain() { local mesg=$1; shift - if [ ! "$USE_COLOR" = "n" -a "$(check_buildenv color)" = "y" ]; then + if [ -t 2 -a ! "$USE_COLOR" = "n" -a "$(check_buildenv color)" = "y" ]; then printf "\033[1;37m ${mesg}\033[0m\n" "$@" >&2 else printf " ${mesg}\n" "$@" >&2 @@ -75,7 +75,7 @@ plain() { msg() { local mesg=$1; shift - if [ ! "$USE_COLOR" = "n" -a "$(check_buildenv color)" = "y" ]; then + if [ -t 2 -a ! "$USE_COLOR" = "n" -a "$(check_buildenv color)" = "y" ]; then printf "\033[1;32m==>\033[1;37m ${mesg}\033[0m\n" "$@" >&2 else printf "==> ${mesg}\n" "$@" >&2 @@ -84,7 +84,7 @@ msg() { msg2() { local mesg=$1; shift - if [ ! "$USE_COLOR" = "n" -a "$(check_buildenv color)" = "y" ]; then + if [ -t 2 -a ! "$USE_COLOR" = "n" -a "$(check_buildenv color)" = "y" ]; then printf "\033[1;34m ->\033[1;37m ${mesg}\033[0m\n" "$@" >&2 else printf " -> ${mesg}\n" "$@" >&2 @@ -93,7 +93,7 @@ msg2() { warning() { local mesg=$1; shift - if [ ! "$USE_COLOR" = "n" -a "$(check_buildenv color)" = "y" ]; then + if [ -t 2 -a ! "$USE_COLOR" = "n" -a "$(check_buildenv color)" = "y" ]; then printf "\033[1;33m==> $(gettext "WARNING:")\033[1;37m ${mesg}\033[0m\n" "$@" >&2 else printf "==> $(gettext "WARNING:") ${mesg}\n" "$@" >&2 @@ -102,7 +102,7 @@ warning() { error() { local mesg=$1; shift - if [ ! "$USE_COLOR" = "n" -a "$(check_buildenv color)" = "y" ]; then + if [ -t 2 -a ! "$USE_COLOR" = "n" -a "$(check_buildenv color)" = "y" ]; then printf "\033[1;31m==> $(gettext "ERROR:")\033[1;37m ${mesg}\033[0m\n" "$@" >&2 else printf "==> $(gettext "ERROR:") ${mesg}\n" "$@" >&2 -- cgit v1.2.3