Skip to contentSkip to conversation

Control over when package init scripts are run

PATCH Superseded Gary Thomas 3 participants 6 messages Apr 8, 2011 – Apr 18, 2011

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Control over when package init scripts are run

The script /etc/rcS.d/S98configure is run on the first boot only to process any postponed package post-install scripts. The default position of this (98 == last) can be wrong, so let the distribution set this (just a matter of ?= assignment). This patch also removes some slugos stuff and extends the flexibility to systems which use RPM packaging as well.

Tested on my PowerPC router, running as S00configure - works a treat.

Signature · 4 lines
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------

From cec0432ca3e02a05519d22042434f0c6fc285f37 Mon Sep 17 00:00:00 2001
From: Gary Thomas <[email protected]>
Date: Fri, 8 Apr 2011 08:59:18 -0600
Subject: [PATCH] Allow target/distribution to specify when to run package init scripts (first boot only)

---
 meta/classes/rootfs_rpm.bbclass          |   11 ++++++++---
 meta/recipes-devtools/opkg/opkg_0.1.8.bb |    5 ++---
 meta/recipes-devtools/opkg/opkg_svn.bb   |    5 ++---
 3 files changed, 12 insertions(+), 9 deletions(-)
meta/classes/rootfs_rpm.bbclass +8 -3
index 04ccabd..073bb84 100644
@@ -26,6 +26,11 @@ RPM_POSTPROCESS_COMMANDS = ""
 #
 #IMAGE_LOCALES="en-gb"
 
+# 
+# Allow distributions to alter when [postponed] package install scripts are run
+#
+RPM_INIT_POSITION ?= "98"
+
 rpmlibdir = "/var/lib/rpm"
 opkglibdir = "${localstatedir}/lib/opkg"
 
@@ -116,7 +121,7 @@ EOF
 	install -d ${IMAGE_ROOTFS}/${sysconfdir}/rcS.d
 	# Stop $i getting expanded below...
 	i=\$i
-	cat > ${IMAGE_ROOTFS}${sysconfdir}/rcS.d/S98configure << EOF
+	cat > ${IMAGE_ROOTFS}${sysconfdir}/rcS.d/S${RPM_INIT_POSITION}configure << EOF
 #!/bin/sh
 for i in /etc/rpm-postinsts/*.sh; do
 	echo "Running postinst $i..."
@@ -127,9 +132,9 @@ for i in /etc/rpm-postinsts/*.sh; do
 		echo "ERROR: postinst $i failed."
 	fi
 done
-rm -f ${sysconfdir}/rcS.d/S98configure
+rm -f ${sysconfdir}/rcS.d/S${RPM_INIT_POSITION}configure
 EOF
-	chmod 0755 ${IMAGE_ROOTFS}${sysconfdir}/rcS.d/S98configure
+	chmod 0755 ${IMAGE_ROOTFS}${sysconfdir}/rcS.d/S${RPM_INIT_POSITION}configure
 
 	install -d ${IMAGE_ROOTFS}/${sysconfdir}
 	echo ${BUILDNAME} > ${IMAGE_ROOTFS}/${sysconfdir}/version
meta/recipes-devtools/opkg/opkg_0.1.8.bb +2 -3
index 6815474..a732def 100644
@@ -13,7 +13,7 @@ SRC_URI = "http://opkg.googlecode.com/files/opkg-${PV}.tar.gz \
            file://headerfix.patch \
 "
 
-PR = "r3"
+PR = "r4"
 
 PACKAGES =+ "libopkg${PKGSUFFIX}-dev libopkg${PKGSUFFIX} update-alternatives-cworth${PKGSUFFIX}"
 
@@ -28,8 +28,7 @@ do_install_append() {
 
 # Define a variable to allow distros to run configure earlier.
 # (for example, to enable loading of ethernet kernel modules before networking starts)
-OPKG_INIT_POSITION = "98"
-OPKG_INIT_POSITION_slugos = "41"
+OPKG_INIT_POSITION ?= "98"
 
 pkg_postinst_${PN} () {
 #!/bin/sh
meta/recipes-devtools/opkg/opkg_svn.bb +2 -3
index 76ec838..8bc9793 100644
@@ -16,7 +16,7 @@ SRC_URI = "svn://opkg.googlecode.com/svn;module=trunk;proto=http \
 S = "${WORKDIR}/trunk"
 
 PV = "0.1.8+svnr${SRCPV}"
-PR = "r1"
+PR = "r2"
 
 PACKAGES =+ "libopkg${PKGSUFFIX}-dev libopkg${PKGSUFFIX} update-alternatives-cworth${PKGSUFFIX}"
 
@@ -31,8 +31,7 @@ do_install_append() {
 
 # Define a variable to allow distros to run configure earlier.
 # (for example, to enable loading of ethernet kernel modules before networking starts)
-OPKG_INIT_POSITION = "98"
-OPKG_INIT_POSITION_slugos = "41"
+OPKG_INIT_POSITION ?= "98"
 
 pkg_postinst_${PN} () {
 #!/bin/sh
Signature · 1 line
1.7.3.4
#1 lore raw

Something like this would be better:

http://cgit.openembedded.org/cgit.cgi/openembedded/commit/?id=e124d03f532aad2ee22c60fda6824a8a1f2ef88f

Op 8 apr 2011, om 17:05 heeft Gary Thomas het volgende geschreven:

Quoted 18 lines

The script /etc/rcS.d/S98configure is run on the first boot only to process any postponed package post-install scripts. The default position of this (98 == last) can be wrong, so let the distribution set this (just a matter of ?= assignment). This patch also removes some slugos stuff and extends the flexibility to systems which use RPM packaging as well.

Tested on my PowerPC router, running as S00configure - works a treat.

Signature · 8 lines
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------
<0001-Allow-target-distribution-to-specify-when-to-run-pac.patch>_______________________________________________
poky mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/poky
#2 lore raw
Quoted 3 lines · Koen Kooi

Something like this would be better:

http://cgit.openembedded.org/cgit.cgi/openembedded/commit/?id=e124d03f532aad2ee22c60fda6824a8a1f2ef88f

Possibly, except for the fact that I posted this to the Poky list which have different recipes (the one mentioned above does not apply)

Quoted 10 lines

Op 8 apr 2011, om 17:05 heeft Gary Thomas het volgende geschreven:

Quoted 8 lines

The script /etc/rcS.d/S98configure is run on the first boot only to process any postponed package post-install scripts. The default position of this (98 == last) can be wrong, so let the distribution set this (just a matter of ?= assignment). This patch also removes some slugos stuff and extends the flexibility to systems which use RPM packaging as well.

Tested on my PowerPC router, running as S00configure - works a treat.

Signature · 4 lines
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------
#3 lore raw
In reply to Gary Thomas
Quoted 9 lines · Gary Thomas

The script /etc/rcS.d/S98configure is run on the first boot only to process any postponed package post-install scripts. The default position of this (98 == last) can be wrong, so let the distribution set this (just a matter of ?= assignment). This patch also removes some slugos stuff and extends the flexibility to systems which use RPM packaging as well.

Tested on my PowerPC router, running as S00configure - works a treat.

What about this patch? It's been 10 days - no discussion.

Note: the patch has no effect on normal operation, it just lets a user or distribution control when the package init scripts are run (and then this is only on the initial boot)

Note 2: this is a case where I can't override this behaviour in my local layers, so a core change is required.

Thanks

Signature · 4 lines
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------
#4 lore raw
Quoted 8 lines · Gary Thomas
Quoted 7 lines · Gary Thomas

The script /etc/rcS.d/S98configure is run on the first boot only to process any postponed package post-install scripts. The default position of this (98 == last) can be wrong, so let the distribution set this (just a matter of ?= assignment). This patch also removes some slugos stuff and extends the flexibility to systems which use RPM packaging as well.

Quoted 4 lines
Quoted 2 lines

Tested on my PowerPC router, running as S00configure - works a treat.

What about this patch? It's been 10 days - no discussion.

Sorry, many of us were travelling for Collab/ELC and it was the Yocto 1.0 launch there. I'm trying to get through my backlog now :)

Quoted 6 lines

Note: the patch has no effect on normal operation, it just lets a user or distribution control when the package init scripts are run (and then this is only on the initial boot)

Note 2: this is a case where I can't override this behaviour in my local layers, so a core change is required.

I'm ok with the patch but could you rename the variable to something generic like POSTINSTALL_INITPOSITION please?

Cheers,

Richard

#5 lore raw
Quoted 9 lines · Richard Purdie
Quoted 8 lines · Gary Thomas
Quoted 7 lines · Gary Thomas

The script /etc/rcS.d/S98configure is run on the first boot only to process any postponed package post-install scripts. The default position of this (98 == last) can be wrong, so let the distribution set this (just a matter of ?= assignment). This patch also removes some slugos stuff and extends the flexibility to systems which use RPM packaging as well.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Tested on my PowerPC router, running as S00configure - works a treat.

What about this patch? It's been 10 days - no discussion.

Sorry, many of us were travelling for Collab/ELC and it was the Yocto 1.0 launch there. I'm trying to get through my backlog now :)

I knew that, so I was just bringing it back to the surface :-) [Would have been at ELC myself, but I have horses to feed...]

Quoted 10 lines
Quoted 7 lines

Note: the patch has no effect on normal operation, it just lets a user or distribution control when the package init scripts are run (and then this is only on the initial boot)

Note 2: this is a case where I can't override this behaviour in my local layers, so a core change is required.

I'm ok with the patch but could you rename the variable to something generic like POSTINSTALL_INITPOSITION please?

Sure - I was just following the opkg version as a guide. I'll set both modes (opkg/rpm) to use the same variable name.

Signature · 4 lines
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------