aboutsummaryrefslogtreecommitdiff
path: root/ssh-agent-loadkeys
blob: 5687ef6a151d418f53882374010ae792f5c05f49 (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
#!/bin/bash
#
# Load keys into the ssh-agent
# Uses monkeysphere and keychain
#

if ! ssh-add -l &> /dev/null; then
  monkeysphere subkey-to-ssh-agent
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