pkg_postinst_ontarget not executed


Damien LEFEVRE
 

Hi,

I have a device with rootfs mounted readonly and with an overlay on top of it to do the factory reset.

There's A/B partitioning. So there is a duplicate set of partitions.

There's an OTA engine to deploy atomics images.

I have the following usecase:
1. I flash a minimal image
2. I write the device type into a file (mutiple variant but same HW setup) to a persistent data partition.
3. I deploy the common product image via OTA engine. The whole rootfs is deployed atomically
4. I copy the current overlay partition content to the next overlay partition
5. Reboot
6. System boots to the next slot to the common product image

Currently, the common product image is the minimal image with the addition of this test-deployment package:

DISCRIPTION = "Test product specific deployment"
LICENSE = "CLOSED"
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"

SRC_URI = " \
    file://config.type1 \
    file://config.type2 \
    file://config.type3 \
"

do_configure[noexec] = "1"
do_compile[noexec] = "1"

do_install() {
    install -d ${D}/opt/test
    install -m 0644 ${WORKDIR}/config.type1 ${D}/opt/test
    install -m 0644 ${WORKDIR}/config.type2 ${D}/opt/test
    install -m 0644 ${WORKDIR}/config.type3 ${D}/opt/test
}

pkg_postinst_ontarget_${PN}() {
    systemid=$(cat /persistent/systemid)
    cd /opt/test
    mv config.$systemid config
    rm config.*
}

FILES_${PN} += " \
    /opt/test/* \
"


The /opt/test folder is now present but it still contains config.type1, config.type2 and config.type3.

If can find the postinst script in /var/lib/opkg/info/test-deployment.postinst and execute it.

Since test-deployment is a new package, I would have expected pkg_postinst_ontarget to be executed

How is the first boot detected on a poky image? Is there a way to detect if .postinst scripts haven't been executed?

Thanks,
-Damien

Join yocto@lists.yoctoproject.org to automatically receive all group messages.