minstall: Don't copy over an identical file
authorCarl Worth <cworth@cworth.org>
Thu, 21 May 2009 13:52:13 +0000 (07:52 -0600)
committerBrian Paul <brianp@vmware.com>
Thu, 21 May 2009 13:52:13 +0000 (07:52 -0600)
The rationale here is to avoid updating a timestamp for a file that
hasn't changed. Needless updates of the timestamp can ripple into
other projects, (xserver, etc.), useless recompiling due to a
'make install' in mesa that didn't actually change anything.

bin/minstall

index 8ee96089fa618d7d98866f5bb59420294501eb6b..130025829ba727210ab8eef55b15b8412eeb9879 100755 (executable)
@@ -66,8 +66,11 @@ if [ $# -ge 2 ] ; then
 
                elif [ -f "$FILE" ] ; then
                        #echo "$FILE" is a regular file
-                       $RM "$DEST/`basename $FILE`"
-                       cp "$FILE" "$DEST"
+                       # Only copy if the files differ
+                       if ! cmp -s $FILE $DEST/`basename $FILE`; then
+                               $RM "$DEST/`basename $FILE`"
+                               cp "$FILE" "$DEST"
+                       fi
                        if [ $MODE ] ; then
                                FILE=`basename "$FILE"`
                                chmod $MODE "$DEST/$FILE"