FHM28052603SAS - commit remaining changes

This commit is contained in:
sas.fajri
2026-05-28 14:35:21 +07:00
parent 512f649616
commit ee7689654b
10 changed files with 8397 additions and 362 deletions

View File

@@ -20,6 +20,7 @@ tmpdir=$(mktemp -d "${TMPDIR:-/tmp}/devcpone-sync.XXXXXX")
trap 'rm -rf "$tmpdir"' EXIT HUP INT TERM
manifest="$tmpdir/files.list"
verify_list="$tmpdir/files.verify"
if git rev-parse --verify HEAD^ >/dev/null 2>&1; then
git diff -M --name-only -z --diff-filter=ACMR HEAD^ HEAD > "$manifest"
@@ -31,12 +32,20 @@ if [ ! -s "$manifest" ]; then
exit 0
fi
ssh_cmd="ssh"
ssh_args="-o BatchMode=yes"
if [ -f "$ssh_key" ]; then
ssh_cmd="$ssh_cmd -i $ssh_key"
ssh_args="-i $ssh_key $ssh_args"
fi
ssh_cmd="$ssh_cmd -o BatchMode=yes"
ssh $ssh_args "$remote_host" "mkdir -p '$remote_root'" >/dev/null
rsync -a --relative --from0 --files-from="$manifest" -e "ssh $ssh_args" "$repo_root"/ "$remote_host:$remote_root"/
ssh "$remote_host" "mkdir -p '$remote_root'" >/dev/null
rsync -a --relative --from0 --files-from="$manifest" -e "$ssh_cmd" "$repo_root"/ "$remote_host:$remote_root"/
tr '\0' '\n' < "$manifest" > "$verify_list"
while IFS= read -r relpath; do
[ -n "$relpath" ] || continue
ssh $ssh_args "$remote_host" "test -e '$remote_root/$relpath'" || {
printf '%s\n' "devcpone verify failed: missing $remote_root/$relpath" >&2
exit 1
}
done < "$verify_list"