mirror of
https://github.com/webinstall/webi-installers.git
synced 2026-08-18 19:46:59 +00:00
feature: add otsgo installer
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
---
|
||||
title: ots
|
||||
homepage: https://github.com/emdneto/otsgo
|
||||
tagline: |
|
||||
A simple CLI and API client for One-Time Secret
|
||||
---
|
||||
|
||||
To update or switch versions, run `webi ots@stable` (or `@v2`, `@beta`,
|
||||
etc).
|
||||
|
||||
### Files
|
||||
|
||||
These are the files / directories that are created and/or modified with this
|
||||
install:
|
||||
|
||||
```txt
|
||||
~/.config/envman/PATH.env
|
||||
~/.local/bin/ots
|
||||
~/.local/opt/ots
|
||||
```
|
||||
|
||||
## Cheat Sheet
|
||||
|
||||
### Share a generated secret
|
||||
|
||||
```bash
|
||||
ots share -g
|
||||
```
|
||||
|
||||
### Share custom secret with ttl and passphrase
|
||||
|
||||
```bash
|
||||
ots share -s hellosecret -t 300 -p hello
|
||||
```
|
||||
|
||||
### Share secret from file
|
||||
```bash
|
||||
cat <<EOF | ots share -f -
|
||||
secret: hello
|
||||
seret: secret
|
||||
EOF
|
||||
```
|
||||
|
||||
```bash
|
||||
echo "hellosecret" | ots share -f
|
||||
```
|
||||
|
||||
### Burn secrets
|
||||
```bash
|
||||
ots burn METADATA_KEY
|
||||
```
|
||||
|
||||
### Get secret value
|
||||
```bash
|
||||
ots get secret SECRET_KEY
|
||||
```
|
||||
### Get secret metadata
|
||||
```bash
|
||||
ots get meta METADATA_KEY
|
||||
```
|
||||
### Get recent secrets (requires auth)
|
||||
```bash
|
||||
ots get recent
|
||||
```
|
||||
@@ -0,0 +1,54 @@
|
||||
#!/usr/bin/env pwsh
|
||||
|
||||
##################
|
||||
# Install ots #
|
||||
##################
|
||||
|
||||
$pkg_cmd_name = "ots"
|
||||
|
||||
$pkg_dst_cmd = "$Env:USERPROFILE\.local\bin\ots.exe"
|
||||
$pkg_dst = "$pkg_dst_cmd"
|
||||
|
||||
$pkg_src_cmd = "$Env:USERPROFILE\.local\opt\ots-v$Env:WEBI_VERSION\bin\ots.exe"
|
||||
$pkg_src_bin = "$Env:USERPROFILE\.local\opt\ots-v$Env:WEBI_VERSION\bin"
|
||||
$pkg_src_dir = "$Env:USERPROFILE\.local\opt\ots-v$Env:WEBI_VERSION"
|
||||
$pkg_src = "$pkg_src_cmd"
|
||||
|
||||
New-Item "$Env:USERPROFILE\Downloads\webi" -ItemType Directory -Force | out-null
|
||||
$pkg_download = "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"
|
||||
|
||||
# Fetch archive
|
||||
IF (!(Test-Path -Path "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"))
|
||||
{
|
||||
echo "Downloading ots from $Env:WEBI_PKG_URL to $pkg_download"
|
||||
& curl.exe -A "$Env:WEBI_UA" -fsSL "$Env:WEBI_PKG_URL" -o "$pkg_download.part"
|
||||
& move "$pkg_download.part" "$pkg_download"
|
||||
}
|
||||
|
||||
IF (!(Test-Path -Path "$pkg_src_cmd"))
|
||||
{
|
||||
echo "Installing ots"
|
||||
|
||||
pushd .local\tmp
|
||||
|
||||
# Remove any leftover tmp cruft
|
||||
Remove-Item -Path ".\ots-v*" -Recurse -ErrorAction Ignore
|
||||
Remove-Item -Path ".\ots.exe" -Recurse -ErrorAction Ignore
|
||||
|
||||
# Unpack archive file into this temporary directory
|
||||
# Windows BSD-tar handles zip. Imagine that.
|
||||
echo "Unpacking $pkg_download"
|
||||
& tar xf "$pkg_download"
|
||||
|
||||
# Settle unpacked archive into place
|
||||
echo "Install Location: $pkg_src_cmd"
|
||||
New-Item "$pkg_src_bin" -ItemType Directory -Force | out-null
|
||||
Move-Item -Path ".\ots.exe" -Destination "$pkg_src_bin"
|
||||
|
||||
# Exit tmp
|
||||
popd
|
||||
}
|
||||
|
||||
echo "Copying into '$pkg_dst_cmd' from '$pkg_src_cmd'"
|
||||
Remove-Item -Path "$pkg_dst_cmd" -Recurse -ErrorAction Ignore | out-null
|
||||
Copy-Item -Path "$pkg_src" -Destination "$pkg_dst" -Recurse
|
||||
@@ -0,0 +1,36 @@
|
||||
#!/bin/bash
|
||||
|
||||
# shellcheck disable=SC2034
|
||||
# "'pkg_cmd_name' appears unused. Verify it or export it."
|
||||
|
||||
function __init_ots() {
|
||||
set -e
|
||||
set -u
|
||||
|
||||
##################
|
||||
# Install ots #
|
||||
##################
|
||||
|
||||
pkg_cmd_name="ots"
|
||||
|
||||
pkg_dst_cmd="$HOME/.local/bin/ots"
|
||||
pkg_dst="$pkg_dst_cmd"
|
||||
|
||||
pkg_src_cmd="$HOME/.local/opt/ots-v$WEBI_VERSION/bin/ots"
|
||||
pkg_src_dir="$HOME/.local/opt/ots-v$WEBI_VERSION"
|
||||
pkg_src="$pkg_src_cmd"
|
||||
|
||||
pkg_install() {
|
||||
mkdir -p "$(dirname "${pkg_src_cmd}")"
|
||||
mv ots "${pkg_src_cmd}"
|
||||
}
|
||||
|
||||
pkg_get_current_version() {
|
||||
ots --version 2> /dev/null |
|
||||
head -n 1 |
|
||||
cut -d ' ' -f 2
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
__init_ots
|
||||
@@ -0,0 +1,20 @@
|
||||
'use strict';
|
||||
|
||||
var github = require('../_common/github.js');
|
||||
var owner = 'emdneto';
|
||||
var repo = 'otsgo';
|
||||
|
||||
module.exports = function (request) {
|
||||
return github(request, owner, repo).then(function (all) {
|
||||
return all;
|
||||
});
|
||||
};
|
||||
|
||||
if (module === require.main) {
|
||||
module.exports(require('@root/request')).then(function (all) {
|
||||
all = require('../_webi/normalize.js')(all);
|
||||
// just select the first 5 for demonstration
|
||||
all.releases = all.releases.slice(0, 5);
|
||||
console.info(JSON.stringify(all, null, 2));
|
||||
});
|
||||
}
|
||||
@@ -53,6 +53,7 @@ function __rmrf_local() {
|
||||
nerd-font \
|
||||
nerdfont \
|
||||
node \
|
||||
ots \
|
||||
pandoc \
|
||||
pathman \
|
||||
prettier \
|
||||
@@ -144,6 +145,7 @@ function __rmrf_local() {
|
||||
nerd-font \
|
||||
nerdfont \
|
||||
node \
|
||||
ots \
|
||||
pandoc \
|
||||
pathman \
|
||||
prettier \
|
||||
@@ -239,6 +241,7 @@ function __test() {
|
||||
nerd-font \
|
||||
nerdfont \
|
||||
node \
|
||||
ots \
|
||||
pandoc \
|
||||
pathman \
|
||||
postgres \
|
||||
|
||||
Reference in New Issue
Block a user