chore(style): add shebang, set bash strict mode, create function
[webi-installers/.git] / ssh-pubkey / install.sh
index 805f789822bfa96bbb17efdce038874746edce1d..6f2ef5e11bad41c9497ae2183da7df13ba1c077e 100644 (file)
@@ -1,15 +1,20 @@
 #!/bin/bash
+set -e
+set -u
 
-{
-    set -e
-    set -u
+function __install_ssh_pubkey() {
+    my_cmd="ssh-pubkey"
 
-    MY_CMD="ssh-pubkey"
+    rm -f "$HOME/.local/bin/${my_cmd}"
 
-    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"
+    webi_download \
+        "$WEBI_HOST/packages/${my_cmd}/${my_cmd}.sh" \
+        "$HOME/.local/bin/${my_cmd}"
+
+    chmod a+x "$HOME/.local/bin/${my_cmd}"
 
     # run the command
-    "$HOME/.local/bin/$MY_CMD"
+    "$HOME/.local/bin/${my_cmd}"
 }
+
+__install_ssh_pubkey