Execute service before kodi

how can I create a service that runs before kodi starts? My intention is to copy a skin type addon in /storage/.kodi/addons since if I leave it in / usr / share / kodi / addons it marks me an error when using it because it uses shortcuts and creates the menu dynamically.

I am trying to change the default skin that brings kodi 18.0 from a new compilation of coreelec. I have this service, I do not know if I’m doing something wrong.

[Unit]
Description=copy addon to storage
Before=kodi.service

[Service]
Type=oneshot
Environment=HOME=/storage
ExecStart=-/bin/sh -c "exec sh /usr/lib/coreelec/addons-copy"
RemainAfterExit=yes

[Install]
WantedBy=kodi.service

Put this addons-copy call to /storage.config/autostart.sh. It will be easier than changing services.
And why do you need to do everytime kodi starts? Just copy it manually in /storage/.kodi/addons.

is that I want to set a default skin from compilation and since the skin does not exist, it can not start kodi. I can not save it in / usr / share / kodi / addons because it modifies files dynamically and that directory is only read.

And I had thought about the option that you tell me but, my intention is to avoid connecting by ssh and copy the file manually.

Now I understand the problem :slight_smile:

You can try this approach I hacked together few months back: https://forum.libreelec.tv/thread/14254-add-build-7zip-for-7z-files/?postID=108805#post108805
It adds addon’s zip file to image which is unpacked to /storage on first boot.

And seems your script is similar to mine. Does it not work?

yes, I took your post as a reference but the problem I have with your implementation is that the copy of the addon is made until you have a network connection in the device, in my case it may not have an active network connection and it is not going to be done the copy, causing that kodi does not start because the skin that is the default does not exist.

Then just remove network-online.target and should work.