diff options
Diffstat (limited to 'systemd/usr')
-rwxr-xr-x | systemd/usr/bin/save-environment-variables | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/systemd/usr/bin/save-environment-variables b/systemd/usr/bin/save-environment-variables new file mode 100755 index 0000000..9735151 --- /dev/null +++ b/systemd/usr/bin/save-environment-variables @@ -0,0 +1,18 @@ +#!/usr/bin/env zsh + +output=$1 +shift + +source $HOME/.profile + +# Make sure the output directory exists. +[[ -d "$(dirname $output)" ]] || mkdir -p "$(dirname $output)" + +echo "[Service]" > "$output" + +# Write down all the environment variables. +for env in $@; do + echo "Environment=\"${env}=${(P)env}\"" +done >> "$output" + +systemctl --user daemon-reload |