Skip to content

Commit 7006f4b

Browse files
committed
macos: fixup setup script
1 parent a0fd229 commit 7006f4b

File tree

1 file changed

+44
-7
lines changed

1 file changed

+44
-7
lines changed

setup-macos.sh

Lines changed: 44 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,36 @@ gpg_encryption_subkey=0x79C70BBE4865D828
55

66
base_path=$PWD
77
data_path="$base_path"/data
8+
git_submodule_path="$base_path"/.git_submodules
9+
10+
symlink() {
11+
if [[ -e "${2}" ]]; then
12+
if [[ ! -L "${2}" ]]; then
13+
echo "${2} already exists and is an irregular type. Check manually whether this is safe to replace with ${1}."
14+
return 1
15+
fi
16+
17+
echo "Removing existing symlink at ${2}"
18+
rmrf "${2}" || {
19+
echo "failed to remove old symlink: ${2}"
20+
return 1
21+
}
22+
fi
23+
24+
# Stow only supports relative symlinks
25+
ln -s "${1}" "${2}" || {
26+
echo "failed to symlink: ${1} to ${2}"
27+
return 1
28+
}
29+
}
830

931
declare -a brew_pkgs=(
1032
bat
1133
font-hack-nerd-font
1234
gnupg
1335
go
1436
helix
37+
mpv
1538
neovim
1639
node
1740
npm
@@ -34,7 +57,7 @@ brew install "${brew_pkgs[@]}" || {
3457
echo "failed to install brew packages"
3558
}
3659

37-
git submodule update --init --remote --progress omz/.oh-my-zsh/themes/powerlevel10k || {
60+
git submodule update --init --recursive --remote --progress || {
3861
echo "failed to update git submodules"
3962
exit 1
4063
}
@@ -53,12 +76,14 @@ echo "Setting up GPG/SSH"
5376
gpg --list-keys >/dev/null
5477

5578
declare -a mk_dirs=(
56-
~/.cargo
5779
~/.cargo
5880
~/.config
5981
~/.continue
6082
~/.local/bin
83+
~/.local/share
6184
~/.ssh
85+
~/Library/KeyBindings
86+
~/Library/LaunchAgents
6287
)
6388

6489
for mk_dir in "${mk_dirs[@]}"; do
@@ -98,6 +123,22 @@ cp -v "$data_path"/gpg/gpg-agent.conf "$base_path"/gpg/.gnupg/gpg-agent.conf ||
98123
}
99124
echo "pinentry-program $HOME/.local/bin/pinentry-auto" | tee -a "$HOME"/.gnupg/gpg-agent.conf
100125

126+
# Fix for spacing breaking the space delimited tuples
127+
mv "${git_submodule_path}"/catppuccin-bat/themes/Catppuccin\ Mocha.tmTheme "${git_submodule_path}"/catppuccin-bat/themes/Catppuccin-Mocha.tmTheme || {
128+
echo "failed to move catppuccin-bat theme"
129+
exit 1
130+
}
131+
132+
declare -a symlink_paths_tuples=(
133+
"${git_submodule_path}/alacritty-theme/themes ${base_path}/alacritty/.config/alacritty/themes"
134+
"${git_submodule_path}/catppuccin-bat/themes/Catppuccin-Mocha.tmTheme ${base_path}/bat/.config/bat/themes/Catppuccin-Mocha.tmTheme"
135+
"${git_submodule_path}/catppuccin-helix/themes/default/catppuccin_mocha.toml ${base_path}/helix/.config/helix/themes/catppuccin_mocha.toml"
136+
)
137+
for symlink_paths_tuple in "${symlink_paths_tuples[@]}"; do
138+
read -ra symlink_paths <<<"$symlink_paths_tuple"
139+
symlink "${symlink_paths[0]}" "${symlink_paths[1]}"
140+
done
141+
101142
stow_config() {
102143
stow -v "$1" || {
103144
echo "Failed to stow ${1} config"
@@ -109,6 +150,7 @@ declare -a stow_dirs_setup=(
109150
bash
110151
git
111152
gpg
153+
macos
112154
ssh
113155
stow
114156
zsh
@@ -119,11 +161,6 @@ for stow_dir in "${stow_dirs_setup[@]}"; do
119161
stow_config "$stow_dir"
120162
done
121163

122-
rsync --progress -ruacv -- macos/* "$HOME"/ || {
123-
echo "failed to rsync macos config"
124-
return 1
125-
}
126-
127164
declare -a launch_agents=(
128165
"$HOME"/Library/LaunchAgents/gnupg.gpg-agent.plist
129166
"$HOME"/Library/LaunchAgents/gnupg.gpg-agent-symlink.plist

0 commit comments

Comments
 (0)