# State-scripts documentation: how to use them without Yocto

**URL:** <https://hub.mender.io/t/state-scripts-documentation-how-to-use-them-without-yocto/744>\
**Category:** General Discussions\
**Tags:** state-scripts\
**Created:** [June 24, 2019, 3:25pm UTC](https://hub.mender.io/t/state-scripts-documentation-how-to-use-them-without-yocto/744 "2019-06-24T15:25:29Z")\
**Posts on this page:** 1\
**Showing post:** 18

<div class="post-metadata">

**Author:** ![thesillywhat](https://avatars.discourse-cdn.com/v4/letter/t/57b2e6/32.png) [@thesillywhat](https://hub.mender.io/u/thesillywhat)\
**Post date:** [September 18, 2020, 4:48pm UTC](https://hub.mender.io/t/state-scripts-documentation-how-to-use-them-without-yocto/744/18 "2020-09-18T16:48:56Z")

</div>

The more I read about this more complicate it sounds

So to give an example of what I am trying to achieve.

Recently I found out that I had provide a patch to systemd so that I could change timezone in read only root file system.  
So the fix was in two areas.

1. I had to update rootfs
2. Add necessary file in persistent data section

As shown below

> root@raspberrypi-cm3:/etc# ls -lrt | grep localtime  
> lrwxrwxrwx 1 root root 22 Aug 19 11:56 localtime → /data/system/localtime  
> root@raspberrypi-cm3:/etc#

So now I have to create that structure (/data/system/localtime) in persistent data location.

And to achieve point 2, I have to create a state script to do so (As shown below)

```
#!/bin/sh
#
# Retain provide configuration files for timedatectl
#

mkdir /data/system/
if [[$? -eq 0]] ; then
	echo "Universal" > /data/system/timezone
else
	exit 1
fi

ln -s /usr/share/zoneinfo/Universal /data/system/localtime

if [[$? -ne 0]]; then
	exit 1
fi  

```

Then I need to name that state script (example Download\_Leave\_02)  
So once I create the state script then I run this command

```auto
mender-artifact --compression "lzma" write rootfs-image \
   --file "$releaseName-mender.ext4" \
   --device-type "raspberrypi3" \
   --artifact-name "$releaseName-mender.mender" \
   --script "$scriptsDir/Download_Leave_02" \ 
   --script "$scriptsDir/another_script"

```

And then create a delta update and use that output to update my machine?

Other question I do have a .ext4 file but I don’t have an mender.ext4 file. Is the naming convention that important?

---

_[View the full topic](https://hub.mender.io/t/state-scripts-documentation-how-to-use-them-without-yocto/744)._
