I have an in-house config deb that I'm installing on a system. Among other things, I'd like to the package to enable a serial console, as described in http://0pointer.de/blog/projects/serial-console.html.
Appreciating that I could just run systemd enable serial-getty@ttyS0.service
in my package's postinst, it feels like it would be better to leverage debhelper in order to ensure proper upgrade/uninstall behaviour. However, I'm finding that:
- I can't just call
dh_systemd_enable
from myrules
file with the name of an instance unit; it expects to be pointed at an actual file (same thing if I do an end run and try to calldeb-systemd-helper
directly). - I can install a target unit with debhelper, but I don't see to be able to make it do the right thing.
Here's what my target unit looks like:
[Unit]
Description=Serial Console
[Install]
WantedBy=getty.target
Requires=serial-getty@ttyS0.service
I can enable and/or start this, and it shows as running under systemctl status
, however it doesn't start the instance service which it is supposed to require.
So I guess my question is in two parts: first, why isn't my target unit working as expected, and second, is there a best way to achieve this under Debian packaging?