added service file
authorRalph Ronnquist <rrq@rrq.au>
Tue, 3 Dec 2024 13:44:42 +0000 (00:44 +1100)
committerRalph Ronnquist <rrq@rrq.au>
Tue, 3 Dec 2024 13:44:42 +0000 (00:44 +1100)
Makefile
subhost@.service [new file with mode: 0644]

index 022b9ffa1960970da20d3668c6a5c975b533e5a4..dba6dcf3b52ee25e69d936cc5fd4e0f3cb4f3acb 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,6 @@
 ETCDIR = $(DESTDIR)/etc
 INITDIR = $(DESTDIR)/etc/init.d
+SRVDIR =  $(DESTDIR)/usr/lib/systemd/system
 MAN8DIR = $(DESTDIR)/usr/share/man/man8
 SBINDIR = $(DESTDIR)/usr/sbin
 VARLIBDIR = $(DESTDIR)/var/lib/overlay-boot
@@ -12,6 +13,7 @@ VARLIBFILES += overlay-diskfile
 VARLIBFILES += overlay-share
 INITFILES = subhosts
 ETCFILES = subhosts.conf
+SRVFILES = subhost@.service
 
 # The default is to build asm/reaper
 REAPER = src/reaper
@@ -51,6 +53,10 @@ $(addprefix $(MAN8DIR)/,$(MAN8FILES)): $(MAN8DIR)/%: % | $(MAN8DIR)/
 $(addprefix $(VARLIBDIR)/,$(VARLIBFILES)): $(VARLIBDIR)/%: % | $(VARLIBDIR)/
        cp -p $< $@
 
+# Generic rule: copy service files
+$(addprefix $(SRVDIR)/,$(SRVFILES)): $(SRVDIR)/%: % | $(SRVDIR)/
+       cp $< $@
+
 # Make target: to clean up this workspace
 clean:
        rm -f reaper *.8
@@ -62,6 +68,7 @@ clean:
 INSTALLTARGETS += $(addprefix $(MAN8DIR)/,$(MAN8FILES))
 INSTALLTARGETS += $(addprefix $(VARLIBDIR)/,$(VARLIBFILES))
 INSTALLTARGETS += $(addprefix $(INITDIR)/,$(INITFILES))
+INSTALLTARGETS += $(addprefix $(SRVDIR)/,$(SRVFILES))
 INSTALLTARGETS += $(addprefix $(ETCDIR)/,$(ETCFILES))
 
 install: $(INSTALLTARGETS)
diff --git a/subhost@.service b/subhost@.service
new file mode 100644 (file)
index 0000000..c15b974
--- /dev/null
@@ -0,0 +1,10 @@
+[Unit]
+Description=Start overlay-boot subhost instance %i
+Documentation=man:overlay-boot(8)
+
+[Service]
+ExecStart=/usr/sbin/overlay-boot %i
+ExecStop=/usr/sbin/overlay-stop %i
+
+[Install]
+WantedBy=multi-user.target