grml / grml-etc-core

Grmls core configuration files for zsh, vim, screen…
http://git.grml.org/?p=grml-etc-core.git
274 stars 75 forks source link

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

Open mika opened 2 years ago

mika commented 2 years ago

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.

evgeni commented 2 years ago

Are you aiming at supporting both, or only systemd?

mika commented 2 years ago

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

mika commented 2 years ago

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

evgeni commented 2 years ago

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

evgeni commented 2 years ago

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.

mika commented 2 years ago

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