From 3b9bb2497e1c809ec3b5f7db40dd32c689e7ac47 Mon Sep 17 00:00:00 2001 From: Adam Spragg Date: Mon, 14 Mar 2022 15:21:50 +0000 Subject: Support setting PREFIX with `make PREFIX=...` "build" step --- adu-download | 3 +-- adu-upgrade | 3 +-- makefile | 15 +++++++++++++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/adu-download b/adu-download index 7d52205..dcc215e 100755 --- a/adu-download +++ b/adu-download @@ -20,8 +20,7 @@ set -e -PREFIX=/usr/local -SBINDIR="${PREFIX}/sbin" +SBINDIR=/usr/local/sbin UPDATE_SYMLINK="/system-update" UPDATE_TARGET="${SBINDIR}/adu-upgrade" diff --git a/adu-upgrade b/adu-upgrade index 6566dee..d12b57f 100755 --- a/adu-upgrade +++ b/adu-upgrade @@ -20,8 +20,7 @@ set -e -PREFIX=/usr/local -SBINDIR="${PREFIX}/sbin" +SBINDIR=/usr/local/sbin UPDATE_SYMLINK="/system-update" UPDATE_TARGET="${SBINDIR}/adu-upgrade" diff --git a/makefile b/makefile index 90ed9c0..6e0ca1a 100644 --- a/makefile +++ b/makefile @@ -3,13 +3,24 @@ PREFIX=/usr/local SBINDIR=$(PREFIX)/sbin SYSDDIR=$(PREFIX)/lib/systemd/system +SED_SHELL:= +SED_SHELL+=s:^SBINDIR=.*:SBINDIR=$(SBINDIR):; + +SED_SYSD:= +SED_SYSD+=s:^ExecStart=.*/\([^/]\+\)$$:ExecStart=$(SBINDIR)/\1:; + + .PHONY: all all: - @echo Build complete + 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: all +install: install -d '$(SBINDIR)' install -m 755 -t '$(SBINDIR)' adu-download install -m 755 -t '$(SBINDIR)' adu-upgrade -- cgit v1.2.1