grml-etc-core icon indicating copy to clipboard operation
grml-etc-core copied to clipboard

grml-zshrc: provide native systemd support in Start/Stop/... functions and cmdline completion

Open mika opened this issue 3 years ago • 6 comments

Our __start_stop function, which is used as helper function within our Start, Stop, Restart,... functions doesn't provide native support for systemd. While usage of service still works, it would be nice if we could support systemctl usage.

Also our _grmlinitd function doesn't complete systemd unit files, but only init scripts. This means that e.g. Start N<tab> doesn't detect/complete NetworkManager.service, as the network-manager Debian package ships a systemd unit file but not an init script.

mika avatar Sep 15 '21 15:09 mika

Are you aiming at supporting both, or only systemd?

evgeni avatar Sep 15 '21 15:09 evgeni

I don't have any intentions to drop sysv-rc/init-script support :)

mika avatar Sep 15 '21 15:09 mika

@evgeni care to elaborate? :) Is there any drawback, if we still support init scripts?

mika avatar Sep 15 '21 15:09 mika

More code with IMHO zero benefit, unless you intend to run with something else than systemd as pid 1.

evgeni avatar Sep 15 '21 15:09 evgeni

Actually, it makes things even more complicated. If you have systemd with sysv-generator enabled, you get a unit file per sysv init script, and your completion would show both, unless you deduplicate somehow. And if you have sysv-generator disabled, you get completion for scripts that can't be run.

evgeni avatar Sep 15 '21 15:09 evgeni

Alright, I'll look into it and see what we could do, thanks for your prompt (nice word-play! :)) feedback!

mika avatar Sep 15 '21 15:09 mika