added install script
This commit is contained in:
@@ -6,3 +6,6 @@ edition = "2024"
|
||||
[dependencies]
|
||||
clap = { version = "4.6.7", features = ["derive"] }
|
||||
rand = "0.10.3"
|
||||
|
||||
[profile.release]
|
||||
strip = true
|
||||
@@ -1,6 +1,13 @@
|
||||
# rusty-pw
|
||||
Rusty PW is a rust based generator for simple passwords. The list of words can be found at [./words.txt](./words.txt). This is a list of 200, 5 letters words that are school appropriate.
|
||||
|
||||
## Installation
|
||||
1. Open a terminal and run
|
||||
```bash
|
||||
curl -fsSL https://git.briannelson.dev/brian/rusty-pw/raw/branch/main/install.sh | sh
|
||||
```
|
||||
2. Run `rusty-pw` to generate your first word-number pair
|
||||
|
||||
## Options
|
||||
Here is a list of all the options available. None of these are required and a single word with 4 digits can be generated with `rusty-pw`
|
||||
| Option | Description | Default | Required |
|
||||
|
||||
43
install.sh
Normal file
43
install.sh
Normal file
@@ -0,0 +1,43 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
HOST="https://git.briannelson.dev" # your Gitea URL, no trailing slash
|
||||
REPO="brian/rusty-pw"
|
||||
BIN="rusty-pw"
|
||||
DIR="$HOME/.local/bin"
|
||||
|
||||
# Only Apple Silicon Macs are supported for now. Fail clearly otherwise.
|
||||
if [ "$(uname -s)" != "Darwin" ] || [ "$(uname -m)" != "arm64" ]; then
|
||||
echo "This installer only supports macOS on Apple Silicon." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Ask Gitea for the newest release tag.
|
||||
tag=$(curl -fsSL "$HOST/api/v1/repos/$REPO/releases/latest" \
|
||||
| sed -n 's/.*"tag_name": *"\([^"]*\)".*/\1/p' | head -n 1)
|
||||
|
||||
if [ -z "$tag" ]; then
|
||||
echo "Could not find a release for $REPO" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Download and install. curl downloads aren't quarantined, so no Gatekeeper prompt.
|
||||
mkdir -p "$DIR"
|
||||
echo "Downloading $BIN $tag..."
|
||||
curl -fsSL "$HOST/$REPO/releases/download/$tag/$BIN-macos-arm64" -o "$DIR/$BIN"
|
||||
chmod +x "$DIR/$BIN"
|
||||
|
||||
# Put the install folder on PATH for future terminals (zsh is the macOS default).
|
||||
case ":$PATH:" in
|
||||
*":$DIR:"*) ;;
|
||||
*)
|
||||
rc="$HOME/.zshrc"
|
||||
line='export PATH="$HOME/.local/bin:$PATH"'
|
||||
if ! grep -qsF "$line" "$rc"; then
|
||||
echo "$line" >> "$rc"
|
||||
fi
|
||||
echo "Added $DIR to PATH in $rc. Open a new terminal window to use it."
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "Installed $BIN $tag. Run: $BIN"
|
||||
Reference in New Issue
Block a user