fix(install): remaining installations

This commit is contained in:
Brydon DeWitt 2026-06-09 20:42:03 -04:00
parent 775f91779c
commit 59148ea57c

View File

@ -341,6 +341,75 @@ else
fi
# ── 11. SSH keys, agent, forwarding & .bashrc (requires --host) ───────────────
if [[ "$INSTALL_HOST" != "true" ]]; then
skip "SSH & .bashrc setup skipped (use --host to install)"
else
# ── 11a. SSH directory & keys ──────────────────────────────────────────
mkdir -p "$HOME/.ssh"
if ! ls "$HOME/.ssh/"* >/dev/null 2>&1; then
warn "No SSH keys found in ~/.ssh — please generate one manually:"
warn " ssh-keygen -t ed25519 -C \"your@email.com\""
warn " ssh-add ~/.ssh/id_ed25519"
else
# Fix permissions on existing keys
for key in "$HOME/.ssh"/*; do
if [[ -f "$key" ]] && [[ ! -d "$key" ]]; then
basename_key="$(basename "$key")"
# Private keys (id_* without .pub/.cer) and config should be 600
if [[ "$basename_key" =~ ^id_ ]] && [[ ! "$basename_key" =~ \.(pub|cer)$ ]]; then
chmod 600 "$key"
log "Fixed SSH key permissions: $key (600)"
elif [[ "$basename_key" == "config" ]]; then
chmod 600 "$key"
log "Fixed SSH config permissions: $key (600)"
elif [[ "$basename_key" =~ \.(pub|cer)$ ]]; then
chmod 644 "$key"
log "Fixed SSH public key permissions: $key (644)"
fi
fi
done
chmod 700 "$HOME/.ssh"
log "SSH directory permissions set (700)"
fi
# ── 11b. SSH agent & forwarding & PATH in .bashrc ─────────────────────
BASHRC="$HOME/.bashrc"
SSH_AGENT_MARKER="# --- install.sh: ssh-agent ---"
if ! grep -qF "$SSH_AGENT_MARKER" "$BASHRC" 2>/dev/null; then
cat >> "$BASHRC" << 'BASHRC_EOF'
# --- install.sh: ssh-agent ---
# Start ssh-agent if not already running
if [ -z "$SSH_AUTH_SOCK" ]; then
eval "$(ssh-agent -s)" >/dev/null 2>&1
fi
# --- install.sh: ssh forwarding ---
# SSH agent forwarding: use 'ssh -A host' to forward agent to remote host.
# To auto-forward on specific hosts, add to ~/.ssh/config:
# Host example.com
# ForwardAgent yes
# --- install.sh: PATH additions ---
# llama-server
export PATH="/opt/llama-server:$PATH"
# WSL lib (for CUDA/cuDNN libraries in WSL environments)
if [ -d "/usr/lib/wsl/lib" ]; then
export LD_LIBRARY_PATH="/usr/lib/wsl/lib:$LD_LIBRARY_PATH"
fi
BASHRC_EOF
log "Added ssh-agent, forwarding notes, and PATH to $BASHRC"
else
skip "ssh-agent snippet already in $BASHRC"
fi
fi
# ── Done ─────────────────────────────────────────────────────────────────────
printf '\n\033[0;32minstall.sh complete.\033[0m\n'
printf 'Next steps:\n'