X-Git-Url: https://git.josue.xyz/?a=blobdiff_plain;f=ssh-pubkey%2Finstall.sh;h=dc71cba32c0d6524255af5fd1013dde9c10c945b;hb=c09256897154fba40911a98e88e559d595c56293;hp=044e1e11667b243cad6bd9f71581346028cd2e4f;hpb=90f0681ea852308f71ded6983f514d7685adc837;p=webi-installers%2F.git diff --git a/ssh-pubkey/install.sh b/ssh-pubkey/install.sh index 044e1e1..dc71cba 100644 --- a/ssh-pubkey/install.sh +++ b/ssh-pubkey/install.sh @@ -1,25 +1,16 @@ #!/bin/bash - set -e set -u -mkdir -p "$HOME/.ssh/" +function __install_ssh_pubkey() { + MY_CMD="ssh-pubkey" -if [ ! -f "$HOME/.ssh/id_rsa" ]; then - ssh-keygen -b 2048 -t rsa -f "$HOME/.ssh/id_rsa" -q -N "" - echo "" -fi + rm -f "$HOME/.local/bin/$MY_CMD" + webi_download "$WEBI_HOST/packages/$MY_CMD/$MY_CMD.sh" "$HOME/.local/bin/$MY_CMD" + chmod a+x "$HOME/.local/bin/$MY_CMD" -if [ ! -f "$HOME/.ssh/id_rsa.pub" ]; then - ssh-keygen -y -f "$HOME/.ssh/id_rsa" > "$HOME/.ssh/id_rsa.pub" - echo "" -fi + # run the command + "$HOME/.local/bin/$MY_CMD" +} -# TODO use the comment (if any) for the name of the file -echo "" -echo "~/Downloads/id_rsa.$(whoami).pub": -echo "" -rm -f "$HOME/Downloads/id_rsa.$(whoami).pub": -cp -r "$HOME/.ssh/id_rsa.pub" "$HOME/Downloads/id_rsa.$(whoami).pub" -cat "$HOME/Downloads/id_rsa.$(whoami).pub" -echo "" +__install_ssh_pubkey