From 92bb7121cab14dbb35c30deb7b15f1fb4cc7eefb Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Sat, 26 Nov 2011 13:21:01 -0500 Subject: functions: add verbose output for overwriting files This goes in hand with an earlier commit which changed behavior to silenltly overwrite files rather than silently fail. Signed-off-by: Dave Reisner --- functions | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/functions b/functions index 401fa5c..857a613 100644 --- a/functions +++ b/functions @@ -83,7 +83,13 @@ _add_file() { (( $# == 3 )) || return $EINVAL - (( QUIET )) || plain "adding file: %s" "$1" + if (( ! QUIET )); then + if [[ -e "$BUILDROOT$1" ]]; then + plain "overwriting file: %s" "$1" + else + plain "adding file: %s" "$1" + fi + fi command install -Dm$3 "$2" "$BUILDROOT$1" } @@ -105,8 +111,13 @@ _add_symlink() { # $2: target of $1 (( $# == 2 )) || return $EINVAL - - (( QUIET )) || plain "adding symlink: %s -> %s" "$1" "$2" + if (( ! QUIET )); then + if [[ -L "$BUILDROOT$1" ]]; then + plain "overwriting symlink %s -> %s" "$1" "$2" + else + plain "adding symlink: %s -> %s" "$1" "$2" + fi + fi ln -sfn "$2" "$BUILDROOT$1" } -- cgit v1.2.3-24-g4f1b