24 lines
611 B
Bash
Executable File
24 lines
611 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
HOST="chris@nose-pluto.local"
|
|
DEST="~/pluto"
|
|
SOCK="$HOME/.ssh/cm-%r@%h:%p"
|
|
|
|
# 1) Open a master connection (prompts once)
|
|
ssh -MNf -o ControlMaster=yes -o ControlPersist=120 \
|
|
-o ControlPath="$SOCK" "$HOST"
|
|
|
|
# 2) rsync (reuses the connection)
|
|
rsync -az --delete \
|
|
-e "ssh -o ControlPath=$SOCK" \
|
|
--exclude 'node_modules/' \
|
|
--exclude '.git/' \
|
|
./ "$HOST:$DEST/"
|
|
|
|
# 3) remote install (reuses the connection)
|
|
ssh -o ControlPath="$SOCK" "$HOST" "cd $DEST && bun install --frozen-lockfile"
|
|
|
|
# 4) close the master connection
|
|
ssh -O exit -o ControlPath="$SOCK" "$HOST"
|