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

login
register
mail settings
Submitter Qi.Chen@windriver.com
Date Jan. 13, 2014, 7:38 a.m.
Message ID <1d073230c282c6e62cd24b164bc42f383a55544a.1389598673.git.Qi.Chen@windriver.com>
Download mbox | patch
Permalink /patch/64593/
State New
Headers show

Comments

Qi.Chen@windriver.com - Jan. 13, 2014, 7:38 a.m.
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@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(-)
Ross Burton - Jan. 13, 2014, 5:01 p.m.
On 13 January 2014 07:38, Chen Qi <Qi.Chen@windriver.com> wrote:
> +ExecStart=-/etc/rcS.d/S98run-postinsts ; -/etc/rcS.d/S99run-postinsts

Can we just make opkg and run-postinsts write that file using the same number?

Also, that service file needs to move directly into run-postinsts.
There's a start in poky-contrib:ross/postinsts if you want to finish
it off. :)

Ross
Qi.Chen@windriver.com - Jan. 14, 2014, 1:50 a.m.
On 01/14/2014 01:01 AM, Burton, Ross wrote:
> On 13 January 2014 07:38, Chen Qi <Qi.Chen@windriver.com> wrote:
>> +ExecStart=-/etc/rcS.d/S98run-postinsts ; -/etc/rcS.d/S99run-postinsts
> Can we just make opkg and run-postinsts write that file using the same number?
>
> Also, that service file needs to move directly into run-postinsts.
> There's a start in poky-contrib:ross/postinsts if you want to finish
> it off. :)
>
> Ross
>
>

Hi Ross,

As you have started working on this problem, I think I'll just drop this 
patch.

After looking at your branch, I think there's only one thing to look out 
for. When we're using ipk/dpkg as the package back-end, and 
'package-management' is in IMAGE_FEATURES, there would be no 
/etc/*-postinsts.

Best Regards,
Chen Qi
Ross Burton - Jan. 22, 2014, 5:08 p.m.
On 14 January 2014 01:50, ChenQi <Qi.Chen@windriver.com> wrote:
> As you have started working on this problem, I think I'll just drop this
> patch.
>
> After looking at your branch, I think there's only one thing to look out
> for. When we're using ipk/dpkg as the package back-end, and
> 'package-management' is in IMAGE_FEATURES, there would be no
> /etc/*-postinsts.

I started but didn't finish - as you've taken the systemd bugs could
you finish this off?  Pretty sure I filed a bug to go with it.

Ross
Qi.Chen@windriver.com - Jan. 23, 2014, 1:28 a.m.
On 01/23/2014 01:08 AM, Burton, Ross wrote:
> On 14 January 2014 01:50, ChenQi <Qi.Chen@windriver.com> wrote:
>> As you have started working on this problem, I think I'll just drop this
>> patch.
>>
>> After looking at your branch, I think there's only one thing to look out
>> for. When we're using ipk/dpkg as the package back-end, and
>> 'package-management' is in IMAGE_FEATURES, there would be no
>> /etc/*-postinsts.
> I started but didn't finish - as you've taken the systemd bugs could
> you finish this off?  Pretty sure I filed a bug to go with it.
>
> Ross
>
>

OK.

Best Regards,
Chen Qi

Patch

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,@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@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@POSTINSTALL_INITPOSITION@run-postinsts
+ExecStart=-/etc/rcS.d/S98run-postinsts ; -/etc/rcS.d/S99run-postinsts
 RemainAfterExit=No
 Type=oneshot
 StandardOutput=syslog