diff options
Diffstat (limited to 'update_from_disk.sh')
| -rwxr-xr-x | update_from_disk.sh | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/update_from_disk.sh b/update_from_disk.sh index c0e9d55..b113e31 100755 --- a/update_from_disk.sh +++ b/update_from_disk.sh @@ -15,10 +15,13 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" copy_file() { local src="$1" local dest="$2" - echo "cp -a $src $dest" - if ! cp -a "$src" "$dest" 2>/dev/null; then - echo "Failed - using sudo..." - sudo cp -a "$src" "$dest" + # update only if files are different + if ! diff "$src" "$dest" &>/dev/null; then + echo "Updating $dest..." + if ! cp -a "$src" "$dest" 2>/dev/null; then + echo "Failed - using sudo..." + sudo cp -a "$src" "$dest" + fi fi } |
