title: Execute custom script after boot on Yocto-built linux system
body: <p>I want to execute a script which is present in rootfs everytime system boots to indicate successful update and reset bootloader variables.</p>
  <p>For example, the &quot;custom-script&quot; script in present in <code>/etc</code> as:</p>
  <pre><code>/etc
  ----/init.d
  -----------custom-script.sh
  </code></pre>
  <p>The first step I did is to install this script in rootfs of the linux image. I have created a recipe in my custom Yocto layer. <code>meta-custom\recipes-support\images</code> layer directory is as follows:</p>
  <pre><code>.
  ├── files
  │   ├── custom-script.sh
  └── core-image-base.bb
  </code></pre>
  <p>The core-image-base.bb is:</p>
  <pre><code>DESCRIPTION = &quot;Install script to Rootfs&quot;
  SUMMARY = &quot;Install script to Rootfs and run after boot&quot;
  LICENSE = &quot;CLOSED&quot;
  
  SRC_URI = &quot;file://custom-script.sh&quot;
  
  do_install_append() {
      install -d 644 ${D}${sysconfdir}/init.d
      install -m 0755 ${WORKDIR}/custom-script.sh ${D}${sysconfdir}/init.d/custom-script.sh
  
  FILES_${PN} = &quot;${sysconfdir}/init.d&quot;
  </code></pre>
  <p>And in the <code>conf/layer.conf</code> I added <code>IMAGE_INSTALL_append = &quot; core-image-base&quot;</code>.</p>
  <p>Now I want to execute this script every time the linux system boots (afrer successfully loading rootfs). Can someone please help me to accomplish this? As per my understanding, I can use systemd services to do this and this service should be executed each time the system boots. Any help would be much appreciated.</p>
  <p>Thanks in advance.</p>
  <p>P.S: I am using Ubuntu 20.04 and this is my first time using systemd services in Yocto with Dunfell version.</p>