From 5e343edf4f458df3f2d249b1691efade661b0d70 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Tue, 27 Feb 2024 23:41:40 -0800 Subject: [PATCH] Make the systemd system directory configurable --- Makefile | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 8c315ca..0e98a6b 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,8 @@ PREFIX?=/usr/local CONFIG_DIR?=/etc/keyd SOCKET_PATH=/var/run/keyd.socket +SYSTEMD_SYSTEM_DIR = $(PREFIX)/lib/systemd/system + CFLAGS:=-DVERSION=\"v$(VERSION)\ \($(COMMIT)\)\" \ -I/usr/local/include \ -L/usr/local/lib \ @@ -50,15 +52,15 @@ install: @if [ -e /run/systemd/system ]; then \ sed -e 's#@PREFIX@#$(PREFIX)#' keyd.service.in > keyd.service; \ - mkdir -p $(DESTDIR)$(PREFIX)/lib/systemd/system/; \ - install -Dm644 keyd.service $(DESTDIR)$(PREFIX)/lib/systemd/system/keyd.service; \ + mkdir -p '$(DESTDIR)$(SYSTEMD_SYSTEM_DIR)'; \ + install -Dm644 keyd.service '$(DESTDIR)$(SYSTEMD_SYSTEM_DIR)/keyd.service'; \ else \ echo "NOTE: systemd not found, you will need to manually add keyd to your system's init process."; \ fi @if [ "$(VKBD)" = "usb-gadget" ]; then \ sed -e 's#@PREFIX@#$(PREFIX)#' src/vkbd/usb-gadget.service.in > src/vkbd/usb-gadget.service; \ - install -Dm644 src/vkbd/usb-gadget.service $(DESTDIR)$(PREFIX)/lib/systemd/system/keyd-usb-gadget.service; \ + install -Dm644 src/vkbd/usb-gadget.service '$(DESTDIR)$(SYSTEMD_SYSTEM_DIR)/keyd-usb-gadget.service'; \ install -Dm755 src/vkbd/usb-gadget.sh $(DESTDIR)$(PREFIX)/bin/keyd-usb-gadget.sh; \ fi @@ -81,15 +83,14 @@ install: uninstall: -groupdel keyd - rm -rf $(DESTDIR)$(PREFIX)/lib/systemd/system/keyd.service \ - $(DESTDIR)$(PREFIX)/bin/keyd \ + rm -rf $(DESTDIR)$(PREFIX)/bin/keyd \ $(DESTDIR)$(PREFIX)/bin/keyd-application-mapper \ $(DESTDIR)$(PREFIX)/share/doc/keyd/ \ $(DESTDIR)$(PREFIX)/share/man/man1/keyd*.gz \ $(DESTDIR)$(PREFIX)/share/keyd/ \ - $(DESTDIR)$(PREFIX)/lib/systemd/system/keyd-usb-gadget.service \ + '$(DESTDIR)$(SYSTEMD_SYSTEM_DIR)/keyd-usb-gadget.service' \ $(DESTDIR)$(PREFIX)/bin/keyd-usb-gadget.sh \ - $(DESTDIR)$(PREFIX)/lib/systemd/system/keyd.service + '$(DESTDIR)$(SYSTEMD_SYSTEM_DIR)/keyd.service' clean: rm -rf bin data/*.1.gz data/keyd.compose keyd.service src/unicode.c src/vkbd/usb-gadget.service test: