aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md1
-rw-r--r--README.md3
-rwxr-xr-xinstall14
3 files changed, 17 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b7745a6..28fc616 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -16,6 +16,7 @@ SPDX-License-Identifier: CC-BY-SA-4.0
* Ability to specify program paths or arguments which contain non-UTF8 sequences
by using `{ b64 = "BaSe64==" }` in place of a string in the config.
+* The simple `./install` script.
## [0.3.0] - 2025-07-10
diff --git a/README.md b/README.md
index 910fe66..03ef930 100644
--- a/README.md
+++ b/README.md
@@ -22,7 +22,8 @@ The `SYSCONFDIR` environment variable controls the location of where `mqttr.toml
Once built, the `mqttr` program (found in `target/{debug,release}/mqttr`) should
be located in some sensible place (e.g. `/usr/local/bin/mqttr`) and configured
-as a system service.
+as a system service. You can use the `./install` script to install it in a
+sensible place. Read this short script to see how it can be further configured.
`mqttr` does not have a way to double-fork, if you need this behaviour, use
`daemon` or some equivalent utility.
diff --git a/install b/install
new file mode 100755
index 0000000..aa3c632
--- /dev/null
+++ b/install
@@ -0,0 +1,14 @@
+#!/bin/sh
+# SPDX-FileCopyrightText: 2025 Tomasz Kramkowski <tomasz@kramkow.ski>
+# SPDX-License-Identifier: CC0-1.0
+
+# Usage: [DESTDIR=...] [prefix=...] [sbindir=...] [target=...] ./install [options]
+# (contrived) e.g. DESTDIR=/tmp/mqttr target=debug ./install -s
+
+# The variable casing/naming is a silly historical makefile convention.
+
+# Defaults:
+: "${DESTDIR=}" "${prefix=/usr/local}" "${sbindir=$prefix/sbin}" "${target=release}"
+
+set -u
+exec install -Dm755 "$@" -t "${DESTDIR}${sbindir}" "target/${target}/mqttr"