From: Vadim Kochan <vadim4j@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [RFC 3/3] package/s6-rc: Allow to integrate s6-rc services
Date: Wed, 16 Jan 2019 23:51:35 +0200 [thread overview]
Message-ID: <20190116215135.32142-4-vadim4j@gmail.com> (raw)
In-Reply-To: <20190116215135.32142-1-vadim4j@gmail.com>
It allows to install s6-rc services by board or package into
/etc/s6-rc/service which will be compiled as s6-rc db as
/etc/s6-rc/compiled-initial. Services are compiled on stage
when rootfs overlay & post-build already performed.
Added rc.init & rc.shutdown scripts which are needed to run s6-rc
services.
This is very basic s6-rc system support which even does not have the
basic stuff like /proc /sys /dev setup, but this might be added in
future work.
All above is only possible if BR2_INIT_S6 is selected.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
---
package/s6-rc/rc.init | 4 ++++
package/s6-rc/rc.shutdown | 3 +++
package/s6-rc/s6-rc.mk | 32 ++++++++++++++++++++++++++++++++
3 files changed, 39 insertions(+)
create mode 100644 package/s6-rc/rc.init
create mode 100644 package/s6-rc/rc.shutdown
diff --git a/package/s6-rc/rc.init b/package/s6-rc/rc.init
new file mode 100644
index 0000000000..6709c6488b
--- /dev/null
+++ b/package/s6-rc/rc.init
@@ -0,0 +1,4 @@
+#! /usr/bin/execlineb -P
+
+if { s6-rc-init /run/service }
+if { s6-rc -t 600000 -- change default }
diff --git a/package/s6-rc/rc.shutdown b/package/s6-rc/rc.shutdown
new file mode 100644
index 0000000000..58d49b5cfd
--- /dev/null
+++ b/package/s6-rc/rc.shutdown
@@ -0,0 +1,3 @@
+#! /usr/bin/execlineb -P
+
+s6-rc -da change
diff --git a/package/s6-rc/s6-rc.mk b/package/s6-rc/s6-rc.mk
index 222ba139c6..007e7d9e1b 100644
--- a/package/s6-rc/s6-rc.mk
+++ b/package/s6-rc/s6-rc.mk
@@ -11,6 +11,13 @@ S6_RC_LICENSE_FILES = COPYING
S6_RC_INSTALL_STAGING = YES
S6_RC_DEPENDENCIES = s6
+ifeq ($(BR2_INIT_S6),y)
+# Needs s6-rc-compile to create initial rc db, also
+# build after s6-linux-init to rewrite rc.init for run
+# s6-rc services.
+S6_RC_DEPENDENCIES += host-s6-rc s6-linux-init
+endif
+
S6_RC_CONF_OPTS = \
--prefix=/usr \
--with-sysdeps=$(STAGING_DIR)/usr/lib/skalibs/sysdeps \
@@ -44,6 +51,31 @@ define S6_RC_INSTALL_STAGING_CMDS
$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) DESTDIR=$(STAGING_DIR) install
endef
+ifeq ($(BR2_INIT_S6),y)
+
+define S6_RC_PREPARE_INIT_RC
+ mkdir -p $(TARGET_DIR)/etc/s6-rc/service/default
+ echo bundle > $(TARGET_DIR)/etc/s6-rc/service/default/type
+ touch $(TARGET_DIR)/etc/s6-rc/service/default/contents
+
+ mkdir -p $(TARGET_DIR)/etc/s6-rc/compiled-initial
+ ln -sf compiled-initial $(TARGET_DIR)/etc/s6-rc/compiled
+
+ $(INSTALL) -m 0755 $(S6_RC_PKGDIR)/rc.init $(TARGET_DIR)/etc/rc.init
+ $(INSTALL) -m 0755 $(S6_RC_PKGDIR)/rc.shutdown $(TARGET_DIR)/etc/rc.shutdown
+endef
+S6_RC_POST_INSTALL_TARGET_HOOKS += S6_RC_PREPARE_INIT_RC
+
+define S6_RC_FINALIZE_INIT_RC
+ rm -rf $(TARGET_DIR)/etc/s6-rc/compiled-initial
+ $(HOST_DIR)/bin/s6-rc-compile -v 1 \
+ $(TARGET_DIR)/etc/s6-rc/compiled-initial \
+ $(TARGET_DIR)/etc/s6-rc/service
+endef
+S6_RC_ROOTFS_PRE_CMD_HOOKS += S6_RC_FINALIZE_INIT_RC
+
+endif # BR2_INIT_S6
+
HOST_S6_RC_DEPENDENCIES = host-s6
HOST_S6_RC_CONF_OPTS = \
--
2.14.1
next prev parent reply other threads:[~2019-01-16 21:51 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-16 21:51 [Buildroot] [RFC 0/3] init: Add s6 as init system Vadim Kochan
2019-01-16 21:51 ` [Buildroot] [RFC 1/3] package/s6-linux-init: Build also for the host Vadim Kochan
2019-01-16 21:51 ` [Buildroot] [RFC 2/3] package/s6-linux-init: Allow to install as init system Vadim Kochan
2019-01-16 21:51 ` Vadim Kochan [this message]
2019-01-20 15:31 ` [Buildroot] [RFC 0/3] init: Add s6 " Eric Le Bihan
2019-01-30 20:50 ` Thomas De Schampheleire
2019-02-08 12:20 ` Vadym Kochan
2019-02-11 21:40 ` Eric Le Bihan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190116215135.32142-4-vadim4j@gmail.com \
--to=vadim4j@gmail.com \
--cc=buildroot@busybox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.