Avoid AppleDouble files in workspace backups

This commit is contained in:
gitea committed 2026-09-23 11:00:40 +08:00
1 parent 22c7674a1a
commit 5ce0dca009
1 file changed
+3 -1
+3 -1
View File
@@ -1,5 +1,6 @@
#!/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
@@ -20,12 +21,13 @@ printf 'source_commit=%s\ncreated_at_utc=%s\n' \
local_target="$HOME/Workspace/ops-backups/seal-use/$snapshot"
mkdir -p "$local_target"
cp -R "$stage/." "$local_target/"
find "$local_target" -type f -name '._*' -delete
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' && tar -xzf - -C '$relative_target'"; then
"mkdir -p '$relative_target' && find '$relative_target' -type f -name '._*' -delete && COPYFILE_DISABLE=1 tar -xzf - -C '$relative_target'"; then
printf 'ok\t%s\t%s\n' "$host" "$relative_target"
return 0
fi