-# func_cp_if_changed SRC DEST
-# Like cp, but avoids munging timestamps if the file hasn't changed.
-# Uses also the variables
-# - dry_run true if actions shall only be printed, blank otherwise
-func_cp_if_changed ()
-{
- if test $# -ne 2; then
- echo "usage: func_cp_if_changed SRC DEST" >&2
- fi
- test -n "$dry_run" && dry=echo
- if cmp "$1" "$2" >/dev/null 2>&1; then
- :
- else
- $dry cp -p "$1" "$2"
- fi
-}
-
-# func_mv_if_changed SRC DEST
-# Like mv, but avoids munging timestamps if the file hasn't changed.
-# Removes SRC if it is not renamed.
-# Uses also the variables
-# - dry_run true if actions shall only be printed, blank otherwise
-func_mv_if_changed ()
-{
- if test $# -ne 2; then
- echo "usage: func_mv_if_changed SRC DEST" >&2
- fi
- test -n "$dry_run" && dry=echo
- if cmp "$1" "$2" >/dev/null 2>&1; then
- $dry rm "$1"
- else
- $dry mv "$1" "$2"
- fi
-}
-