diff --git a/documentation/docs/install/freebsd.md b/documentation/docs/install/freebsd.md index de3fc08..1f374e5 100644 --- a/documentation/docs/install/freebsd.md +++ b/documentation/docs/install/freebsd.md @@ -17,19 +17,56 @@ If you don't have them, follow these instructions for installing ## Installation -Install compiled binary from ports run: +The official FreeBSD ports package is no longer published, so `pkg install net/unpoller` +will not find a package. Install the pre-built archive from +[GitHub Releases](https://github.com/unpoller/unpoller/releases) instead. + +Pick the archive that matches `uname -m`: + +| Architecture | Asset name | +|---|---| +| amd64 | `unpoller__freebsd_amd64.tar.xz` | +| arm64 | `unpoller__freebsd_arm64.tar.xz` | +| armv7 | `unpoller__freebsd_armv7.tar.xz` | + +Run the following as root. Replace `VERSION` with the latest tag from GitHub Releases +(for example `5.2.4`) and set `ARCH` to `amd64`, `arm64`, or `armv7`. ```shell -pkg install net/unpoller +# Create the service account once. +id unpoller >/dev/null 2>&1 || pw useradd unpoller -d /tmp -w no -s /bin/false + +VERSION=5.2.4 +ARCH=amd64 +fetch -o /tmp/unpoller.tar.xz \ + https://github.com/unpoller/unpoller/releases/download/v${VERSION}/unpoller_${VERSION}_freebsd_${ARCH}.tar.xz + +# Installs the binary, rc.d script, man page, docs, and example configs into /usr/local. +tar -xJf /tmp/unpoller.tar.xz -C / + +# Keep an existing config on upgrades. +[ -f /usr/local/etc/unpoller/up.conf ] || \ + cp /usr/local/etc/unpoller/up.conf.example /usr/local/etc/unpoller/up.conf ``` -## Compile +Re-extracting a newer archive upgrades the binary and supporting files. It does not ship +`up.conf`, so your edited config is left in place. + +## Build from source -To build and install from ports run: +To build the binary yourself instead of using a release archive: ```shell -cd /usr/ports/net-mgmt/unpoller -make install clean +pkg install git go +git clone https://github.com/unpoller/unpoller.git +cd unpoller +go build -o /usr/local/bin/unpoller . +install -m 755 init/bsd/unpoller /usr/local/etc/rc.d/unpoller +mkdir -p /usr/local/etc/unpoller +cp examples/up.conf.example /usr/local/etc/unpoller/up.conf.example +[ -f /usr/local/etc/unpoller/up.conf ] || \ + cp examples/up.conf.example /usr/local/etc/unpoller/up.conf +id unpoller >/dev/null 2>&1 || pw useradd unpoller -d /tmp -w no -s /bin/false ``` ## Maintenance @@ -50,8 +87,8 @@ Use these commands to maintain the service: man unpoller # Edit config file. -# A default configuration file is placed in /usr/local/etc/unpoller/up.conf which is not overwritten on upgrades -# A sample configuration is placed in /usr/local/etc/unpoller/up.conf.sample +# A live config lives at /usr/local/etc/unpoller/up.conf and is not overwritten on upgrades. +# The example shipped with the archive is /usr/local/etc/unpoller/up.conf.example vi /usr/local/etc/unpoller/up.conf # enable the service. Or edit /etc/rc.conf