1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2025-03-13 20:30:02 +00:00

launchd: fix reload of services

This commit is contained in:
Daiderd Jordan 2017-05-13 16:25:07 +02:00
parent 0495b41b4d
commit 16cbb8f6a1
No known key found for this signature in database
GPG key ID: D02435D05B810C96

View file

@ -12,22 +12,22 @@ let
};
launchdActivation = basedir: target: ''
if ! diff '${cfg.build.launchd}/Library/${basedir}/${target}' '/Library/${basedir}/${target}'; then
if ! diff '${cfg.build.launchd}/Library/${basedir}/${target}' '/Library/${basedir}/${target}' &> /dev/null; then
if test -f '/Library/${basedir}/${target}'; then
launchctl unload -w '/Library/${basedir}/${target}' || true
fi
cp -f '${cfg.build.launchd}/Library/${basedir}/${target}' '/Library/${basedir}/${target}'
launchctl load '/Library/${basedir}/${target}'
launchctl load -w '/Library/${basedir}/${target}'
fi
'';
userLaunchdActivation = target: ''
if ! diff ${cfg.build.launchd}/user/Library/LaunchAgents/${target} ~/Library/LaunchAgents/${target}; then
if ! diff ${cfg.build.launchd}/user/Library/LaunchAgents/${target} ~/Library/LaunchAgents/${target} &> /dev/null; then
if test -f ~/Library/LaunchAgents/${target}; then
launchctl unload -w ~/Library/LaunchAgents/${target} || true
fi
cp -f '${cfg.build.launchd}/user/Library/LaunchAgents/${target}' ~/Library/LaunchAgents/${target}
launchctl load ~/Library/LaunchAgents/${target}
launchctl load -w ~/Library/LaunchAgents/${target}
fi
'';