diff options
| author | 2020-09-04 16:13:43 -0400 | |
|---|---|---|
| committer | 2020-09-04 16:13:43 -0400 | |
| commit | 5d81ac7e96967a6d957b2a981e648adc3a3e69f7 (patch) | |
| tree | fcfa4a2b4f09dd6bfd4a7c9f2dfeb1896d0d3765 /dot_zsh | |
| parent | zsh: process path first (diff) | |
zsh: add import-systemd-env plugin
Diffstat (limited to 'dot_zsh')
| -rw-r--r-- | dot_zsh/plugins/import-systemd-env | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/dot_zsh/plugins/import-systemd-env b/dot_zsh/plugins/import-systemd-env new file mode 100644 index 0000000..e30d8cd --- /dev/null +++ b/dot_zsh/plugins/import-systemd-env @@ -0,0 +1,15 @@ +#!/bin/zsh +# only applies to systemd +p1=$(ps -p 1 -o comm=) +[[ "$p1" = "systemd" ]] || return + +# we *import* expected systemd user env from environment.d +# I might later make a standalone utility just for that (environment.d on non-systemd systems) + +# warning: root access will mean being able to inject arbitrary code into your shell +# by way of replacing that executable +# this is why we test for systemd as pid1 (right now) rather than the presence of the binary +while read -r l; do + eval export $l + +done < <(/usr/lib/systemd/user-environment-generators/30-systemd-environment-d-generator) |
