mirror of
https://github.com/m-housh/dotfiles.git
synced 2026-02-14 06:12:34 +00:00
23 lines
510 B
Bash
Executable File
23 lines
510 B
Bash
Executable File
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
# Installs launchd agents.
|
|
|
|
agent_dir="${HOME}/Library/LaunchAgents"
|
|
uid="$(id -u "$(whoami)")"
|
|
|
|
mkdir -p "$agent_dir"
|
|
|
|
for file in "${DOTFILES}"/macOS/LaunchAgents/*.plist; do
|
|
# get just the base file name, similar to using `basename` but w/o a subshell
|
|
filename="${file##*/}"
|
|
path="${agent_dir}/${filename}"
|
|
echo "$filename"
|
|
if ! test -e "${path}"; then
|
|
echo "Installing Agent: ${filename}"
|
|
cp "${file}" "${path}"
|
|
launchctl enable "user/${uid}/${filename}"
|
|
fi
|
|
done
|