summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJameson Graef Rollins <jrollins@finestructure.net>2009-07-14 22:07:30 -0400
committerJameson Graef Rollins <jrollins@finestructure.net>2009-07-14 22:07:30 -0400
commit8af517bd1dc3eea66a64387af3e69188a536b2ee (patch)
treeca975edb984d0d216ba7b78d4e441a2836b06664
parent1ae8bb73b19d2e378a740d4fd128b395a0865f14 (diff)
improvements monkeysphere-host diagnostics
I made a couple of improvements to the mh diagnostics script, including rearranging some of the test, to try to better handle some of the possible low-level failures that one might run into. Hopefully this will be a little more informative. closes MS #624.
-rwxr-xr-xsrc/monkeysphere-host2
-rw-r--r--src/share/mh/diagnostics25
2 files changed, 17 insertions, 10 deletions
diff --git a/src/monkeysphere-host b/src/monkeysphere-host
index 9dcd331..4ec533d 100755
--- a/src/monkeysphere-host
+++ b/src/monkeysphere-host
@@ -296,8 +296,6 @@ case $COMMAND in
;;
'diagnostics'|'d')
- check_host_no_key
- load_fingerprint
source "${MHSHAREDIR}/diagnostics"
diagnostics
;;
diff --git a/src/share/mh/diagnostics b/src/share/mh/diagnostics
index 3746020..b92d729 100644
--- a/src/share/mh/diagnostics
+++ b/src/share/mh/diagnostics
@@ -27,7 +27,19 @@ local fingerprint
local badhostkeys
local problemsfound=0
-report_cruft
+if ! [ -d "$SYSDATADIR" ] ; then
+ echo "! no $SYSDATADIR directory found. Please create it."
+ exit
+fi
+
+if ! [ -f "$HOST_KEY_FILE" ] ; then
+ echo "No host key gpg pub file found!"
+ echo " - Recommendation: run 'monkeysphere-host import-key'"
+ exit
+fi
+
+# load the host key fingerprint
+load_fingerprint
seckey=$(gpg_host --list-secret-keys --fingerprint --with-colons --fixed-list-mode)
keysfound=$(echo "$seckey" | grep -c ^sec:)
@@ -41,15 +53,10 @@ if ! id monkeysphere >/dev/null ; then
problemsfound=$(($problemsfound+1))
fi
-if ! [ -d "$SYSDATADIR" ] ; then
- echo "! no $SYSDATADIR directory found. Please create it."
- problemsfound=$(($problemsfound+1))
-fi
-
echo "Checking host GPG key..."
if (( "$keysfound" < 1 )); then
- echo "! No host key found."
- echo " - Recommendation: run 'monkeysphere-host import-key'"
+ echo "! No host key found. The monkeysphere-host data directory is corrupt?!?!"
+ echo " - Recommendation: purge the MHDATADIR ($MHDATADIR) and rerun 'monkeysphere-host import-key'"
problemsfound=$(($problemsfound+1))
elif (( "$keysfound" > 1 )); then
echo "! More than one host key found?"
@@ -122,6 +129,8 @@ fi
# directories housing them, etc (what should those values be? can
# we make them as minimal as possible?)
+# report on any cruft from old monkeysphere version
+report_cruft
if [ "$problemsfound" -gt 0 ]; then
echo "When the above $problemsfound issue"$(if [ "$problemsfound" -eq 1 ] ; then echo " is" ; else echo "s are" ; fi)" resolved, please re-run:"