From 63ab32635aac24e6a8fd78598f60b56f31987e4a Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Thu, 6 Dec 2012 22:19:06 +0100 Subject: add skeleton for autotest testsuite --- build-aux/move-if-change | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 build-aux/move-if-change (limited to 'build-aux') diff --git a/build-aux/move-if-change b/build-aux/move-if-change new file mode 100755 index 0000000..03dd02e --- /dev/null +++ b/build-aux/move-if-change @@ -0,0 +1,17 @@ +#!/bin/sh +# Like mv $1 $2, but if the files are the same, just delete $1. +# Status is zero if successful, nonzero otherwise. +# +# Copyright (C) 2011 Free Software Foundation, Inc. +# License GPLv3+: GNU GPL version 3 or later +# This is free software: you are free to change and redistribute it. +# There is NO WARRANTY, to the extent permitted by law." + +if test -r "$2" && cmp -- "$1" "$2" >/dev/null; then + rm -f -- "$1" +else + if mv -f -- "$1" "$2"; then :; else + # Ignore failure due to a concurrent move-if-change. + test -r "$2" && cmp -- "$1" "$2" >/dev/null && rm -f -- "$1" + fi +fi -- cgit