dotfiles/systemd/usr/bin/save-environment-variables

19 lines
351 B
Text
Raw Permalink Normal View History

#!/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