# How to extend mender-configure Yocto recipe

**URL:** https://hub.mender.io/t/how-to-extend-mender-configure-yocto-recipe/6722
**Category:** General Discussions
**Created:** [April 10, 2024, 11:29am UTC](https://hub.mender.io/t/how-to-extend-mender-configure-yocto-recipe/6722 "2024-04-10T11:29:35Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![wandering-tales](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/wandering-tales/32/2079_2.png) [@wandering-tales](https://hub.mender.io/u/wandering-tales)
#### Post date: [April 10, 2024, 11:29am UTC](https://hub.mender.io/t/how-to-extend-mender-configure-yocto-recipe/6722/1 "2024-04-10T11:29:35Z")

</div>

Hi,

I am fruitlessly trying to modify my existing `mender-configure_%.bbappend` to add a custom apply-device-config script.

I have tried in many ways to extend `install-scripts` command, but the final image does not even contain the `/usr/lib/mender-configure` directory, which I guessed it should already be there regardless of my new script. I have also tried to install the directory myself, but nothing.

Here’s the actual content of my `.bbappend` file:

```auto
FILESEXTRAPATHS:prepend := "${THISDIR}/files:"

SRC_URI:append:mender-image:mender-systemd = " \
    file://mender-configure-data-dir.service \
"

SRC_URI:append = " \
    file://my-custom-script \
"

FILES:${PN}:append:mender-image:mender-systemd = " \
    ${systemd_unitdir}/system/mender-configure-data-dir.service \
    ${systemd_unitdir}/system/mender-configure-apply-device-config.service.wants/mender-configure-data-dir.service \
"

FILES:${PN}-scripts:append = " \
    /usr/lib/mender-configure/apply-device-config.d/my-custom-script \
"

do_install:append:class-target:mender-image:mender-systemd() {
    install -m 644 ${WORKDIR}/mender-configure-data-dir.service ${D}${systemd_unitdir}/system/mender-configure-data-dir.service
    install -d -m 755 ${D}${systemd_unitdir}/system/mender-configure-apply-device-config.service.wants
    ln -sf ../mender-configure-data-dir.service ${D}${systemd_unitdir}/system/mender-configure-apply-device-config.service.wants/mender-configure-data-dir.service
}

do_install:append() {
    install -m 755 -d ${D}/usr/lib/mender-configure/apply-device-config.d
    install -m 755 ${WORKDIR}/my-custom-script ${D}/usr/lib/mender-configure/apply-device-config.d/
}

```

---

<div class="post-metadata">

### Author: ![wandering-tales](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/wandering-tales/32/2079_2.png) [@wandering-tales](https://hub.mender.io/u/wandering-tales)
#### Post date: [April 10, 2024, 5:33pm UTC](https://hub.mender.io/t/how-to-extend-mender-configure-yocto-recipe/6722/2 "2024-04-10T17:33:13Z")

</div>

I have finally figured out it was merely a packaging issue: the new file was actually there when running the `bitbake`-ing of the single recipe, but it was finally not included in the final Mender image.

What I was missing was the specification of the `class-target` for the `mender-image` after the `do_install`’s append and, as a consequence, adding `mender-image` to `SRC_URI` and `FILES` append’s. Additionally, I have also included `mender-configure-scripts` package to `CORE_IMAGE_EXTRA_INSTALL` variable, to have the `apply-device-config` script dir already created, plus the out-of-the-box `timezone` script (which I currently do not make any use of it).

Here’s the final `.bbappend`:

```auto
FILESEXTRAPATHS:prepend := "${THISDIR}/files:"

SRC_URI:append:mender-image:mender-systemd = " \
    file://mender-configure-data-dir.service \
"

SRC_URI:append:mender-image = " \
    file://my-custom-script \
"

FILES:${PN}:append:mender-image:mender-systemd = " \
    ${systemd_unitdir}/system/mender-configure-data-dir.service \
    ${systemd_unitdir}/system/mender-configure-apply-device-config.service.wants/mender-configure-data-dir.service \
"

FILES:${PN}-scripts:append:mender-image = " \
    /usr/lib/mender-configure/apply-device-config.d/my-custom-script \
"

do_install:append:class-target:mender-image:mender-systemd() {
    install -m 644 ${WORKDIR}/mender-configure-data-dir.service ${D}${systemd_unitdir}/system/mender-configure-data-dir.service
    install -d -m 755 ${D}${systemd_unitdir}/system/mender-configure-apply-device-config.service.wants
    ln -sf ../mender-configure-data-dir.service ${D}${systemd_unitdir}/system/mender-configure-apply-device-config.service.wants/mender-configure-data-dir.service
}

do_install:append:class-target:mender-image() {
    install -m 755 ${WORKDIR}/my-custom-script ${D}/usr/lib/mender-configure/apply-device-config.d/
}

```

---

<div class="post-metadata">

### Author: ![TheYoctoJester](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/theyoctojester/32/1444_2.png) [@TheYoctoJester](https://hub.mender.io/u/TheYoctoJester)
#### Post date: [April 10, 2024, 6:41pm UTC](https://hub.mender.io/t/how-to-extend-mender-configure-yocto-recipe/6722/3 "2024-04-10T18:41:12Z")

</div>

Thanks for sharing the solution @wandering-tales!
