mirror of
https://github.com/m-housh/dotfiles.git
synced 2026-02-15 06:32:40 +00:00
Cleaned up launch agent install script
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
^/Brewfile*
|
^/Brewfile*
|
||||||
^/README.*
|
^/README.*
|
||||||
^/LICENSE.*
|
^/LICENSE.*
|
||||||
|
^/LaunchAgents*
|
||||||
|
|
||||||
\.git
|
\.git
|
||||||
\.gitignore
|
\.gitignore
|
||||||
|
|||||||
@@ -25,5 +25,9 @@
|
|||||||
<string>michael</string>
|
<string>michael</string>
|
||||||
<key>RunAtLoad</key>
|
<key>RunAtLoad</key>
|
||||||
<true/>
|
<true/>
|
||||||
|
<key>StandardOutPath</key>
|
||||||
|
<string>/var/log/com.michael.clear-screenshots.out.log</string>
|
||||||
|
<key>StandardErrorPath</key>
|
||||||
|
<string>/var/log/com.michael.clear-screenshots.error.log</string>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|||||||
@@ -2,19 +2,19 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Installs launchd agents for appropriately.
|
# Installs launchd agents.
|
||||||
|
|
||||||
agent="$HOME/Library/LaunchAgents"
|
agent_dir="${HOME}/Library/LaunchAgents"
|
||||||
uid="$(id -u "$(whoami)")"
|
uid="$(id -u "$(whoami)")"
|
||||||
|
|
||||||
test -d "$agent"
|
mkdir -p "$agent_dir"
|
||||||
|
|
||||||
for file in "$DOTFILES"/macOS/LaunchAgents/*.plist; do
|
for file in "${DOTFILES}"/macOS/LaunchAgents/*.plist; do
|
||||||
filename="$(basename $file)"
|
filename=$(basename "${file}")
|
||||||
path="$agent/$filename"
|
path="${agent_dir}/${filename}"
|
||||||
if ! test -e "$path"; then
|
if ! test -e "${path}"; then
|
||||||
echo "Installing Agent: $filename"
|
echo "Installing Agent: ${filename}"
|
||||||
cp "$file" "$path"
|
cp "${file}" "${path}"
|
||||||
launchctl enable "user/$uid/$filename"
|
launchctl enable "user/${uid}/${filename}"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|||||||
Reference in New Issue
Block a user