Commit 5f44876bb7cd
Changed files (1)
alpine
alpine/deploy.sh
@@ -10,6 +10,14 @@ DOMAIN="${DEPLOY_DOMAIN:-.vpn}"
TARGET="root@${HOST}${DOMAIN}"
IMAGE_DIR="$SCRIPT_DIR/images/$HOST"
+# SSH identity (hardware key). Override with DEPLOY_SSH_KEY. A shared
+# connection avoids one security-key touch per ssh/rsync invocation.
+SSH_KEY="${DEPLOY_SSH_KEY:-$HOME/.ssh/id_homelab_sk}"
+SSH_OPTS=(-i "$SSH_KEY" -o IdentitiesOnly=yes
+ -o ControlMaster=auto -o "ControlPath=/tmp/deploy-%C" -o ControlPersist=120)
+ssh() { command ssh "${SSH_OPTS[@]}" "$@"; }
+rsync() { command rsync -e "ssh ${SSH_OPTS[*]}" "$@"; }
+
if [ ! -d "$IMAGE_DIR" ]; then
echo "Error: no image found for $HOST. Run build.sh first."
exit 1