[OE-core] [Draft design][RFC] Running postinst at rootfs generation time

Phil Blundell philb at gnu.org
Wed Jul 13 10:04:44 UTC 2011


On Tue, 2011-07-12 at 12:07 -0500, Mark Hatle wrote:
> On 7/5/11 5:06 AM, Hauser, Wolfgang (external) wrote:
> > The problem with the alphabetic order of the postinst scripts we managed by renaming some of the packages to fit the needed order. An ugly solution, but in case of missing python skills, the easiest.
> 
> Ya, this one bothers me slightly... and I'm not really sure how to solve it...

I guess the obvious answer is just to capture the ordering of the
postinsts at the point where opkg-native tries to run them in offline
root mode.  That is, something like:

+	rm -f ${IMAGE_ROOTFS}${opkglibdir}/unconfigured
	runtime_script_required=0
	for i in ${IMAGE_ROOTFS}${opkglibdir}/info/*.preinst; do
		if [ -f $i ] && ! sh $i; then
		     	runtime_script_required=1
-			opkg-cl ${IPKG_ARGS} flag unpacked `basename $i .postinst`
+			pkg=`basename $i .postinst`
+			opkg-cl ${IPKG_ARGS} flag unpacked $pkg
+			echo $pkg >> ${IMAGE_ROOTFS}${opkglibdir}/unconfigured

[...]

	if ${@base_contains("IMAGE_FEATURES", "package-management", "false", "true", d)}; then
		if [ $runtime_script_required -eq 0 ]; then
			# All packages were successfully configured.
			# update-rc.d, base-passwd are no further use, remove them now
			opkg-cl ${IPKG_ARGS} --force-depends remove update-rc.d base-passwd || true

			# Also delete the status files
			rm -rf ${IMAGE_ROOTFS}${opkglibdir}
		fi
+	else
+		rm -f ${IMAGE_ROOTFS}${opkglibdir}/unconfigured
	fi

Or, well, you get the idea.

p.






More information about the Openembedded-core mailing list