X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=src%2Fshare%2Fmh%2Fdiagnostics;h=8e83cc5ab0a62fb9dc249a7ebf452550671fb122;hb=9307f58b4fdf8e139c4fd5de5c3a878b8b12d0b1;hp=2f65f899f4cfdd7f0e4aad9fe1304ee50bf46ec2;hpb=e13bbc823bc8fe7a28303e45055643e15d0849cd;p=monkeysphere.git diff --git a/src/share/mh/diagnostics b/src/share/mh/diagnostics index 2f65f89..8e83cc5 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 OpenPGP 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?" @@ -63,11 +70,11 @@ else if [ "$expire" ]; then if (( "$expire" < "$curdate" )); then echo "! Host key is expired." - echo " - Recommendation: extend lifetime of key with 'monkeysphere-host extend-key'" + echo " - Recommendation: extend lifetime of key with 'monkeysphere-host set-expire'" problemsfound=$(($problemsfound+1)) elif (( "$expire" < "$warndate" )); then echo "! Host key expires in less than $warnwindow:" $(advance_date $(( $expire - $curdate )) seconds +%F) - echo " - Recommendation: extend lifetime of key with 'monkeysphere-host extend-key'" + echo " - Recommendation: extend lifetime of key with 'monkeysphere-host set-expire'" problemsfound=$(($problemsfound+1)) fi fi @@ -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:"