From 4b52c1ba76242bc0e80fa15a37729fe248364343 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Sat, 4 Jul 2020 02:48:07 +0000 Subject: [PATCH] install ssh-pubkey BEFORE running it --- ssh-pubkey/install.ps1 | 11 +++++++++++ ssh-pubkey/install.sh | 15 +++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 ssh-pubkey/install.ps1 create mode 100644 ssh-pubkey/install.sh diff --git a/ssh-pubkey/install.ps1 b/ssh-pubkey/install.ps1 new file mode 100644 index 0000000..b238da7 --- /dev/null +++ b/ssh-pubkey/install.ps1 @@ -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 index 0000000..805f789 --- /dev/null +++ b/ssh-pubkey/install.sh @@ -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" +} -- 2.25.1