summaryrefslogtreecommitdiff
path: root/src/monkeysphere
diff options
context:
space:
mode:
authorJameson Graef Rollins <jrollins@finestructure.net>2009-02-19 15:31:17 -0500
committerJameson Graef Rollins <jrollins@finestructure.net>2009-02-19 15:31:17 -0500
commit0d07156e8db60611c28e5f440ff5f6a39d655ff6 (patch)
tree8d49612143222d018a074bdb3371a0f62bf5af8b /src/monkeysphere
parentbd64869a3b68ff8a020c381371a8ab1e24a5a0e4 (diff)
add a gpg_user function in monkeysphere to add some gpg quieting
option, and use it in all gpg invocations. add a trap to subkey_to_ssh_agent.
Diffstat (limited to 'src/monkeysphere')
-rwxr-xr-xsrc/monkeysphere13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/monkeysphere b/src/monkeysphere
index 4169f2a..cac9a02 100755
--- a/src/monkeysphere
+++ b/src/monkeysphere
@@ -56,6 +56,11 @@ subcommands:
EOF
}
+# user gpg command to define common options
+gpg_user() {
+ gpg --no-greeting --quiet --no-tty "$@"
+}
+
# take a secret key ID and check that only zero or one ID is provided,
# and that it corresponds to only a single secret key ID
check_gpg_sec_key_id() {
@@ -63,10 +68,10 @@ check_gpg_sec_key_id() {
case "$#" in
0)
- gpgSecOut=$(gpg --quiet --fixed-list-mode --list-secret-keys --with-colons 2>/dev/null | egrep '^sec:')
+ gpgSecOut=$(gpg_user --fixed-list-mode --list-secret-keys --with-colons 2>/dev/null | egrep '^sec:')
;;
1)
- gpgSecOut=$(gpg --quiet --fixed-list-mode --list-secret-keys --with-colons "$keyID" | egrep '^sec:') || failure
+ gpgSecOut=$(gpg_user --fixed-list-mode --list-secret-keys --with-colons "$keyID" | egrep '^sec:') || failure
;;
*)
failure "You must specify only a single primary key ID."
@@ -104,7 +109,7 @@ check_gpg_authentication_subkey() {
# check that a valid authentication key does not already exist
IFS=$'\n'
- for line in $(gpg --quiet --fixed-list-mode --list-keys --with-colons "$keyID") ; do
+ for line in $(gpg_user --fixed-list-mode --list-keys --with-colons "$keyID") ; do
type=$(echo "$line" | cut -d: -f1)
validity=$(echo "$line" | cut -d: -f2)
usage=$(echo "$line" | cut -d: -f12)
@@ -119,7 +124,7 @@ check_gpg_authentication_subkey() {
fi
# if authentication key is valid, prompt to continue
if [ "$validity" = 'u' ] ; then
- log error "A valid authentication key already exists for primary key '$keyID'."
+ echo "A valid authentication key already exists for primary key '$keyID'."
if [ "$PROMPT" = "true" ] ; then
read -p "Are you sure you would like to generate another one? (y/N) " OK; OK=${OK:N}
if [ "${OK/y/Y}" != 'Y' ] ; then