From: Jameson Graef Rollins Date: Mon, 25 Aug 2008 06:57:09 +0000 (-0700) Subject: tweaked the key expiration checking function, and replied to SJJ's bug X-Git-Tag: monkeysphere_0.12-1~64 X-Git-Url: https://codewiz.org/gitweb?p=monkeysphere.git;a=commitdiff_plain;h=050302344aba552900a199d76fab57fd49c05795 tweaked the key expiration checking function, and replied to SJJ's bug comment. --- diff --git a/debian/changelog b/debian/changelog index f3efd57..9a46d9e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +monkeysphere (0.12-1) UNRELEASED; urgency=low + + * Improved output handling. + + -- Jameson Graef Rollins Sun, 24 Aug 2008 23:49:23 -0700 + monkeysphere (0.11-1) experimental; urgency=low [ Jameson Graef Rollins ] diff --git a/src/common b/src/common index 44bdb67..d90730f 100644 --- a/src/common +++ b/src/common @@ -85,9 +85,12 @@ gpg_escape() { # prompt for GPG-formatted expiration, and emit result on stdout get_gpg_expiration() { - local keyExpire= + local keyExpire - cat >&2 <&2 < = key expires in n days @@ -95,13 +98,17 @@ Please specify how long the key should be valid. m = key expires in n months y = key expires in n years EOF - while [ -z "$keyExpire" ] ; do - read -p "Key is valid for? (0) " keyExpire - if ! test_gpg_expire ${keyExpire:=0} ; then - echo "invalid value" >&2 - unset keyExpire - fi - done + while [ -z "$keyExpire" ] ; do + read -p "Key is valid for? (0) " keyExpire + if ! test_gpg_expire ${keyExpire:=0} ; then + echo "invalid value" >&2 + unset keyExpire + fi + done + elif ! test_gpg_expire "$keyExpire" ; then + failure "invalid key expiration value '$keyExpire'." + fi + echo "$keyExpire" } diff --git a/src/monkeysphere b/src/monkeysphere index 8936668..2690db8 100755 --- a/src/monkeysphere +++ b/src/monkeysphere @@ -128,25 +128,7 @@ key before joining the monkeysphere. You can do this with: # set subkey defaults # prompt about key expiration if not specified - if [ -z "$keyExpire" ] ; then - cat < = key expires in n days - w = key expires in n weeks - m = key expires in n months - y = key expires in n years -EOF - while [ -z "$keyExpire" ] ; do - read -p "Key is valid for? (0) " keyExpire - if ! test_gpg_expire ${keyExpire:=0} ; then - echo "invalid value" - unset keyExpire - fi - done - elif ! test_gpg_expire "$keyExpire" ; then - failure "invalid key expiration value '$keyExpire'." - fi + keyExpire=$(get_gpg_expiration "$keyExpire") # generate the list of commands that will be passed to edit-key editCommands=$(cat <