From d8b279da154813346631479ed89e107d434f3aae Mon Sep 17 00:00:00 2001 From: Grégoire Duchêne Date: Sat, 29 Jan 2022 13:19:35 +0000 Subject: darwin/env.sh: Add logging --- dotfiles-darwin/bin/env.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'dotfiles-darwin/bin/env.sh') diff --git a/dotfiles-darwin/bin/env.sh b/dotfiles-darwin/bin/env.sh index d291ef9..518962d 100755 --- a/dotfiles-darwin/bin/env.sh +++ b/dotfiles-darwin/bin/env.sh @@ -1,7 +1,11 @@ #!/usr/bin/env zsh +zmodload zsh/datetime +echo_log() { echo $(strftime %+) - $@ } + for env (DOMAIN HOST SSH_AUTH_SOCK UNAME XDG_{{CACHE,CONFIG,DATA}_HOME,RUNTIME_DIR}); do + echo_log Setting ${env} to “${(P)env}”. launchctl setenv ${env} ${(P)env} done @@ -9,6 +13,8 @@ done # make it work in Emacs only. Yep, it’s pretty bad. local plist=~/Applications/Emacs.app/Contents/Info.plist if [[ -f ${plist} ]]; then - plutil -replace LSEnvironment -json '{"PATH": "'${PATH}'"}' ${plist} + local json_path='{"PATH": "'${PATH}'"}' + echo_log Setting PATH in Emacs.app to “${json_path}”. + plutil -replace LSEnvironment -json ${json_path} ${plist} /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -f ${plist:h:h} fi -- cgit v1.2.3-70-g09d2