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
This commit is contained in:
parent
bc219c9b41
commit
36526cd87f
1 changed files with 12 additions and 12 deletions
|
|
@ -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"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue