aboutsummaryrefslogtreecommitdiffstats
path: root/systemd/usr
diff options
context:
space:
mode:
authorGravatar Tom Willemse2016-07-26 15:19:32 +0200
committerGravatar Tom Willemse2016-07-26 15:19:32 +0200
commit769211e95616fecd6d81d5eabd14978f71b7c1c8 (patch)
tree59892406c0131296234493f390f46147b92f0c85 /systemd/usr
parentf1a55c3030a2c193b344db57893aaeef978b64e5 (diff)
downloadnew-dotfiles-769211e95616fecd6d81d5eabd14978f71b7c1c8.tar.gz
new-dotfiles-769211e95616fecd6d81d5eabd14978f71b7c1c8.zip
Start Emacs daemon as a systemd service
Diffstat (limited to 'systemd/usr')
-rwxr-xr-xsystemd/usr/bin/save-environment-variables18
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