Is it possible to "hack" an addon?!

i have to study how to create an addon yet, so here it is my noob question…

i enter an addon container and then i run few commands to install packages and make changes.

i’d like to have this script persistent and run it when haos boots.

i read that “/data” is the persistent directory for an addon, so i can put the script here.

now… is it possible, and how, to run this script on startup?!

thanks

home-assistant/addons-example: Example Home Assistant add-on repository

Do you have any experience with Docker ?

You could fork the addon project and add whatever you like to the Dockerfile

Alternatively you could write a messy automation to add your bits during startup :grimacing:

@ stevemann

@ _dev_null

no experience yet…

at the moment, i thought this trick:

  - >-
    while ! docker container list | grep 'addcontainername' | grep -q 'healthy' ; do
    sleep 5 ; done ;
  - docker exec addoncontainername /data/myscript

to put in “advanced ssh addon”… seems working

Not a noob question at all, fair when you’re starting with addons. You’re right that /data is the persistent storage for an addon. If you want your script to run on startup, you’d typically need to modify the run script or entry point of the addon itself.

When creating your addon, you can add a command in the Dockerfile or the run.sh (if you’re using one) that points to and executes your script from /data. Just make sure the script has execute permissions.

Keep in mind that if you’re editing a pre-existing addon container manually, those changes won’t survive a rebuild or update. Creating a custom addon based on what you need might be the more stable route.