Skip to content

Commit 41407e1

Browse files
committed
setup: specify stow target dir for stow init + fixes
1 parent 2bfebfa commit 41407e1

File tree

2 files changed

+79
-56
lines changed

2 files changed

+79
-56
lines changed

setup-macos.sh

Lines changed: 42 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ exit_setup() {
1515

1616
set -euo pipefail
1717
trap 'exit_setup' ERR INT
18+
1819
symlink() {
1920
if [[ -e "${2}" ]]; then
2021
if [[ ! -L "${2}" ]]; then
@@ -91,14 +92,14 @@ echo "Setting up GPG/SSH"
9192
gpg --list-keys >/dev/null
9293

9394
declare -a mk_dirs=(
94-
~/.cargo
95-
~/.config
96-
~/.continue
97-
~/.local/bin
98-
~/.local/share
99-
~/.ssh
100-
~/Library/KeyBindings
101-
~/Library/LaunchAgents
95+
~/.cargo/
96+
~/.config/
97+
~/.continue/
98+
~/.local/bin/
99+
~/.local/share/
100+
~/.ssh/
101+
~/Library/KeyBindings/
102+
~/Library/LaunchAgents/
102103
)
103104

104105
for mk_dir in "${mk_dirs[@]}"; do
@@ -122,37 +123,30 @@ rm_if_not_stowed() {
122123
fi
123124
fi
124125

125-
rm -rfv "${1}"
126+
rm -rfv "${1}" || {
127+
echo "failed to remove conflict path ${1}"
128+
return 1
129+
}
126130
}
127131

128132
echo "Checking for files/directories that will conflict with stow"
129133
for conflict_path in "${conflict_paths[@]}"; do
130134
rm_if_not_stowed "${conflict_path}"
131135
done
132136

137+
echo "Setting up stow"
138+
stow -t ~/ stow || {
139+
echo "failed to setup stow"
140+
exit 1
141+
}
142+
133143
echo "Appending custom pinentry script to gpg-agent.conf"
134144
# GNUPG is ridiculous and only allows env-vars in some of the options here, so we have to do this the convoluted way with a line append
135145
cp -v "$data_path"/gpg/gpg-agent.conf "$base_path"/gpg/.gnupg/gpg-agent.conf || {
136146
echo "failed to copy gpg-agent.conf from data dir"
137147
exit 1
138148
}
139-
echo "pinentry-program $HOME/.local/bin/pinentry-auto" | tee -a "$HOME"/.gnupg/gpg-agent.conf
140-
141-
# Fix for spacing breaking the space delimited tuples
142-
mv "${git_submodule_path}"/catppuccin-bat/themes/Catppuccin\ Mocha.tmTheme "${git_submodule_path}"/catppuccin-bat/themes/Catppuccin-Mocha.tmTheme || {
143-
echo "failed to move catppuccin-bat theme"
144-
exit 1
145-
}
146-
147-
declare -a symlink_paths_tuples=(
148-
"${git_submodule_path}/alacritty-theme/themes ${base_path}/alacritty/.config/alacritty/themes"
149-
"${git_submodule_path}/catppuccin-bat/themes/Catppuccin-Mocha.tmTheme ${base_path}/bat/.config/bat/themes/Catppuccin-Mocha.tmTheme"
150-
"${git_submodule_path}/catppuccin-helix/themes/default/catppuccin_mocha.toml ${base_path}/helix/.config/helix/themes/catppuccin_mocha.toml"
151-
)
152-
for symlink_paths_tuple in "${symlink_paths_tuples[@]}"; do
153-
read -ra symlink_paths <<<"$symlink_paths_tuple"
154-
symlink "${symlink_paths[0]}" "${symlink_paths[1]}"
155-
done
149+
echo "pinentry-program $HOME/.local/bin/pinentry-auto" | tee -a "$base_path"/gpg/.gnupg/gpg-agent.conf
156150

157151
stow_config() {
158152
stow -v "$1" || {
@@ -167,7 +161,6 @@ declare -a stow_dirs_setup=(
167161
gpg
168162
macos
169163
ssh
170-
stow
171164
zsh
172165
)
173166

@@ -223,16 +216,38 @@ for decrypt_data_paths_tuple in "${decrypt_data_paths_tuples[@]}"; do
223216
fi
224217
done
225218

219+
# Fix for spacing breaking the space delimited tuples
220+
mv "${git_submodule_path}"/catppuccin-bat/themes/Catppuccin\ Mocha.tmTheme "${git_submodule_path}"/catppuccin-bat/themes/Catppuccin-Mocha.tmTheme || {
221+
echo "failed to move catppuccin-bat theme"
222+
exit 1
223+
}
224+
225+
declare -a symlink_paths_tuples=(
226+
"${git_submodule_path}/alacritty-theme/themes ${base_path}/alacritty/.config/alacritty/themes"
227+
"${git_submodule_path}/catppuccin-bat/themes/Catppuccin-Mocha.tmTheme ${base_path}/bat/.config/bat/themes/Catppuccin-Mocha.tmTheme"
228+
"${git_submodule_path}/catppuccin-helix/themes/default/catppuccin_mocha.toml ${base_path}/helix/.config/helix/themes/catppuccin_mocha.toml"
229+
)
230+
for symlink_paths_tuple in "${symlink_paths_tuples[@]}"; do
231+
read -ra symlink_paths <<<"$symlink_paths_tuple"
232+
symlink "${symlink_paths[0]}" "${symlink_paths[1]}"
233+
done
234+
226235
declare -a stow_dirs_general=(
227236
alacritty
228237
bat
229238
continue
230239
helix
231240
nvim
241+
omz
232242
rust
233243
)
234244

235245
echo "Stowing general configs"
236246
for stow_dir in "${stow_dirs_general[@]}"; do
237247
stow_config "$stow_dir"
238248
done
249+
250+
defaults write com.apple.finder AppleShowAllFiles -boolean true || {
251+
echo "failed to enable hidden files in Finder"
252+
exit 1
253+
}

setup.sh

Lines changed: 37 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,10 @@ rm_if_not_stowed() {
337337
fi
338338
fi
339339

340-
rm -rfv "${1}"
340+
rm -rfv "${1}" || {
341+
echo "failed to remove conflict path ${1}"
342+
return 1
343+
}
341344
}
342345

343346
stow_config() {
@@ -379,36 +382,42 @@ for old_file in "${old_files[@]}"; do
379382
}
380383
done
381384

385+
echo "Setting up stow"
386+
stow -t ~/ stow || {
387+
echo "failed to setup stow"
388+
exit 1
389+
}
390+
382391
echo "Setting up user directory configs"
383392

384393
# Parent dirs that should not be symlinks from stow-ing
385394
declare -a mk_dirs=(
386-
~/.cargo
387-
~/.continue
388-
~/.config/bat/themes
389-
~/.config/corectrl/profiles
390-
~/.config/environment.d
391-
~/.config/figma-linux
392-
~/.config/khal
393-
~/.config/Kvantum
394-
~/.config/nvim
395-
~/.config/pulse
396-
~/.config/pulseaudio-ctl
397-
~/.config/systemd/user
398-
~/.config/Thunar
399-
~/.config/tidal-hifi
400-
~/.config/VSCodium/User/globalStorage
401-
~/.config/xfce4/xfconf/xfce-perchannel-xml
402-
~/.icons
403-
~/.local/bin
404-
~/.local/share/applications
405-
~/.local/share/fonts/OTF
406-
~/.local/share/fonts/TTF
407-
~/.ssh
408-
~/.themes
409-
~/.vscode-oss
410-
~/Pictures/Backgrounds
411-
~/Pictures/Screenshots
395+
~/.cargo/
396+
~/.continue/
397+
~/.config/bat/themes/
398+
~/.config/corectrl/profiles/
399+
~/.config/environment.d/
400+
~/.config/figma-linux/
401+
~/.config/khal/
402+
~/.config/Kvantum/
403+
~/.config/nvim/
404+
~/.config/pulse/
405+
~/.config/pulseaudio-ctl/
406+
~/.config/systemd/user/
407+
~/.config/Thunar/
408+
~/.config/tidal-hifi/
409+
~/.config/VSCodium/User/globalStorage/
410+
~/.config/xfce4/xfconf/xfce-perchannel-xml/
411+
~/.icons/
412+
~/.local/bin/
413+
~/.local/share/applications/
414+
~/.local/share/fonts/OTF/
415+
~/.local/share/fonts/TTF/
416+
~/.ssh/
417+
~/.themes/
418+
~/.vscode-oss/
419+
~/Pictures/Backgrounds/
420+
~/Pictures/Screenshots/
412421
)
413422
for mk_dir in "${mk_dirs[@]}"; do
414423
mkdir -p "${mk_dir}"
@@ -439,10 +448,9 @@ cp -v "$data_path"/gpg/gpg-agent.conf "$base_path"/gpg/.gnupg/gpg-agent.conf ||
439448
echo "failed to copy gpg-agent.conf from data dir"
440449
exit 1
441450
}
442-
echo "pinentry-program $HOME/.local/bin/pinentry-auto" | tee -a "$HOME"/.gnupg/gpg-agent.conf
451+
echo "pinentry-program $HOME/.local/bin/pinentry-auto" | tee -a "$base_path"/gpg/.gnupg/gpg-agent.conf
443452

444453
declare -a stow_dirs_setup=(
445-
stow
446454
bash
447455
git
448456
gpg

0 commit comments

Comments
 (0)