mirror of
https://github.com/notwa/rc
synced 2025-02-05 07:43:22 -08:00
Revert "don't backup files if they're binary-equivalent"
This reverts commit 9e29489e84
.
This commit is contained in:
parent
e76bdf9a32
commit
2c223f7d99
1 changed files with 1 additions and 10 deletions
11
install
11
install
|
@ -18,14 +18,6 @@ dotless() {
|
||||||
}
|
}
|
||||||
|
|
||||||
backup() {
|
backup() {
|
||||||
if [ -n "$2" ] && [ $hassum -eq 1 ]; then
|
|
||||||
old="$(sha256sum "$1")"
|
|
||||||
new="$(sha256sum "$2")"
|
|
||||||
if [ "${new%% *}" == "${old%% *}" ]; then
|
|
||||||
note "overwriting $1"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
note "backing up $1"
|
note "backing up $1"
|
||||||
mkdir -p "${backup_dir:?backup_dir unset}/$(dirname "$1")"
|
mkdir -p "${backup_dir:?backup_dir unset}/$(dirname "$1")"
|
||||||
[ -e "$backup_dir/$1" ] && die "backup already exists"
|
[ -e "$backup_dir/$1" ] && die "backup already exists"
|
||||||
|
@ -37,7 +29,7 @@ hardlink() {
|
||||||
[ "$1" -ef "$2" ] && return
|
[ "$1" -ef "$2" ] && return
|
||||||
[ -h "$1" ] && note "removing symbolic link $1" && rm "$1"
|
[ -h "$1" ] && note "removing symbolic link $1" && rm "$1"
|
||||||
if [ -s "$1" ]; then
|
if [ -s "$1" ]; then
|
||||||
backup "$1" "$2" || die "$1 already exists"
|
backup "$1" || die "$1 already exists"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -104,7 +96,6 @@ softlink() {
|
||||||
}
|
}
|
||||||
|
|
||||||
which readlink >/dev/null || exit 1
|
which readlink >/dev/null || exit 1
|
||||||
which sha256sum >/dev/null && hassum=1 || hassum=0
|
|
||||||
|
|
||||||
rc="$(readlink -f "$(dirname "$0")" )"
|
rc="$(readlink -f "$(dirname "$0")" )"
|
||||||
cd "$HOME"
|
cd "$HOME"
|
||||||
|
|
Loading…
Add table
Reference in a new issue