From 36526cd87fab39981419ff585a94ea26b94688d4 Mon Sep 17 00:00:00 2001 From: Viktor Barzin Date: Tue, 3 Feb 2026 20:52:52 +0000 Subject: [PATCH] Use single SSH connection for dotfiles sync - Combines dotfiles and marketplaces into single archive locally - Pipes through ssh for single-connection transfer and extraction - Cleans up local temp files after sync --- .../bin/executable_sync-dotfiles-remote.sh | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/dot_local/bin/executable_sync-dotfiles-remote.sh b/dot_local/bin/executable_sync-dotfiles-remote.sh index 6098357..f47e3b6 100644 --- a/dot_local/bin/executable_sync-dotfiles-remote.sh +++ b/dot_local/bin/executable_sync-dotfiles-remote.sh @@ -11,19 +11,19 @@ echo "Creating archives..." chezmoi archive --output=/tmp/dotfiles.tar.gz tar -czf /tmp/claude-marketplaces.tar.gz -C ~/.claude/plugins marketplaces -echo "Copying to $REMOTE..." -scp /tmp/dotfiles.tar.gz /tmp/claude-marketplaces.tar.gz "$REMOTE":/tmp/ +# Combine into single archive +echo "Combining archives..." +mkdir -p /tmp/dotfiles-sync +tar -xzf /tmp/dotfiles.tar.gz -C /tmp/dotfiles-sync +mkdir -p /tmp/dotfiles-sync/.claude/plugins +tar -xzf /tmp/claude-marketplaces.tar.gz -C /tmp/dotfiles-sync/.claude/plugins -echo "Extracting and configuring on remote..." -ssh "$REMOTE" " +echo "Syncing to $REMOTE (single connection)..." +tar -czf - -C /tmp/dotfiles-sync . | ssh "$REMOTE" " set -e echo 'Extracting dotfiles...' - cd ~ && tar -xzf /tmp/dotfiles.tar.gz - - echo 'Extracting Claude marketplaces...' - mkdir -p ~/.claude/plugins - tar -xzf /tmp/claude-marketplaces.tar.gz -C ~/.claude/plugins + cd ~ && tar -xzf - echo 'Fixing paths for home directory...' for f in ~/.claude/plugins/installed_plugins.json ~/.claude/plugins/known_marketplaces.json; do @@ -33,10 +33,10 @@ ssh "$REMOTE" " fi done - echo 'Cleaning up...' - rm -f /tmp/dotfiles.tar.gz /tmp/claude-marketplaces.tar.gz - echo 'Done!' " +# Cleanup local temp files +rm -rf /tmp/dotfiles-sync /tmp/dotfiles.tar.gz /tmp/claude-marketplaces.tar.gz + echo "Dotfiles and Claude marketplaces synced to $REMOTE"