#!/bin/bash
-set -e
-set -u
+{
+ set -e
+ set -u
-mkdir -p "$HOME/.ssh/"
+ 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
-
-# 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 ""
+ # run the command
+ "$HOME/.local/bin/$MY_CMD"
+}