X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=src%2Fcommon;h=d90730ff7887f8f753567f73b16ef780ae9181ae;hb=f12a516aa8dce8d1e951f3c47481abe960366f5b;hp=44bdb670f515384646bd6d92a5f11ad6e6b5329a;hpb=3c65d3d8ce819bc94cce81724f0374765e405906;p=monkeysphere.git 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" }