Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: fix shutdown completion check for systemd



---

dana mentioned having weird issues with shutdown -r <tab> using the new _phony stuff,
and I couldn't reproduce it. Then I realized _shutdown assumes I'm using systemd just
because some package has installed a unit file or whatever is in that directory, even
though I'm actually not.  According to this[1] page, this is the proper way to check
if you're booted via systemd.

[1] https://manpages.debian.org/trixie/libsystemd-dev/sd_booted.3.en.html

 Completion/Unix/Command/_shutdown | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Completion/Unix/Command/_shutdown b/Completion/Unix/Command/_shutdown
index 2020b9d178..ab98a4325a 100644
--- a/Completion/Unix/Command/_shutdown
+++ b/Completion/Unix/Command/_shutdown
@@ -2,7 +2,7 @@
 
 local -a args
 
-if [[ -d /etc/systemd ]]; then
+if [[ -d /run/systemd/system ]]; then
   _arguments \
     '--help[display usage information]' \
     '(-H --halt)'{-H,--halt}'[halt the machine]' \
-- 
2.38.1





Messages sorted by: Reverse Date, Date, Thread, Author