summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2011-11-26 19:21:01 +0100
committerDave Reisner <dreisner@archlinux.org>2011-11-29 11:56:42 +0100
commit92bb7121cab14dbb35c30deb7b15f1fb4cc7eefb (patch)
tree70d3a6362a4a7363f8bdaa126a3d7f6866064f4b
parent082e8bbacedd7d9be7162b5ab1779eff172e2530 (diff)
downloadmkinitcpio-92bb7121cab14dbb35c30deb7b15f1fb4cc7eefb.tar.gz
mkinitcpio-92bb7121cab14dbb35c30deb7b15f1fb4cc7eefb.tar.xz
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 <dreisner@archlinux.org>
-rw-r--r--functions17
1 files 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"
}