diff options
author | Jameson Graef Rollins <jrollins@phys.columbia.edu> | 2008-08-07 12:27:53 -0700 |
---|---|---|
committer | Jameson Graef Rollins <jrollins@phys.columbia.edu> | 2008-08-07 12:27:53 -0700 |
commit | 21f5859c43fb539b6b4a852bc1d92aa3fbab26a2 (patch) | |
tree | e4cd6fd3a37546287d4014645b35f75a3131d456 /src/monkeysphere | |
parent | b17336f72c179e4132f318d4ab69a31dfea560de (diff) |
Better key parsing for monkeyspher gen-subkey.
Allow seckey2sshagent to output to file.
Diffstat (limited to 'src/monkeysphere')
-rwxr-xr-x | src/monkeysphere | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/monkeysphere b/src/monkeysphere index cd77193..4a611c8 100755 --- a/src/monkeysphere +++ b/src/monkeysphere @@ -32,7 +32,7 @@ umask 077 ######################################################################## usage() { -cat <<EOF + cat <<EOF usage: $PGRM <subcommand> [options] [args] MonkeySphere client tool. @@ -89,9 +89,17 @@ gen_subkey(){ esac done - keyID="$1" - if [ -z "$keyID" ] ; then - failure "You must specify the key ID of your primary key." + if [ -z "$1" ] ; then + # find all secret keys + keyID=$(gpg --with-colons --list-secret-keys | grep ^sec | cut -f5 -d:) + # if multiple sec keys exist, fail + if (( $(echo "$keyID" | wc -l) > 1 )) ; then + echo "Multiple secret keys found:" + echo "$keyID" + failure "Please specify which primary key to use." + fi + else + keyID="$1" fi # get key output, and fail if not found |