aboutsummaryrefslogtreecommitdiff
path: root/ssh-agent-loadkeys
blob: 608f73b565529da86b3f19a0b7efdd165c293b1d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash
#
# Load keys into the ssh-agent
# Uses monkeysphere and keychain
#

if [ -x '/usr/bin/monkeysphere' ]; then
  if ! ssh-add -l &> /dev/null; then
    monkeysphere subkey-to-ssh-agent
  fi
fi

if [ -x '/usr/bin/keychain' ]; then
  mkdir -p $HOME/.keychain

  if [ -e "$HOME/.ssh/id_rsa" ]; then
    /usr/bin/keychain -q $HOME/.ssh/id_rsa
  fi

  if [ -e "$HOME/.ssh/id_ed25519" ]; then
    /usr/bin/keychain -q $HOME/.ssh/id_ed25519
  fi

  if [ -e "$HOME/.keychain/$HOSTNAME-sh" ]; then
    . $HOME/.keychain/$HOSTNAME-sh
  fi

  if [ -e "$HOME/.keychain/$HOSTNAME-sh-gpg" ]; then
    . $HOME/.keychain/$HOSTNAME-sh-gpg
  fi
fi