Browse Source

fix: prevent displaying confusing ``diff`` output when file is already existing and different

Signed-off-by: Valentin Lab <valentin.lab@kalysto.org>
pull/1/head
Valentin Lab 5 years ago
parent
commit
990a84ed0a
  1. 4
      src/install.sh

4
src/install.sh

@ -129,7 +129,7 @@ install_file() {
cat > "${tmpfile}" || return 1 cat > "${tmpfile}" || return 1
mkdir -vp "${path%/*}" || exit 1 mkdir -vp "${path%/*}" || exit 1
if [[ -e "$path" ]]; then 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." info "File '$path' exists but is different, archiving current content and replacing it."
candidate="${path}.bak" candidate="${path}.bak"
n=1 n=1
@ -189,7 +189,7 @@ fetch_binary() {
echo " .. ${RED}Failed${NORMAL} (fetched content is HTML !?!)." >&2 echo " .. ${RED}Failed${NORMAL} (fetched content is HTML !?!)." >&2
return 1 return 1
fi 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 echo " .. ${GREEN}Done${NORMAL} (File '$BIN_PATH/$name' was already up to date.)" >&2
else else
mv "$tmpfile" "$BIN_PATH/$name" && mv "$tmpfile" "$BIN_PATH/$name" &&

Loading…
Cancel
Save