Add systemd service unit.
authorPhilipp Kern <pkern@debian.org>
Sun, 8 Sep 2013 21:10:56 +0000 (23:10 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 8 Sep 2013 21:14:59 +0000 (23:14 +0200)
Makefile
cubemap.service.in [new file with mode: 0644]

index eef4a38..103c6a4 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -35,7 +35,8 @@ install:
                $(DESTDIR)$(SYSCONFDIR) \
                $(DESTDIR)$(LOCALSTATEDIR)/lib/cubemap \
                $(DESTDIR)$(LOCALSTATEDIR)/log/cubemap \
-               $(DESTDIR)$(PREFIX)/share/munin/plugins
+               $(DESTDIR)$(PREFIX)/share/munin/plugins \
+               $(DESTDIR)$(PREFIX)/lib/systemd/system
        $(INSTALL) -m 755 -o root -g root cubemap $(DESTDIR)$(PREFIX)/bin/cubemap
        $(INSTALL) -m 755 -o root -g root munin/cubemap munin/cubemap_input $(DESTDIR)$(PREFIX)/share/munin/plugins/
        sed \
@@ -47,6 +48,10 @@ install:
                -e 's,^udpstream,#\0,g' \
                cubemap.config.sample > $(DESTDIR)$(SYSCONFDIR)/cubemap.config
        gzip -c cubemap.1 > $(DESTDIR)$(PREFIX)/share/man/man1/cubemap.1.gz
+       sed \
+               -e "s,@prefix@,$(PREFIX),g" \
+               -e "s,@sysconfdir@,$(SYSCONFDIR),g" \
+               cubemap.service.in > $(DESTDIR)$(PREFIX)/lib/systemd/system/cubemap.service
 
 .PHONY: clean install
 .SUFFIXES:
diff --git a/cubemap.service.in b/cubemap.service.in
new file mode 100644 (file)
index 0000000..27b46de
--- /dev/null
@@ -0,0 +1,11 @@
+[Unit]
+Description=Cubemap Stream Relay
+
+[Service]
+Type=simple
+ExecStart=@prefix@/bin/cubemap @sysconfdir@/cubemap.config
+User=cubemap
+ExecReload=/bin/kill -HUP $MAINPID
+
+[Install]
+WantedBy=multi-user.target