]> gitweb.fluxo.info Git - utils-ssh.git/commitdiff
Adds ssh-pubkey
authorSilvio Rhatto <rhatto@riseup.net>
Sat, 9 Mar 2019 18:39:08 +0000 (15:39 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Sat, 9 Mar 2019 18:39:08 +0000 (15:39 -0300)
ssh-pubkey [new file with mode: 0755]

diff --git a/ssh-pubkey b/ssh-pubkey
new file mode 100755 (executable)
index 0000000..dadb1c3
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/bash
+#
+# Load a key into the ssh-agent
+#
+
+# Parameters
+BASENAME="`basename $0`"
+TYPE="$1"
+HANDLE="$2"
+
+# Check
+if [ -z "$HANDLE" ]; then
+  echo "usage: $BASENAME <keytype> <handle>"
+  echo "available keys:"
+  echo ""
+  ( cd $HOME/.ssh/keys && find -name '*.pub' ) | grep -v decomissioned | sed -e 's/^/\t/'
+  exit 1
+elif [ ! -e "$HOME/.ssh/keys/$TYPE/$HANDLE" ]; then
+  echo "$BASENAME: file not found: $HOME/.ssh/keys/$TYPE/$HANDLE"
+  exit 1
+fi
+
+# Dispatch
+cat $HOME/.ssh/keys/$TYPE/$HANDLE.pub