summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormike castleman <m@mlcastle.net>2009-07-11 16:19:31 -0400
committermike castleman <m@mlcastle.net>2009-07-11 16:19:31 -0400
commita2704823c7770bc8df9377116877fcca78c3ea12 (patch)
tree9b018557b71721194835d14c9df0cc66d5dbd8db
parent4d9da8f75a38327d4a9fc1506739221f9fea9c2a (diff)
more replacement of read -p with printf; read (re #446)
-rwxr-xr-xsrc/monkeysphere2
-rw-r--r--src/share/common3
-rw-r--r--src/share/ma/add_certifier4
-rw-r--r--src/share/ma/remove_certifier3
-rw-r--r--src/share/mh/add_hostname5
-rw-r--r--src/share/mh/add_revoker4
-rw-r--r--src/share/mh/publish_key3
-rw-r--r--src/share/mh/revoke_hostname16
-rw-r--r--src/share/mh/revoke_key6
-rw-r--r--src/share/mh/set_expire3
-rw-r--r--tests/common3
11 files changed, 29 insertions, 23 deletions
diff --git a/src/monkeysphere b/src/monkeysphere
index c45a36f..341b9fd 100755
--- a/src/monkeysphere
+++ b/src/monkeysphere
@@ -144,7 +144,7 @@ check_gpg_authentication_subkey() {
if [ "$validity" = 'u' ] ; then
echo "A valid authentication key already exists for primary key '$keyID'." 1>&2
if [ "$PROMPT" = "true" ] ; then
- printf "Are you sure you would like to generate another one? (y/N) "
+ printf "Are you sure you would like to generate another one? (y/N) " >&2
read OK; OK=${OK:N}
if [ "${OK/y/Y}" != 'Y' ] ; then
failure "aborting."
diff --git a/src/share/common b/src/share/common
index bd887d3..c88857e 100644
--- a/src/share/common
+++ b/src/share/common
@@ -291,7 +291,8 @@ Please specify how long the key should be valid.
<n>y = key expires in n years
EOF
while [ -z "$keyExpire" ] ; do
- read -p "Key is valid for? (0) " keyExpire
+ printf "Key is valid for? (0) " >&2
+ read keyExpire
if ! test_gpg_expire ${keyExpire:=0} ; then
echo "invalid value" >&2
unset keyExpire
diff --git a/src/share/ma/add_certifier b/src/share/ma/add_certifier
index 402da08..1601997 100644
--- a/src/share/ma/add_certifier
+++ b/src/share/ma/add_certifier
@@ -136,8 +136,8 @@ EOF
gpg_sphere "--fingerprint 0x${fingerprint}!"
if [ "$PROMPT" = "true" ] ; then
- echo "Are you sure you want to add the above key as a certifier"
- read -p "of users on this system? (Y/n) " OK; OK=${OK:-Y}
+ printf "Are you sure you want to add the above key as a certifier\nof users on this system? (Y/n) " >&2
+ read OK; OK=${OK:-Y}
if [ "${OK/y/Y}" != 'Y' ] ; then
failure "Identity certifier not added."
fi
diff --git a/src/share/ma/remove_certifier b/src/share/ma/remove_certifier
index 6c90358..79f1cda 100644
--- a/src/share/ma/remove_certifier
+++ b/src/share/ma/remove_certifier
@@ -27,7 +27,8 @@ fi
gpg_core --list-key --fingerprint "0x${keyID}!" || failure
if [ "$PROMPT" = "true" ] ; then
- read -p "Really remove the above listed identity certifier? (Y/n) " OK; OK=${OK:-Y}
+ printf "Really remove the above listed identity certifier? (Y/n) " >&2
+ read OK; OK=${OK:-Y}
if [ "${OK/y/Y}" != 'Y' ] ; then
failure "Identity certifier not removed."
fi
diff --git a/src/share/mh/add_hostname b/src/share/mh/add_hostname
index 36f174d..9465d96 100644
--- a/src/share/mh/add_hostname
+++ b/src/share/mh/add_hostname
@@ -32,9 +32,8 @@ find_host_userid > /dev/null && \
failure "Host userID '$userID' already exists."
if [ "$PROMPT" = "true" ] ; then
- read -p "The following user ID will be added to the host key:
- $userID
-Are you sure you would like to add this user ID? (Y/n) " OK; OK=${OK:=Y}
+ printf "The following user ID will be added to the host key:\n %s\nAre you sure you would like to add this user ID? (Y/n) " "$userID" >&2
+ read OK; OK=${OK:=Y}
if [ "${OK/y/Y}" != 'Y' ] ; then
failure "User ID not added."
fi
diff --git a/src/share/mh/add_revoker b/src/share/mh/add_revoker
index 077b0d0..e58995b 100644
--- a/src/share/mh/add_revoker
+++ b/src/share/mh/add_revoker
@@ -90,8 +90,8 @@ EOF
su_monkeysphere_user "GNUPGHOME=$tmpDir gpg --fingerprint 0x${fingerprint}!"
if [ "$PROMPT" = "true" ] ; then
- read -p "Are you sure you want to add the above key as a revoker
-of the host key? (Y/n) " OK; OK=${OK:-Y}
+ printf "Are you sure you want to add the above key as a revoker\nof the host key? (Y/n) " >&2
+ read OK; OK=${OK:-Y}
if [ "${OK/y/Y}" != 'Y' ] ; then
failure "revoker not added."
fi
diff --git a/src/share/mh/publish_key b/src/share/mh/publish_key
index b0ffd93..f6e1c0f 100644
--- a/src/share/mh/publish_key
+++ b/src/share/mh/publish_key
@@ -18,7 +18,8 @@ publish_key() {
local GNUPGHOME
if [ "$PROMPT" = "true" ] ; then
- read -p "Really publish host key to $KEYSERVER? (Y/n) " OK; OK=${OK:=Y}
+ printf "Really publish host key to $KEYSERVER? (Y/n) " >&2
+ read OK; OK=${OK:=Y}
if [ "${OK/y/Y}" != 'Y' ] ; then
failure "key not published."
fi
diff --git a/src/share/mh/revoke_hostname b/src/share/mh/revoke_hostname
index 5dc327f..44ba312 100644
--- a/src/share/mh/revoke_hostname
+++ b/src/share/mh/revoke_hostname
@@ -27,11 +27,12 @@ if [ -z "$1" ] ; then
failure "You must specify a hostname to revoke."
fi
-echo "WARNING: There is a known bug in this function."
-echo "This function has been known to occasionally revoke the wrong hostname."
-echo "Please see the following bug report for more information:"
-echo "https://labs.riseup.net/code/issues/show/422"
-read -p "Are you sure you would like to proceed? (y/N) " OK; OK=${OK:=N}
+echo "WARNING: There is a known bug in this function.
+This function has been known to occasionally revoke the wrong hostname.
+Please see the following bug report for more information:
+https://labs.riseup.net/code/issues/show/422" >&2
+printf "Are you sure you would like to proceed? (y/N) " >&2
+read OK; OK=${OK:=N}
if [ ${OK/y/Y} != 'Y' ] ; then
failure "aborting."
fi
@@ -43,9 +44,8 @@ uidIndex=$(find_host_userid) || \
failure "No non-revoked user ID found matching '$userID'."
if [ "$PROMPT" = "true" ] ; then
- read -p "The following host key user ID will be revoked:
- $userID
-Are you sure you would like to revoke this user ID? (Y/n) " OK; OK=${OK:=Y}
+ printf "The following host key user ID will be revoked:\n %s\nAre you sure you would like to revoke this user ID? (Y/n) " "$userID" >&2
+ read OK; OK=${OK:=Y}
if [ "${OK/y/Y}" != 'Y' ] ; then
failure "User ID not revoked."
fi
diff --git a/src/share/mh/revoke_key b/src/share/mh/revoke_key
index ad68d5f..5460e51 100644
--- a/src/share/mh/revoke_key
+++ b/src/share/mh/revoke_key
@@ -33,7 +33,8 @@ Publishing this certificate will IMMEDIATELY and PERMANENTLY revoke
your host key!
EOF
- read -p "Publish the certificate after generation? (y/n/Q) " publish
+ printf "Publish the certificate after generation? (y/n/Q) " >&2
+ read publish
if ! [ "${publish/y/Y}" = 'Y' -o "${publish/n/N}" = 'N' ] ; then
failure "aborting at user request"
@@ -87,7 +88,8 @@ y
if [ "${publish/y/Y}" = 'Y' ] ; then
printf "\n" >&2
- read -p "Really publish this cert to $KEYSERVER ? (Y/n) " really
+ printf "Really publish this cert to $KEYSERVER ? (Y/n) " >&2
+ read really
if [ "${really/n/N}" = 'N' ] ; then
printf "Not publishing.\n" >&2
else
diff --git a/src/share/mh/set_expire b/src/share/mh/set_expire
index a6bf1f1..9889e76 100644
--- a/src/share/mh/set_expire
+++ b/src/share/mh/set_expire
@@ -22,7 +22,8 @@ local extendTo
extendTo=$(get_gpg_expiration "$1")
if [ "$PROMPT" = "true" ] ; then
- read -p "Are you sure you want to change the expiration on the host key to '$extendTo'? (Y/n) " OK; OK=${OK:-Y}
+ printf "Are you sure you want to change the expiration on the host key to '%s'? (Y/n) " "$extendTo" >&2
+ read OK; OK=${OK:-Y}
if [ "${OK/y/Y}" != 'Y' ] ; then
failure "expiration not set."
fi
diff --git a/tests/common b/tests/common
index 6d732c8..727ad0f 100644
--- a/tests/common
+++ b/tests/common
@@ -4,7 +4,8 @@ failed_cleanup() {
# FIXME: can we be more verbose here?
echo 'FAILED!'
if [ -z "$MONKEYSPHERE_TEST_NO_EXAMINE" ] ; then
- read -p "press enter to cleanup and remove tmp (or type 'bash' for a subshell to examine): " XX
+ printf "press enter to cleanup and remove tmp (or type 'bash' for a subshell to examine): " >&2
+ read XX
if [ "$XX" = bash ] ; then
echo "Entering subshell..."
cd "$TEMPDIR"