From f4496d76a495d012af7ae55856d2fcfedae4a3ea Mon Sep 17 00:00:00 2001 From: Andrew Cady Date: Tue, 28 Sep 2021 21:58:38 -0400 Subject: "cryptonomic" with no arguments gets cooler output --- selfpublish.sh | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/selfpublish.sh b/selfpublish.sh index fa366a8..9bb3b20 100644 --- a/selfpublish.sh +++ b/selfpublish.sh @@ -432,13 +432,32 @@ get_sshfp() sshfp_b32=$(b16_to_b32 "$sshfp_b16") } +indent() +{ + sed 's/^/\t/' +} + +withsetx() +{ + printf "\n\n+ %s\n" "$*" + "$@" | indent +} + KEY_FILE=/etc/ssh/ssh_host_${DEFAULT_AUTH_TYPE}_key delegate_command=/usr/lib/cryptonomic/cryptonomic-$1 -if [ $# = 0 -o "$1" = hostname ] +if [ $# = 0 ] +then + hostname=$(cryptonomic hostname) + uid=$(id -un)@${hostname} + 2>/dev/null withsetx ssh-keyscan "$hostname" + 2>/dev/null withsetx dig +nocmd -taaaa "$hostname" +noall +answer + 2>/dev/null withsetx dig +nocmd "$hostname" +noall +answer + 2>&1 withsetx gpg --locate-keys "$uid" + +elif [ "$1" = hostname ] then - get_domain "${KEY_FILE}".pub || exit printf '%s\n' "$domain" @@ -459,7 +478,6 @@ then sudo -- "$@" else su -c "$(bash -c 'printf "%q " "$@"' bash "$@")" - fi elif [ -x "$delegate_command" ] then -- cgit v1.2.3