[OE-core] [PATCH 2/2] systemd-compat-units: make run-postinsts.service work correctly on target

Chen Qi Qi.Chen at windriver.com
Mon Jan 13 07:38:46 UTC 2014


If we are using systemd as the init manager and rpm as the package
back-end, then the post-install script would not run at system start-up.

The problem is that we now have two init scripts to deal with post-install
scripts in our system. They are installed as /etc/rcS.d/S98run-postinsts and
/etc/rcS.d/S99run-postinsts respectively, however, the run-postinsts.service
in systemd only deals with the former one.

This patch fixes this problem to make run-postinsts.service work correctly
for the three package back-ends with/without 'package-management' in the
IMAGE_FEATURES.

This patch also hardcodes 98 and 99 instead of using POSTINSTALL_INITPOSITION
because using that variable doesn't bring anything useful.

[YOCTO #5719]

Signed-off-by: Chen Qi <Qi.Chen at windriver.com>
---
 meta/recipes-core/systemd/systemd-compat-units.bb  |    8 --------
 .../systemd-compat-units/run-postinsts.service     |    4 ++--
 2 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/meta/recipes-core/systemd/systemd-compat-units.bb b/meta/recipes-core/systemd/systemd-compat-units.bb
index 9f28283..5a6adb2 100644
--- a/meta/recipes-core/systemd/systemd-compat-units.bb
+++ b/meta/recipes-core/systemd/systemd-compat-units.bb
@@ -14,8 +14,6 @@ SRC_URI = "file://*.service"
 do_install() {
 	install -d ${D}${systemd_unitdir}/system/basic.target.wants
 	install -d ${D}${systemd_unitdir}/system/sysinit.target.wants/
-	sed -i -e 's, at POSTINSTALL_INITPOSITION@,${POSTINSTALL_INITPOSITION},g' \
-			${WORKDIR}/run-postinsts.service
 	install -m 0644 ${WORKDIR}/run-postinsts.service ${D}${systemd_unitdir}/system
 	ln -sf ../run-postinsts.service ${D}${systemd_unitdir}/system/basic.target.wants/
 	ln -sf ../run-postinsts.service ${D}${systemd_unitdir}/system/sysinit.target.wants/
@@ -50,9 +48,3 @@ pkg_postinst_${PN} () {
 
 FILES_${PN} = "${systemd_unitdir}/system ${bindir}"
 RDPEPENDS_${PN} = "systemd"
-
-# Define a variable to allow distros to run configure earlier.
-# (for example, to enable loading of ethernet kernel modules before networking starts)
-# note: modifying name or default value for POSTINSTALL_INITPOSITION requires
-# changes in opkg.inc
-POSTINSTALL_INITPOSITION ?= "98"
diff --git a/meta/recipes-core/systemd/systemd-compat-units/run-postinsts.service b/meta/recipes-core/systemd/systemd-compat-units/run-postinsts.service
index 35cf3d3..1dc7b1a 100644
--- a/meta/recipes-core/systemd/systemd-compat-units/run-postinsts.service
+++ b/meta/recipes-core/systemd/systemd-compat-units/run-postinsts.service
@@ -1,12 +1,12 @@
 [Unit]
 Description=Run pending postinsts
 DefaultDependencies=no
-ConditionPathExists=|/etc/rcS.d/S at POSTINSTALL_INITPOSITION@run-postinsts
+ConditionPathExistsGlob=/etc/rcS.d/S*run-postinsts
 After=systemd-remount-fs.service systemd-tmpfiles-setup.service tmp.mount
 Before=sysinit.target
 
 [Service]
-ExecStart=/etc/rcS.d/S at POSTINSTALL_INITPOSITION@run-postinsts
+ExecStart=-/etc/rcS.d/S98run-postinsts ; -/etc/rcS.d/S99run-postinsts
 RemainAfterExit=No
 Type=oneshot
 StandardOutput=syslog
-- 
1.7.9.5




More information about the Openembedded-core mailing list