diff options
-rw-r--r-- | selfpublish.sh | 24 |
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 | ||
435 | indent() | ||
436 | { | ||
437 | sed 's/^/\t/' | ||
438 | } | ||
439 | |||
440 | withsetx() | ||
441 | { | ||
442 | printf "\n\n+ %s\n" "$*" | ||
443 | "$@" | indent | ||
444 | } | ||
445 | |||
435 | KEY_FILE=/etc/ssh/ssh_host_${DEFAULT_AUTH_TYPE}_key | 446 | KEY_FILE=/etc/ssh/ssh_host_${DEFAULT_AUTH_TYPE}_key |
436 | 447 | ||
437 | delegate_command=/usr/lib/cryptonomic/cryptonomic-$1 | 448 | delegate_command=/usr/lib/cryptonomic/cryptonomic-$1 |
438 | 449 | ||
439 | if [ $# = 0 -o "$1" = hostname ] | 450 | if [ $# = 0 ] |
451 | then | ||
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 | |||
459 | elif [ "$1" = hostname ] | ||
440 | then | 460 | then |
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 |
464 | elif [ -x "$delegate_command" ] | 482 | elif [ -x "$delegate_command" ] |
465 | then | 483 | then |