-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathsymlinks.sh
More file actions
executable file
·43 lines (34 loc) · 894 Bytes
/
symlinks.sh
File metadata and controls
executable file
·43 lines (34 loc) · 894 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env bash
set -e
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
export DIR
# Parse flags
for arg in "$@"; do
case "$arg" in
--yes|-y) export DOTPICKLES_YES=1 ;;
esac
done
if [[ -f .env ]]; then
source .env
fi
# shellcheck source=./functions.sh
source ./functions.sh
# Guard: non-interactive without --yes is an error
if [ "${DOTPICKLES_YES:-}" != "1" ] && [ ! -t 0 ]; then
echo "Error: not running interactively. Use --yes/-y for unattended mode." >&2
exit 1
fi
link_directory_contents home
mkdir -p "$HOME/.config"
link_directory_contents config
# Link LaunchAgents if on macOS
if running_macos; then
mkdir -p "$HOME/Library/LaunchAgents"
echo "🚀 linking LaunchAgents"
for agent in LaunchAgents/*.plist; do
if [ -f "$agent" ]; then
target="$HOME/Library/LaunchAgents/$(basename "$agent")"
link "$agent" "$target"
fi
done
fi