2026-02-03 20:31:13 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
# Sync dotfiles to remote machine without chezmoi
|
|
|
|
|
# Usage: ./sync-dotfiles-remote.sh user@host
|
|
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
|
|
REMOTE="${1:?Usage: $0 user@host}"
|
2026-02-03 20:44:28 +00:00
|
|
|
LOCAL_HOME="$HOME"
|
2026-02-03 20:31:13 +00:00
|
|
|
|
2026-02-03 20:47:46 +00:00
|
|
|
echo "Creating archives..."
|
2026-02-03 20:31:13 +00:00
|
|
|
chezmoi archive --output=/tmp/dotfiles.tar.gz
|
2026-02-03 20:39:04 +00:00
|
|
|
tar -czf /tmp/claude-marketplaces.tar.gz -C ~/.claude/plugins marketplaces
|
|
|
|
|
|
2026-02-03 20:52:52 +00:00
|
|
|
# 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 "Syncing to $REMOTE (single connection)..."
|
|
|
|
|
tar -czf - -C /tmp/dotfiles-sync . | ssh "$REMOTE" "
|
2026-02-03 20:47:46 +00:00
|
|
|
set -e
|
2026-02-03 20:31:13 +00:00
|
|
|
|
2026-02-03 20:47:46 +00:00
|
|
|
echo 'Extracting dotfiles...'
|
2026-02-03 20:52:52 +00:00
|
|
|
cd ~ && tar -xzf -
|
2026-02-03 20:47:46 +00:00
|
|
|
|
|
|
|
|
echo 'Fixing paths for home directory...'
|
2026-02-03 20:46:57 +00:00
|
|
|
for f in ~/.claude/plugins/installed_plugins.json ~/.claude/plugins/known_marketplaces.json; do
|
|
|
|
|
if [ -f \"\$f\" ]; then
|
2026-02-03 20:47:46 +00:00
|
|
|
sed -i.bak 's|$LOCAL_HOME|'\$HOME'|g' \"\$f\"
|
2026-02-03 20:46:57 +00:00
|
|
|
rm -f \"\$f.bak\"
|
|
|
|
|
fi
|
|
|
|
|
done
|
2026-02-03 20:47:46 +00:00
|
|
|
|
|
|
|
|
echo 'Done!'
|
2026-02-03 20:46:57 +00:00
|
|
|
"
|
2026-02-03 20:44:28 +00:00
|
|
|
|
2026-02-03 20:52:52 +00:00
|
|
|
# Cleanup local temp files
|
|
|
|
|
rm -rf /tmp/dotfiles-sync /tmp/dotfiles.tar.gz /tmp/claude-marketplaces.tar.gz
|
|
|
|
|
|
2026-02-03 20:47:46 +00:00
|
|
|
echo "Dotfiles and Claude marketplaces synced to $REMOTE"
|