From 74016955eecc54b87a7cd58927534a6b2871594d Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Fri, 29 Sep 2017 11:33:27 +0200 Subject: [PATCH] Be more defensive with mv and use --no-target-directory --- .../files/static-mirroring/static-master-update-component | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/roles/files/static-mirroring/static-master-update-component b/modules/roles/files/static-mirroring/static-master-update-component index c115ae447..4ab5143e5 100755 --- a/modules/roles/files/static-mirroring/static-master-update-component +++ b/modules/roles/files/static-mirroring/static-master-update-component @@ -132,11 +132,11 @@ rsync --delete \ "$src/." "$tmpdir_new/." echo "$0: Done. Committing." -mv "$tgt" "$tmpdir_old/old" -if ! mv "$tmpdir_new" "$tgt"; then +mv --no-target-directory "$tgt" "$tmpdir_old/old" +if ! mv --no-target-directory "$tmpdir_new" "$tgt"; then echo >&2 "$0: WARNING: could not move $tmpdir_new to $tgt. Trying to recover" rm -rf "$tgt" - mv "$tmpdir_old/old" "$tgt" + mv --no-target-directory "$tmpdir_old/old" "$tgt" echo >&2 "$0: Rolled back to old tree, maybe even successfully." exit 1 fi -- 2.20.1