aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Spragg <adam@spra.gg>2022-03-17 15:32:01 +0000
committerAdam Spragg <adam@spra.gg>2022-03-17 15:32:01 +0000
commit643ac6a4815af8bd2dd06c12d3feed492b64c327 (patch)
tree910a263252e5cb589cdd22e08fe31fa0791a9da3
parent08296ef2b88b340c6c012635a39895d8e68276e0 (diff)
Do not notify systemd if `DESTDIR` differs from `PREFIX`
And document it, along with other installation instructions.
-rw-r--r--README.md21
-rw-r--r--makefile10
2 files changed, 26 insertions, 5 deletions
diff --git a/README.md b/README.md
index 92a6e95..74752e6 100644
--- a/README.md
+++ b/README.md
@@ -10,6 +10,27 @@ then applying those upgrades on reboot via the [systemd Offline Updates][]
functionality.
+## Installation
+
+A simple `make install` will install to `/usr/local` by default.
+
+You can run `make PREFIX=/new/prefix` to modify the scripts to base itself
+somewhere other than `/usr/local`, e.g. `make PREFIX=/usr`. `make install`
+will then install to that location.
+
+If you want to install to a separate location, e.g. if you're building a
+package, you can use `DESTDIR` to accomplish this, e.g.
+`make install DESTDIR=/path/to/packaging`.
+
+Under normal installs, after copying systemd service and timer units into place,
+the installation process will call `systemctl daemon-reload` and enable various
+units. If `DESTDIR` is set and different from `PREFIX`, then these steps are
+omitted.
+
+Similarly, systemd is normally notified on `make uninstall`, but again if
+`DESTDIR` is set and different from `PREFIX`, the steps are omitted again.
+
+
## TODO
### apt-listbugs
diff --git a/makefile b/makefile
index 3704027..a6dcfd6 100644
--- a/makefile
+++ b/makefile
@@ -34,9 +34,9 @@ install:
install -m 644 -t '$(SYSDDIR)' adu-download.timer
install -m 644 -t '$(SYSDDIR)' adu-upgrade.service
ln -sf '$(SYSDDIR)/adu-upgrade.service' '$(SYSDDIR)/system-update.target.wants/adu-upgrade.service'
- systemctl daemon-reload
- #systemctl --now preset adu-download.timer
- systemctl --now enable adu-download.timer
+ [ x'$(DESTDIR)' != x'$(PREFIX)' ] || systemctl daemon-reload
+ #[ x'$(DESTDIR)' != x'$(PREFIX)' ] || systemctl --now preset adu-download.timer
+ [ x'$(DESTDIR)' != x'$(PREFIX)' ] || systemctl --now enable adu-download.timer
.PHONY: uninstall
@@ -44,14 +44,14 @@ uninstall: DESTDIR=$(PREFIX)
uninstall: SBINDIR=$(DESTDIR)/sbin
uninstall: SYSDDIR=$(DESTDIR)/lib/systemd/system
uninstall:
- systemctl --now disable adu-download.timer
+ [ x'$(DESTDIR)' != x'$(PREFIX)' ] || systemctl --now disable adu-download.timer
rm -f '$(SYSDDIR)/system-update.target.wants/adu-upgrade.service'
rm -f '$(SYSDDIR)/adu-upgrade.service'
rm -f '$(SYSDDIR)/adu-download.timer'
rm -f '$(SYSDDIR)/adu-download.service'
rm -f '$(SBINDIR)/adu-upgrade'
rm -f '$(SBINDIR)/adu-download'
- systemctl daemon-reload
+ [ x'$(DESTDIR)' != x'$(PREFIX)' ] || systemctl daemon-reload
.PHONY: clean