# Mender-convert - Include state scripts in the artifact

**URL:** <https://hub.mender.io/t/mender-convert-include-state-scripts-in-the-artifact/2195>\
**Category:** General Discussions\
**Created:** [July 14, 2020, 6:00pm UTC](https://hub.mender.io/t/mender-convert-include-state-scripts-in-the-artifact/2195 "2020-07-14T18:00:46Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![drewmoseley](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/drewmoseley/32/47_2.png) [@drewmoseley](https://hub.mender.io/u/drewmoseley)\
**Post date:** [July 20, 2020, 5:29pm UTC](https://hub.mender.io/t/mender-convert-include-state-scripts-in-the-artifact/2195/2 "2020-07-20T17:29:16Z")

</div>

Hi @c3ntry you include root filesystem scripts in /etc/mender/scripts via the overlay but Artifact scripts need to be added into the artifact when mender-artifact is invoked. [You can see docs about the different types of scripts here](https://docs.mender.io/hosted/artifacts/state-scripts#root-file-system-and-artifact-scripts).

To add Artifact scripts with mender-convert, you need to override the mender\_create\_artifact function with one of your own that adds the appropriate ‘–script value’ options. For reference, [the default function is here](https://github.com/mendersoftware/mender-convert/blob/adebaf675d09b4ea257747c10c956a66922bc1ae/configs/mender_convert_config#L200).

Basically you create your own config file and then add an extra _–config my-custom-config_ to your invocation of mender-convert. The custom config file would look something like:

```
mender_create_artifact() {
  local -r device_type="${1}"
  local -r artifact_name="${2}"
  local -r image_name="${3}"

  mender_artifact=deploy/${image_name}.mender
  log_info "Writing Mender artifact to: ${mender_artifact}"
  log_info "This can take up to 20 minutes depending on which compression method is used"

  run_and_log_cmd "mender-artifact --compression ${MENDER_ARTIFACT_COMPRESSION} \
      write rootfs-image \
      --file work/rootfs.img \
      --output-path ${mender_artifact} \
      --artifact-name ${artifact_name} \
      --script <full-path-to>/ArtifactReboot_Leave_00_verify-modem-up \
      --device-type ${device_type}"
}

```

The version file is created automatically by the mender-convert-modify portion of mender-convert.

Drew

---

_[View the full topic](https://hub.mender.io/t/mender-convert-include-state-scripts-in-the-artifact/2195)._
