I'd like to know how to replace a service unit file from a certain package with my own version. That is, I have found some problems in that service unit file and have corrected them. However, with the next update of that package, my changes will be lost.
I am aware that I could modify the original package, work with pinning and so on. But that seems to be overly complicated in this case, and I really would like to get the updates of the respective package in a normal way. It is solely the service unit file which I would like to keep in my corrected version.
The following solution came to my mind:
- Copy /lib/systemd/system/daemon.service to /etc/systemd/system/my-daemon.service
- Disable and mask daemon.service so that systemd won't start it anymore, and so that package updates hopefully won't re-enable it
- Make appropriate corrections in my-daemon.service
- Enable my-daemon.service
Would this be a reasonable method? Is there an "official" solution to this problem?