-SBINDIR = $(DESTDIR)/usr/sbin
-#ETCDIR = $(DESTDIR)/etc/overlay
-#MAN1DIR = $(DESTDIR)/usr/share/man/man1
+ETCDIR = $(DESTDIR)/etc
+INITDIR = $(DESTDIR)/etc/init.d
MAN8DIR = $(DESTDIR)/usr/share/man/man8
+SBINDIR = $(DESTDIR)/usr/sbin
VARLIBDIR = $(DESTDIR)/var/lib/overlay-boot
-#SBINCFILES =
-#SBINFILES = overlay-boot overlay-go overlay-stop
-# The SBINFILES are installed via links; see debian/overlay-boot.links
-#ETCFILES =
-#MAN1FILES =
MAN8FILES = overlay-boot.8 overlay-go.8 overlay-stop.8 overlay-diskfile.8
-#HTMLDOC = $(MAN8FILES:%=%.html)
VARLIBFILES = overlay-boot overlay-go overlay-stop functions reaper
VARLIBFILES += overlay-init overlay-postmount overlay-premount
VARLIBFILES += overlay-diskfile
+INITFILES = subhosts
+ETCFILES = subhosts.conf
# The default is to build asm/reaper
REAPER = src/reaper
reaper: $(REAPER)
mv $< $@
+# Specific rule: the sysvinit init file
+$(INITDIR)/subhosts: subhosts.sh | $(INITDIR)/
+ cp $< $@
+
+# Specific rule: the sysvinit init configuration file
+$(ETCDIR)/subhosts.conf: subhosts.conf | $(ETCDIR)/
+ cp $< $@
+
# Generic rule: any dependee directory needs to be created
%/:
mkdir -p $@
.INTERMEDIATE: reaper $(MAN8FILES)
# Make target: enumerates that which should be installed
-#INSTALLTARGETS = $(addprefix $(SBINDIR)/,$(SBINFILES))
-#INSTALLTARGETS += $(addprefix $(ETCDIR)/,$(ETCFILES))
-#INSTALLTARGETS += $(addprefix $(MAN1DIR)/,$(MAN1FILES))
INSTALLTARGETS += $(addprefix $(MAN8DIR)/,$(MAN8FILES))
INSTALLTARGETS += $(addprefix $(VARLIBDIR)/,$(VARLIBFILES))
+INSTALLTARGETS += $(addprefix $(INITDIR)/,$(INITFILES))
+
install: $(INSTALLTARGETS)
# Make target: make a .deb file in ../
+overlay-boot (0.1.6) unstable; urgency=medium
+
+ * added sysvinit service support
+
+ -- Ralph Ronnquist <ralph.ronnquist@gmail.com> Tue, 10 May 2022 12:38:32 +1000
overlay-boot (0.1.5) unstable; urgency=medium
* with optional cpuset accounting
Package: overlay-boot
Architecture: any
Depends: coreutils (>= 8.32-4+b1), util-linux (>= 2.36.1-8+devuan2),
- mount, iproute2, ifupdown, dash
+ mount, iproute2, ifupdown, dash, procps
Description: Admin scripts for running overlay subhosts
Overlay subhosting uses unshare and chroot for running services within
independent overlay filesystems, with a common kernel but independent
--- /dev/null
+#!/bin/sh
+
+case "$1" in
+ configure)
+ update-rc.d subhosts defaults || true
+ ;;
+ *)
+ :
+ ;;
+esac
--- /dev/null
+# This file is used by subhosts boot facility to start overlay-boot(8)
+# subhosts upon system boot. Lines with '#' and blank lines are
+# ignored. Other lines should be an enumeration of subhosts to start
+# by means of the full pathnames for their overlay-boot configuration
+# files.
--- /dev/null
+#!/usr/bin/env /lib/init/init-d-script
+### BEGIN INIT INFO
+# Provides: subhosts
+# Required-Start: $syslog $time $remote_fs
+# Required-Stop: $syslog $time $remote_fs
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Start subhosts
+# Description: Init script to start subhosts as per /etc/subhosts.conf
+### END INIT INFO
+
+# Note that this facility only acts on start/stop/status, and it does
+# not have any running daemon of its own. The started subhosts will
+# "run" separately.
+
+DAEMON=none
+NAME=subhosts
+
+do_status_override() {
+ pgrep -a overlay-boot | awk '{print $4}'
+}
+
+do_start_override() {
+ if [ -r /etc/subhosts.conf ] ; then
+ for SUB in $(grep -v '#' /etc/subhosts.conf) ; do
+ echo "overlay-boot $SUB" >&2
+ overlay-boot $SUB | logger -p boot.info -s
+ done
+ fi
+}
+
+do_stop_override() {
+ for SUB in $(do_status_override) ; do
+ echo "overlay-stop $SUB" >&2
+ overlay-stop $SUB | logger -p boot.info -s
+ done
+}