dotfiles/recipes/_launchd

19 lines
507 B
Text
Raw Normal View History

2018-08-10 18:41:46 +00:00
#!/bin/bash
set -e
_recipe _link
_launchd() {
local service=$1
local filename="${service}.plist"
local source=${HOME}/dotfiles/Library/LaunchAgents/${filename}
local target=${HOME}/Library/LaunchAgents/${filename}
if launchctl list $service >/dev/null 2>&1; then
echo "[launchd] $service already installed, skipping."
else
mkdir -p ${HOME}/Library/LaunchAgents
_link $source $target
_run "[launchd] Install $service" launchctl load $target
fi
}