From 990a84ed0ab6d90fa1e6fb2cda1c5296267cdf90 Mon Sep 17 00:00:00 2001 From: Valentin Lab Date: Wed, 22 Jan 2020 18:16:55 +0100 Subject: [PATCH] fix: prevent displaying confusing ``diff`` output when file is already existing and different Signed-off-by: Valentin Lab --- src/install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/install.sh b/src/install.sh index 27e7d37..7273976 100755 --- a/src/install.sh +++ b/src/install.sh @@ -129,7 +129,7 @@ install_file() { cat > "${tmpfile}" || return 1 mkdir -vp "${path%/*}" || exit 1 if [[ -e "$path" ]]; then - if ! diff "${tmpfile}" "${path}";then + if ! diff "${tmpfile}" "${path}" >/dev/null 2>&1;then info "File '$path' exists but is different, archiving current content and replacing it." candidate="${path}.bak" n=1 @@ -189,7 +189,7 @@ fetch_binary() { echo " .. ${RED}Failed${NORMAL} (fetched content is HTML !?!)." >&2 return 1 fi - if [ -e "$BIN_PATH/$name" ] && diff "$tmpfile" "$BIN_PATH/$name" >/dev/null; then + if [ -e "$BIN_PATH/$name" ] && diff "$tmpfile" "$BIN_PATH/$name" >/dev/null 2>&1; then echo " .. ${GREEN}Done${NORMAL} (File '$BIN_PATH/$name' was already up to date.)" >&2 else mv "$tmpfile" "$BIN_PATH/$name" &&