From 1ddecd1ea117a6926caffb36a8f4c7a80f420d60 Mon Sep 17 00:00:00 2001 From: graysky Date: Fri, 18 Dec 2020 21:12:42 -0500 Subject: [PATCH] Add Makefile --- Makefile | 44 ++++++++++++++++++++++++++++++++++++++++++++ README.md | 9 ++++----- 2 files changed, 48 insertions(+), 5 deletions(-) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..b83f0c7 --- /dev/null +++ b/Makefile @@ -0,0 +1,44 @@ +PN = kodi-standalone-service + +PREFIX ?= /usr +INITDIR = $(PREFIX)/lib/systemd/system +USERDIR = $(PREFIX)/lib/sysusers.d +TMPFDIR = $(PREFIX)/lib/tmpfiles.d +POLKDIR = $(PREFIX)/share/polkit-1/rules.d + +RM = rm +INSTALL = install -p +INSTALL_DIR = $(INSTALL) -d +INSTALL_PROGRAM = $(INSTALL) -m755 +INSTALL_DATA = $(INSTALL) -m644 +INSTALL_POLK = $(INSTALL_DIR) -m750 + +common/$(PN): + @echo -e '\033[1;32mNothing to be done.\033[0m' + @echo -e '\033[1;32mJust run make install as root.\033[0m' + +install-common: + $(INSTALL_POLK) "$(DESTDIR)$(POLKDIR)" + $(INSTALL_DATA) polkit/10-kodi.rules "$(DESTDIR)$(POLKDIR)/10-kodi.rules" + +install-init: + $(INSTALL_DIR) "$(DESTDIR)$(INITDIR)" + $(INSTALL_DIR) "$(DESTDIR)$(USERDIR)" + $(INSTALL_DIR) "$(DESTDIR)$(TMPFDIR)" + $(INSTALL_DATA) init/kodi-gbm.service "$(DESTDIR)$(INITDIR)/kodi-gbm.service" + $(INSTALL_DATA) init/kodi-wayland.service "$(DESTDIR)$(INITDIR)/kodi-wayland.service" + $(INSTALL_DATA) init/kodi-x11.service "$(DESTDIR)$(INITDIR)/kodi-x11.service" + $(INSTALL_DATA) init/tmpfiles.conf "$(DESTDIR)$(TMPFDIR)/kodi-standalone.conf" + $(INSTALL_DATA) init/sysusers.conf "$(DESTDIR)$(USERDIR)/kodi-standalone.conf" + +uninstall: + $(RM) "$(DESTDIR)$(INITDIR)/kodi-gbm.service" + $(RM) "$(DESTDIR)$(INITDIR)/kodi-wayland.service" + $(RM) "$(DESTDIR)$(INITDIR)/kodi-x11.service" + $(RM) "$(DESTDIR)$(TMPFDIR)/kodi-standalone.conf" + $(RM) "$(DESTDIR)$(USERDIR)/kodi-standalone.conf" + $(RM) "$(DESTDIR)$(POLKDIR)/10-kodi.rules" + +install: install-common install-init + +.PHONY: install-common install-init uninstall diff --git a/README.md b/README.md index 5afec04..9af9b11 100644 --- a/README.md +++ b/README.md @@ -18,12 +18,11 @@ Users of ARM distros such as Arch ARM, Raspberry Pi OS (formerly Raspbian), etc. For the kodi user to access devices on `/dev/ttyxxxx`, users will need to edit `init/sysusers.conf` and uncomment the line corresponding to enable membership in the dialout group. ### Other distros (manual installation) -Users of other distros should install the following files: +Users of other distros can just run `make install` as the root user. Then, as the root user: -* `init/*.service` to `/usr/lib/systemd/system/` -* `init/sysusers.conf` to `/usr/lib/sysusers.d/`, then run `systemd-sysusers` -* `init/tmpfiles.conf` to `/usr/lib/tmpfiles.d/`, then run `systemd-tmpfiles --create` -* `polkit/10-kodi.rules` to `/usr/share/polkit-1/rules.d/`, then run `udevadm control --reload-rules && udevadm trigger` +* Run `systemd-sysusers` +* Run `systemd-tmpfiles --create` +* Run `udevadm control --reload-rules && udevadm trigger` Note that the kodi user's home directory is `/var/lib/kodi/` in this example, NOT `/home/kodi/` like a regular user.