Merge commit 'dkg/master'
[monkeysphere.git] / src / share / m / gen_subkey
index cbefaa3ecbf518e34a44d3c04ab5c3b9f7bf7cf2..d926ad551116e57e6c3e4510b9923af5e7f23618 100644 (file)
@@ -86,12 +86,16 @@ Type '$PGRM help' for usage."
        fi
        # if authentication key is valid, prompt to continue
        if [ "$validity" = 'u' ] ; then
-           echo "A valid authentication key already exists for primary key '$keyID'."
-           read -p "Are you sure you would like to generate another one? (y/N) " OK; OK=${OK:N}
-           if [ "${OK/y/Y}" != 'Y' ] ; then
+           log error "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
+                   failure "aborting."
+               fi
+               break
+           else
                failure "aborting."
            fi
-           break
        fi
     done
 
@@ -114,7 +118,7 @@ EOF
 )
 
     log verbose "generating subkey..."
-    fifoDir=$(mktemp -d ${TMPDIR:-/tmp}/tmp.XXXXXXXXXX)
+    fifoDir=$(msmktempdir)
     (umask 077 && mkfifo "$fifoDir/pass")
     echo "$editCommands" | gpg --passphrase-fd 3 3< "$fifoDir/pass" --expert --command-fd 0 --edit-key "$keyID" &