feat: added installation script and updated docs (#40)
* feat: add install script * update readme.me
This commit is contained in:
parent
01cf5b2991
commit
dccedfa9f4
2 changed files with 81 additions and 1 deletions
14
README.md
14
README.md
|
|
@ -1,3 +1,15 @@
|
|||
## dendrite.daemon
|
||||
|
||||
The core component of [Dendrite](https://kristianjborgwarth.github.io/dendrite.docs/). A Go server that manages the index for a local markdown vault and exposes it over JSON-RPC 2.0.
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
curl -fsSL https://raw.githubusercontent.com/KristianJBorgwarth/dendrite.daemon/master/install.sh | sh
|
||||
```
|
||||
|
||||
Supports Linux and macOS on amd64 and arm64. The script places the binary in `~/.local/bin` on Linux and `/usr/local/bin` on macOS. Re-run to update.
|
||||
|
||||
## Documentation
|
||||
|
||||
See the [Dendrite docs](https://kristianjborgwarth.github.io/dendrite.docs/) for protocol reference and usage.
|
||||
See the [Dendrite docs](https://kristianjborgwarth.github.io/dendrite.docs/) for the full protocol reference, method documentation, and setup guide.
|
||||
|
|
|
|||
68
install.sh
Normal file
68
install.sh
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
REPO="KristianJBorgwarth/dendrite.daemon"
|
||||
BINARY="dendrite"
|
||||
|
||||
# Detect OS
|
||||
OS="$(uname -s)"
|
||||
case "$OS" in
|
||||
Linux) GOOS="linux" ;;
|
||||
Darwin) GOOS="darwin" ;;
|
||||
*)
|
||||
echo "Unsupported OS: $OS"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# Detect architecture
|
||||
ARCHITECTURE="$(uname -m)"
|
||||
case "$ARCHITECTURE" in
|
||||
x86_64) GOARCH="amd64" ;;
|
||||
arm64 | aarch64) GOARCH="arm64" ;;
|
||||
*)
|
||||
echo "Unsupported architecture: $ARCHITECTURE"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# Resolve install dir
|
||||
if [ "$GOOS" = "darwin" ]; then
|
||||
INSTALL_DIR="/usr/local/bin"
|
||||
else
|
||||
INSTALL_DIR="$HOME/.local/bin"
|
||||
mkdir -p "$INSTALL_DIR"
|
||||
fi
|
||||
|
||||
# Fetch latest release tag
|
||||
echo "Fetching latest release..."
|
||||
TAG="$(curl -fsSL "https://api.github.com/repos/$REPO/releases/latest" \
|
||||
| grep '"tag_name"' \
|
||||
| sed 's/.*"tag_name": *"\(.*\)".*/\1/')"
|
||||
|
||||
if [ -z "$TAG" ]; then
|
||||
echo "Could not determine latest release tag."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ASSET="${BINARY}-${GOOS}-${GOARCH}"
|
||||
URL="https://github.com/$REPO/releases/download/$TAG/$ASSET"
|
||||
|
||||
echo "Downloading $ASSET ($TAG)..."
|
||||
curl -fsSL "$URL" -o "$INSTALL_DIR/$BINARY"
|
||||
chmod +x "$INSTALL_DIR/$BINARY"
|
||||
|
||||
echo ""
|
||||
echo "dendrite $TAG installed to $INSTALL_DIR/$BINARY"
|
||||
|
||||
# Warn if install dir is not on PATH
|
||||
case ":$PATH:" in
|
||||
*":$INSTALL_DIR:"*) ;;
|
||||
*)
|
||||
echo ""
|
||||
echo "Warning: $INSTALL_DIR is not on your PATH."
|
||||
echo "Add the following to your shell profile:"
|
||||
echo ""
|
||||
echo " export PATH=\"$INSTALL_DIR:\$PATH\""
|
||||
;;
|
||||
esac
|
||||
Loading…
Add table
Reference in a new issue