From 9d70cdc60dbebccd92e073035dca5d27615569c8 Mon Sep 17 00:00:00 2001 From: Dmitry Eremin-Solenikov Date: Mon, 8 Dec 2014 02:08:18 +0300 Subject: update.sh: add MV-like function preserving file timestamps Add a do_mv()/$MV wrappers to be called instead of just mv. This function will preserve the target file if it does not differ from the source file. This helps to remove unnecessary compilator calls after calling update.sh w/o source changes. Signed-off-by: Dmitry Eremin-Solenikov --- update.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/update.sh b/update.sh index f7c38c9..9c49ad5 100755 --- a/update.sh +++ b/update.sh @@ -44,7 +44,16 @@ libtls_version=$major:$minor:0 echo "libtls version $libtls_version" echo $libtls_version > tls/VERSION +do_mv() { + if ! cmp -s "$1" "$2" + then + mv "$1" "$2" + else + rm -f "$1" + fi +} CP='cp -p' +MV='do_mv' $CP $libssl_src/src/LICENSE COPYING @@ -68,8 +77,8 @@ $CP $libcrypto_src/crypto/arc4random_*.h crypto/compat perl objects.pl objects.txt obj_mac.num obj_mac.h; perl obj_dat.pl obj_mac.h obj_dat.h ) mkdir -p include/openssl crypto/objects -mv $libssl_src/src/crypto/objects/obj_mac.h ./include/openssl/obj_mac.h -mv $libssl_src/src/crypto/objects/obj_dat.h ./crypto/objects/obj_dat.h +$MV $libssl_src/src/crypto/objects/obj_mac.h ./include/openssl/obj_mac.h +$MV $libssl_src/src/crypto/objects/obj_dat.h ./crypto/objects/obj_dat.h copy_hdrs() { for file in $2; do -- cgit v1.2.3-55-g6feb