Low priority but nice "tidy up"...
At appliance build time there is sometimes need to start services. However systemd services will not run in a chroot. We workaround this by providing a fake systemctl script - with a companion service script.
The fake scripts are added to the system during the first step of the root.patched step (common overlay) and then removed at the end of the root.patched build step as a final-removelist. I.e. before and after all the conf scripts run respectively.
Currently the functionality is split between the 2 "fake" systemctl and service scripts in a very adhoc way. That just happened organically over the years because during the systemd transition many packages still included sysvinit scripts so service would often still "just work" in a chroot. When systemd is not running, service triggered the init.d script rather than the service file. However as systemd has become more ubiquitous that has become less the case and most packages no longer even include init.d scripts. And some that still remain explicitly invoke systemd anyway (e.g. Apache).
So it makes much more sense to consolidate all the functionality into a single systemctl script. I.e. move all the functionality from our fake service to our fake systemctl.
The first step would be to replace all build time conf script calls to service with systemctl. Once that is complete we can just remove our fake service command altogether. Fake systemctl should probably still check if an init.d script exists and call that via service if it does (while Debian still includes some) - but that too could be in fake systemctl.
Low priority but nice "tidy up"...
At appliance build time there is sometimes need to start services. However systemd services will not run in a chroot. We workaround this by providing a fake
systemctlscript - with a companionservicescript.The fake scripts are added to the system during the first step of the
root.patchedstep (common overlay) and then removed at the end of theroot.patchedbuild step as afinal-removelist. I.e. before and after all the conf scripts run respectively.Currently the functionality is split between the 2 "fake"
systemctlandservicescripts in a very adhoc way. That just happened organically over the years because during the systemd transition many packages still included sysvinit scripts soservicewould often still "just work" in a chroot. When systemd is not running,servicetriggered the init.d script rather than the service file. However as systemd has become more ubiquitous that has become less the case and most packages no longer even include init.d scripts. And some that still remain explicitly invoke systemd anyway (e.g. Apache).So it makes much more sense to consolidate all the functionality into a single
systemctlscript. I.e. move all the functionality from our fakeserviceto our fakesystemctl.The first step would be to replace all build time conf script calls to
servicewithsystemctl. Once that is complete we can just remove our fakeservicecommand altogether. Fakesystemctlshould probably still check if an init.d script exists and call that viaserviceif it does (while Debian still includes some) - but that too could be in fakesystemctl.