-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsync.sh
More file actions
executable file
·76 lines (59 loc) · 1.95 KB
/
sync.sh
File metadata and controls
executable file
·76 lines (59 loc) · 1.95 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/usr/bin/env bash
# Get the directory where this script is located
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
copy_directory() {
local source="$1"
local dest="$2"
local executable="$3"
if [ -z "$source" ] || [ -z "$dest" ]; then
echo "Usage: copy_directory <source> <destination>"
return 1
fi
sudo mkdir -p "$dest"
sudo cp -R "$source" "$dest"
sudo chown -R "${USER}:$(id -gn)" "$dest/$(basename "$source")"
echo "📂 $source -> $dest"
}
copy_file() {
local source="$1"
local dest="$2"
if [ -z "$source" ] || [ -z "$dest" ]; then
echo "Usage: copy_file <source> <destination>"
return 1
fi
sudo cp "$source" "$dest"
sudo chown "${USER}:$(id -gn)" "$dest"
echo "📄 $source -> $dest"
}
append_file() {
local source="$1"
local dest="$2"
if [ -z "$source" ] || [ -z "$dest" ]; then
echo "Usage: append_file <source> <destination>"
return 1
fi
sudo cat "$source" >> "$dest"
echo "++ $source -> $dest"
}
sync_configs() {
# Create .zshrc only if it doesn't exist
if [ ! -f "${HOME}/.zshrc" ]; then
copy_file "${SCRIPT_DIR}/../.zshrc" "${HOME}/.zshrc"
fi
# Sync git config
copy_file "${SCRIPT_DIR}/../.gitconfig" "${HOME}/.gitconfig"
# Sync aerospace config
copy_file "${SCRIPT_DIR}/../.aerospace.toml" "${HOME}/.aerospace.toml"
# Sync aerospace borders config
copy_directory "${SCRIPT_DIR}/../.config/borders" "${HOME}/.config"
# Sync aerospace sketchybar config and plugins
copy_directory "${SCRIPT_DIR}/../.config/sketchybar" "${HOME}/.config"
# Sync aerospace scratchpad script
copy_directory "${SCRIPT_DIR}/../.config/aerospace-scratchpad" "${HOME}/.config"
# Copy wallpapers
copy_directory "${SCRIPT_DIR}/../wallpapers" "${HOME}/.config"
}
sync_configs
source "${HOME}/.zshrc"
aerospace reload-config
brew services restart sketchybar