I am looking for a way to run some script before other.service starts. rc.local doesn’t seem to work, as the other.service (which runs Before=sysinit.target) seems to conflict the script execution, i.e. my script must run before other.service starts which I plan do to with:
I know how to do this using my own systemd unit in the template but the task is not to touch the template. I can obviously put it in /usr/local/lib/systemd/system/my.service but the question is how to enable the service without touching the template, i.e. make it entirely AppVM-specific?
Question: in rc.local, can’t you stop the other.service, alter the config, then start your service (or script) and start the other.service again?
I have not tried but it seems to me it might have unpredicated negative effects.
I have actually found that I can do it without an extra unit. I found a way to fi my own script, which would allow me to run it through rc.local. It had something to do with ownership/permissions which behaved differently in AppVM and DispVMs.
It is still an interesting general problem though.
This use case is explained in the file /rw/config/rc.local (for a simple version)
> cat /rw/config/rc.local
#!/bin/sh
# This script will be executed at every VM startup, you can place your own
# custom commands here. This includes overriding some configuration in /etc,
# starting services etc.
# Example for overriding the whole CUPS configuration:
# rm -rf /etc/cups
# ln -s /rw/config/cups /etc/cups
# systemctl --no-block restart cups