PREFIX=/usr/local include prefix.mk SBINDIR=$(PREFIX)/sbin SED_SHELL:= SED_SHELL+=s:^SBINDIR=.*:SBINDIR=$(SBINDIR):; SED_SYSD:= SED_SYSD+=s:^ExecStart=.*/\([^/]\+\)$$:ExecStart=$(SBINDIR)/\1:; .PHONY: all all: prefix.mk sed -i -e '$(SED_SHELL)' adu-download sed -i -e '$(SED_SHELL)' adu-upgrade sed -i -e '$(SED_SYSD)' adu-download.service sed -i -e '$(SED_SYSD)' adu-download.timer sed -i -e '$(SED_SYSD)' adu-upgrade.service .PHONY: install install: DESTDIR=$(PREFIX) install: SBINDIR=$(DESTDIR)/sbin install: SYSDDIR=$(DESTDIR)/lib/systemd/system install: install -d '$(SBINDIR)' install -m 755 -t '$(SBINDIR)' adu-download install -m 755 -t '$(SBINDIR)' adu-upgrade install -d '$(SYSDDIR)' install -d '$(SYSDDIR)/system-update.target.wants' install -m 644 -t '$(SYSDDIR)' adu-download.service 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 .PHONY: uninstall uninstall: DESTDIR=$(PREFIX) uninstall: SBINDIR=$(DESTDIR)/sbin uninstall: SYSDDIR=$(DESTDIR)/lib/systemd/system uninstall: 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 .PHONY: prefix.mk prefix.mk: @echo 'PREFIX=$(PREFIX)' >$@