summaryrefslogtreecommitdiff
path: root/selfpublish.sh
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2021-09-28 21:58:38 -0400
committerAndrew Cady <d@jerkface.net>2021-09-28 21:58:38 -0400
commitf4496d76a495d012af7ae55856d2fcfedae4a3ea (patch)
tree6531cf861497542c1adba9223583d2fbca74b8e1 /selfpublish.sh
parentcc7559e9e41bbebc3a58d55ad52707b3cff8d952 (diff)
"cryptonomic" with no arguments gets cooler output
Diffstat (limited to 'selfpublish.sh')
-rw-r--r--selfpublish.sh24
1 files 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()
432 sshfp_b32=$(b16_to_b32 "$sshfp_b16") 432 sshfp_b32=$(b16_to_b32 "$sshfp_b16")
433} 433}
434 434
435indent()
436{
437 sed 's/^/\t/'
438}
439
440withsetx()
441{
442 printf "\n\n+ %s\n" "$*"
443 "$@" | indent
444}
445
435KEY_FILE=/etc/ssh/ssh_host_${DEFAULT_AUTH_TYPE}_key 446KEY_FILE=/etc/ssh/ssh_host_${DEFAULT_AUTH_TYPE}_key
436 447
437delegate_command=/usr/lib/cryptonomic/cryptonomic-$1 448delegate_command=/usr/lib/cryptonomic/cryptonomic-$1
438 449
439if [ $# = 0 -o "$1" = hostname ] 450if [ $# = 0 ]
451then
452 hostname=$(cryptonomic hostname)
453 uid=$(id -un)@${hostname}
454 2>/dev/null withsetx ssh-keyscan "$hostname"
455 2>/dev/null withsetx dig +nocmd -taaaa "$hostname" +noall +answer
456 2>/dev/null withsetx dig +nocmd "$hostname" +noall +answer
457 2>&1 withsetx gpg --locate-keys "$uid"
458
459elif [ "$1" = hostname ]
440then 460then
441
442 get_domain "${KEY_FILE}".pub || exit 461 get_domain "${KEY_FILE}".pub || exit
443 printf '%s\n' "$domain" 462 printf '%s\n' "$domain"
444 463
@@ -459,7 +478,6 @@ then
459 sudo -- "$@" 478 sudo -- "$@"
460 else 479 else
461 su -c "$(bash -c 'printf "%q " "$@"' bash "$@")" 480 su -c "$(bash -c 'printf "%q " "$@"' bash "$@")"
462
463 fi 481 fi
464elif [ -x "$delegate_command" ] 482elif [ -x "$delegate_command" ]
465then 483then