aboutsummaryrefslogtreecommitdiffstats
path: root/systemd/usr/bin/save-environment-variables
blob: 9735151f1c729e38e28f581ab2193fe28d24c782 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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