install ssh-pubkey BEFORE running it
authorAJ ONeal <aj@therootcompany.com>
Sat, 4 Jul 2020 02:48:07 +0000 (02:48 +0000)
committerAJ ONeal <aj@therootcompany.com>
Sat, 4 Jul 2020 02:48:07 +0000 (02:48 +0000)
ssh-pubkey/install.ps1 [new file with mode: 0644]
ssh-pubkey/install.sh [new file with mode: 0644]

diff --git a/ssh-pubkey/install.ps1 b/ssh-pubkey/install.ps1
new file mode 100644 (file)
index 0000000..b238da7
--- /dev/null
@@ -0,0 +1,11 @@
+#!/usr/bin/env pwsh
+
+$MY_CMD = "ssh-pubkey"
+
+& curl.exe -A "$Env:WEBI_UA" -fsSL "$Env:WEBI_HOST/packages/$MY_CMD/$MY_CMD.ps1" -o "$Env:USERPROFILE\.local\bin\$MY_CMD.ps1.part"
+Remove-Item -Path "$Env:USERPROFILE\.local\bin\$MY_CMD.ps1" -Recurse -ErrorAction Ignore
+& move "$Env:USERPROFILE\.local\bin\$MY_CMD.ps1.part" "$Env:USERPROFILE\.local\bin\$MY_CMD.ps1"
+Set-Content -Path "$Env:USERPROFILE\.local\bin\$MY_CMD.bat" -Value "@echo off`r`npushd %USERPROFILE%`r`npowershell -ExecutionPolicy Bypass .local\bin\$MY_CMD.ps1 %1`r`npopd"
+
+# run the command
+& "$Env:USERPROFILE\.local\bin\$MY_CMD.bat"
diff --git a/ssh-pubkey/install.sh b/ssh-pubkey/install.sh
new file mode 100644 (file)
index 0000000..805f789
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+{
+    set -e
+    set -u
+
+    MY_CMD="ssh-pubkey"
+
+    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"
+
+    # run the command
+    "$HOME/.local/bin/$MY_CMD"
+}