Skip to content

Commit

Permalink
Make the systemd system directory configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
rhansen committed May 17, 2024
1 parent 02c77af commit e98217e
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -50,14 +52,14 @@ man:
done
install:
@if [ -e /run/systemd/system ]; then \
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 \
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

Expand All @@ -80,15 +82,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 keyd.service src/vkbd/usb-gadget.service
test:
Expand Down

0 comments on commit e98217e

Please sign in to comment.