diff --git a/ops/backup-workspace-scripts.sh b/ops/backup-workspace-scripts.sh index e5f4a06..dc710c9 100755 --- a/ops/backup-workspace-scripts.sh +++ b/ops/backup-workspace-scripts.sh @@ -1,6 +1,5 @@ #!/usr/bin/env bash set -uo pipefail -export COPYFILE_DISABLE=1 repo_root=$(git rev-parse --show-toplevel) if [ -n "$(git -C "$repo_root" status --porcelain -- ops)" ]; then @@ -26,8 +25,11 @@ printf 'ok\tlocal\t%s\n' "$local_target" sync_remote() { local host="$1" relative_target="$2" - if tar -C "$stage" -czf - . | ssh -o BatchMode=yes -o ConnectTimeout=8 "$host" \ - "mkdir -p '$relative_target' && find '$relative_target' -type f -name '._*' -delete && COPYFILE_DISABLE=1 tar -xzf - -C '$relative_target'"; then + if ssh -o BatchMode=yes -o ConnectTimeout=8 "$host" \ + "mkdir -p '$relative_target' && find '$relative_target' -type f -name '._*' -delete" \ + && scp -q -r "$stage/ops" "$stage/BACKUP-MANIFEST.txt" "$host:$relative_target/" \ + && ssh -o BatchMode=yes -o ConnectTimeout=8 "$host" \ + "test -s '$relative_target/BACKUP-MANIFEST.txt' && test -f '$relative_target/ops/README.md'"; then printf 'ok\t%s\t%s\n' "$host" "$relative_target" return 0 fi