From 4a0697a0e19fcf7b19abbabffb14cba33aee3491 Mon Sep 17 00:00:00 2001 From: Aki Date: Thu, 25 Jan 2024 00:56:34 +0100 Subject: Naive approach that seems to work with mayohiga One of the important flaws is that if one of the intended services will not run, then shutdown may not happen at all. With current mayohiga setup this will not happen but it may break in any other case. --- Makefile | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 Makefile (limited to 'Makefile') diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..9984122 --- /dev/null +++ b/Makefile @@ -0,0 +1,39 @@ +DESTDIR= +PREFIX=/usr/local +LIBEXECDIR=$(PREFIX)/libexec +LIBDIR=$(PREFIX)/lib +SYSDDIR=$(LIBDIR)/systemd/system +DATADIR=$(PREFIX)/share +MANDIR=$(DATADIR)/man +MAN8DIR=$(MANDIR)/man8 + + +%: %.in + sed "s|@LIBEXECDIR@|$(LIBEXECDIR)|g" $< >$@ + sed -i "s|@SYSDDIR@|$(SYSDDIR)|g" $@ + + +all: shutdown-if-no-sessions.service ready-for-shutdown.target.8 + + +install: all + install -m644 -Dt $(DESTDIR)$(SYSDDIR) ready-for-shutdown.target + install -m644 -Dt $(DESTDIR)$(MAN8DIR) ready-for-shutdown.target.8 + install -m644 -Dt $(DESTDIR)$(SYSDDIR) shutdown-if-no-sessions.service + install -m644 -Dt $(DESTDIR)$(MAN8DIR) shutdown-if-no-sessions.service.8 + install -m755 -Dt $(DESTDIR)$(LIBEXECDIR) shutdown-if-no-sessions + + +uninstall: + rm -f $(DESTDIR)$(SYSDDIR)/ready-for-shutdown.target + rm -f $(DESTDIR)$(MAN8DIR)/ready-for-shutdown.target.8 + rm -f $(DESTDIR)$(SYSDDIR)/shutdown-if-no-sessions.service + rm -f $(DESTDIR)$(MAN8DIR)/shutdown-if-no-sessions.service.8 + rm -f $(DESTDIR)$(BINDIR)/shutdown-if-no-sessions + + +clean: + rm -f *.service *.target.8 + + +.PHONY: all install uninstall clean -- cgit v1.1