Skip to contentSkip to conversation

Split the functions script into a separate package in initscripts

PATCH Superseded [email protected] 2 participants 4 messages Dec 25, 2013 – Dec 26, 2013

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover Split the functions script into a separate package in initscripts

From: Chen Qi <[email protected]>

This is part of the systemd integration work.

Now we have two init systems in our project -- SysV and systemd.
If we are only using the SysV based systems, everything's happy because the initscripts package will and should be always installed. As a part of the package, the /etc/init.d/functions script is always available. And other init scripts which source this script don't have any problem. Things are different when we are using systemd based systems. Basically the initscripts package is useless in systemd based images and should not be installed. We can do this by setting VIRTUAL-RUNTIME_initscripts to "". This leads to the problem that some services failing to start because of lack of the /etc/init.d/functions script. An example is the distcc.

The above situation leads to a natural solution of splitting the functions script into a separate package, say, initscripts-functions. As the /etc/init.d/functions script is useful for both SysV and systemd systems, this patch also adds it to the RDEPENDS of packagegroup-core-boot.

//Chen Qi

The following changes since commit 005af45191ded6185c618c708181b31281e43092:

bitbake: fetch2: avoid printing "no checksum" error message twice (2013-12-22 14:29:13 +0000)

are available in the git repository at:

git://git.pokylinux.org/poky-contrib ChenQi/initscripts-functions
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=ChenQi/initscripts-functions

Chen Qi (2):
initscripts: split the functions script into a separate package
packagegroup-core-boot: make initscripts-functions a basic element of
RDEPENDS

 meta/recipes-core/initscripts/initscripts_1.0.bb   |    8 ++++++--
 .../packagegroups/packagegroup-core-boot.bb        |    1 +
 2 files changed, 7 insertions(+), 2 deletions(-)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/2 initscripts: split the functions script into a separate package

From: Chen Qi <[email protected]>

Many SysV init scripts need the /etc/init.d/functions script. But this script is part of the initscripts package. As a result, the initscripts package should always be installed into the system to avoid errors when starting daemons. However, it makes no sense to install the initscripts package into a systemd based image, because what the init scripts provide has already been provided by the systemd. On the other hand, the functions script might be still needed in a systemd based image because other init scripts such as distcc might need it.

The above situation leads to a natural separation of the functions script from the initscripts package. And this patch does so. It separates the functions script into initscripts-functions packages.

---
 meta/recipes-core/initscripts/initscripts_1.0.bb |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
meta/recipes-core/initscripts/initscripts_1.0.bb +6 -2
index 5951e0c..ea28672 100644
@@ -42,8 +42,12 @@ KERNEL_VERSION = ""
 inherit update-alternatives
 DEPENDS_append = " update-rc.d-native"
 
-ALTERNATIVE_PRIORITY = "90"
-ALTERNATIVE_${PN} = "functions"
+PACKAGES =+ "${PN}-functions"
+RDEPENDS_${PN} = "${PN}-functions"
+FILES_${PN}-functions = "${sysconfdir}/init.d/functions.${PN}"
+
+ALTERNATIVE_PRIORITY_${PN}-functions = "90"
+ALTERNATIVE_${PN}-functions = "functions"
 ALTERNATIVE_LINK_NAME[functions] = "${sysconfdir}/init.d/functions"
 
 HALTARGS ?= "-d -f"
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 2/2 packagegroup-core-boot: make initscripts-functions a basic element of RDEPENDS

In reply to [email protected]

From: Chen Qi <[email protected]>

Unlike the initscripts package which is useful in SysV systems but not so useful in systemd systems, the initscripts-functions package is useful for both.

For the reason stated above, this patch adds initscripts-funtions to the RDEPENDS of packagegroup-core-boot.

---
 .../packagegroups/packagegroup-core-boot.bb        |    1 +
 1 file changed, 1 insertion(+)
meta/recipes-core/packagegroups/packagegroup-core-boot.bb +1 -0
index 5455899..2f60c97 100644
@@ -41,6 +41,7 @@ RDEPENDS_${PN} = "\
     ${@base_contains("DISTRO_FEATURES", "sysvinit", "${SYSVINIT_SCRIPTS}", "", d)} \
     ${@base_contains("MACHINE_FEATURES", "keyboard", "${VIRTUAL-RUNTIME_keymaps}", "", d)} \
     netbase \
+    initscripts-functions \
     ${VIRTUAL-RUNTIME_login_manager} \
     ${VIRTUAL-RUNTIME_init_manager} \
     ${VIRTUAL-RUNTIME_initscripts} \
Signature · 1 line
1.7.9.5
#3 lore raw

Re: [PATCH 2/2] packagegroup-core-boot: make initscripts-functions a basic element of RDEPENDS

Quoted 9 lines · On 12/25/2013 12:36 AM, [email protected] wrote:

From: Chen Qi <[email protected]>

Unlike the initscripts package which is useful in SysV systems but not so useful in systemd systems, the initscripts-functions package is useful for both.

For the reason stated above, this patch adds initscripts-funtions to the RDEPENDS of packagegroup-core-boot.

Why not add the RDEPENDS on the initscript-functions to the appropriate recipes, such as distcc or others that require the contents of functions?

I understand the general value of having it installed, but if "functions" is only required for some recipes, then let's not add it in again if unneeded.

Sau!

Quoted 18 lines
---
  .../packagegroups/packagegroup-core-boot.bb        |    1 +
  1 file changed, 1 insertion(+)
meta/recipes-core/packagegroups/packagegroup-core-boot.bb +1 -0
index 5455899..2f60c97 100644
@@ -41,6 +41,7 @@ RDEPENDS_${PN} = "\
      ${@base_contains("DISTRO_FEATURES", "sysvinit", "${SYSVINIT_SCRIPTS}", "", d)} \
      ${@base_contains("MACHINE_FEATURES", "keyboard", "${VIRTUAL-RUNTIME_keymaps}", "", d)} \
      netbase \
+    initscripts-functions \
      ${VIRTUAL-RUNTIME_login_manager} \
      ${VIRTUAL-RUNTIME_init_manager} \
      ${VIRTUAL-RUNTIME_initscripts} \