package/openrc: new package
authorMichał Łyszczek <michal.lyszczek@bofc.pl>
Sun, 12 May 2019 19:55:38 +0000 (21:55 +0200)
committerThomas Petazzoni <thomas.petazzoni@bootlin.com>
Sat, 18 May 2019 20:43:44 +0000 (22:43 +0200)
This adds openrc init system package. This performs default openrc
installation with openrc-init that acts as pid1.

MKPKGCONFIG=no:
openrc does not use pkg-config per se, if MKPKGCONFIG is enabled,
it will just install *.pc files on rootfs for other programs to
find librc and libeinfo. These libs expose C api to control openrc
(al rc-* functions use it). From the looks of it, these libs would
be usefull if user wanted to write his own programs to manage
services, and vast majority of people using openrc won't need it.
Also, that's the reason why there is not INSTALL_STAGING=yes.

Signed-off-by: Michał Łyszczek <michal.lyszczek@bofc.pl>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
DEVELOPERS
package/Config.in
package/openrc/Config.in [new file with mode: 0644]
package/openrc/openrc.hash [new file with mode: 0644]
package/openrc/openrc.mk [new file with mode: 0644]

index f1bed77fe92441c909b5d296bc6487d83dd65dd8..3b5d2faae2c4e1fae3a3f999491098228e4e5ad0 100644 (file)
@@ -1615,6 +1615,7 @@ F:        board/altera/socrates_cyclone5/
 F:     board/pine64/rock64
 F:     configs/rock64_defconfig
 F:     configs/socrates_cyclone5_defconfig
+F:     package/openrc/
 
 N:     Michel Stempin <michel.stempin@wanadoo.fr>
 F:     board/licheepi/
index 3df091b60865a7b29f9401c6ebd5f14243e63be8..ff07dce000d660d7f006b99f27256a3cc7953979 100644 (file)
@@ -2195,6 +2195,7 @@ menu "System tools"
        source "package/ncdu/Config.in"
        source "package/numactl/Config.in"
        source "package/nut/Config.in"
+       source "package/openrc/Config.in"
        source "package/openvmtools/Config.in"
        source "package/pamtester/Config.in"
        source "package/polkit/Config.in"
diff --git a/package/openrc/Config.in b/package/openrc/Config.in
new file mode 100644 (file)
index 0000000..ec536c8
--- /dev/null
@@ -0,0 +1,18 @@
+config BR2_PACKAGE_OPENRC
+       bool "openrc"
+       select BR2_PACKAGE_NCURSES
+       help
+         Init that works on top of pid 1 (for example
+         openrc-init). By default it does quite a lot on startup
+         (like setting hwclock, mounting directories, configuring
+         interfaces and so on). So for this init to properly work you
+         need at least these tools on the root filesystem (default
+         busybox configuration provides them all):
+
+         swapon, fsck, hwclock, getty, login, grep, mount, coreutils,
+         procps, modprobe (kmod), net-tools
+
+         Number of tools may be decreased by removing services that
+         use them.
+
+         https://github.com/OpenRC/openrc
diff --git a/package/openrc/openrc.hash b/package/openrc/openrc.hash
new file mode 100644 (file)
index 0000000..7d58e25
--- /dev/null
@@ -0,0 +1,3 @@
+# Locally calculated
+sha256 c99488ca54f2b795328d07bbd456ade49b571136bba7501f7eaaeb1ca9f9ecc4        openrc-0.41.2.tar.gz
+sha256 96862463f4e77e2508e4fc2c83773fd24807cb699368b63fd93a5e2b466dd624        LICENSE
diff --git a/package/openrc/openrc.mk b/package/openrc/openrc.mk
new file mode 100644 (file)
index 0000000..53f2947
--- /dev/null
@@ -0,0 +1,45 @@
+################################################################################
+#
+# openrc
+#
+################################################################################
+
+OPENRC_VERSION = 0.41.2
+OPENRC_SITE = $(call github,OpenRC,openrc,$(OPENRC_VERSION))
+OPENRC_LICENSE = BSD-2-Clause
+OPENRC_LICENSE_FILES = LICENSE
+
+OPENRC_DEPENDENCIES = ncurses
+
+# set LIBNAME so openrc puts files in proper directories and sets proper
+# paths in installed files. Since in buildroot /lib64 and /lib32 always
+# points to /lib, it's safe to hardcode it to "lib"
+OPENRC_MAKE_OPTS = \
+       LIBNAME=lib \
+       LIBEXECDIR=/usr/libexec/rc \
+       MKPKGCONFIG=no \
+       MKSELINUX=no \
+       MKSYSVINIT=yes \
+       BRANDING="Buildroot $(BR2_VERSION_FULL)" \
+       CC=$(TARGET_CC)
+
+ifeq ($(BR2_SHARED_LIBS),y)
+OPENRC_MAKE_OPTS += MKSTATICLIBS=no
+else
+OPENRC_MAKE_OPTS += MKSTATICLIBS=yes
+endif
+
+define OPENRC_BUILD_CMDS
+       $(MAKE) $(OPENRC_MAKE_OPTS) -C $(@D)
+endef
+
+define OPENRC_INSTALL_TARGET_CMDS
+       $(MAKE) $(OPENRC_MAKE_OPTS) DESTDIR=$(TARGET_DIR) -C $(@D) install
+endef
+
+define OPENRC_REMOVE_UNNEEDED
+       $(RM) -r $(TARGET_DIR)/usr/share/openrc
+endef
+OPENRC_TARGET_FINALIZE_HOOKS += OPENRC_REMOVE_UNNEEDED
+
+$(eval $(generic-package))