feat: Update setup to correctly copy dotfiles

This commit is contained in:
2025-03-28 14:13:31 +11:00
parent 15cc10f547
commit acf133adca
2 changed files with 27 additions and 75 deletions

View File

@@ -24,25 +24,6 @@ create_symlinks() {
echo "Linking directory: $src_dir/.zsh_functions -> $target_zsh_functions"
ln -s "$src_dir/.zsh_functions" "$target_zsh_functions"
fi
# Handle .config/alacritty/themes directory specially - link the whole directory
if [ -d "$src_dir/.config/alacritty/themes" ]; then
local target_alacritty_themes="$target_dir/.config/alacritty/themes"
# Remove existing directory or symlink if it exists
if [ -e "$target_alacritty_themes" ] || [ -L "$target_alacritty_themes" ]; then
echo "Removing existing: $target_alacritty_themes"
rm -rf "$target_alacritty_themes"
fi
# Ensure .config/alacritty directory exists
mkdir -p "$target_dir/.config/alacritty"
# Create symlink for the entire directory
echo "Linking directory: $src_dir/.config/alacritty/themes -> $target_alacritty_themes"
ln -s "$src_dir/.config/alacritty/themes" "$target_alacritty_themes"
fi
# Find all files and directories in the source directory, excluding .git, README.md, and .zsh_functions
find "$src_dir" \( -not -path "*/\.git*" -and -not -name "README.md" -and -not -path "*/.zsh_functions/*" -and -not -path "*/.zsh_functions" \) -and \( -type f -o -type l \) | while read -r src_file; do
@@ -65,8 +46,33 @@ create_symlinks() {
echo "Linking: $src_file -> $target_file"
ln -s "$src_file" "$target_file"
done
# Handle .config/alacritty/themes directory specially - link the whole directory
if [ -d "$src_dir/.config/alacritty/themes" ]; then
local target_alacritty_themes="$target_dir/.config/alacritty/themes"
# Remove existing directory or symlink if it exists
if [ -e "$target_alacritty_themes" ] || [ -L "$target_alacritty_themes" ]; then
echo "Removing existing: $target_alacritty_themes"
rm -rf "$target_alacritty_themes"
fi
# Ensure .config/alacritty directory exists
mkdir -p "$target_dir/.config/alacritty"
# Make sure to pull latest changes from the repo submodules
git submodule update --init --recursive
# Create symlink for the entire directory
echo "Linking directory: $src_dir/.config/alacritty/themes -> $target_alacritty_themes"
ln -s "$src_dir/.config/alacritty/themes" "$target_alacritty_themes"
fi
}
# Call the function to create symlinks from dotfiles to home
create_symlinks "$HOME/.dotfiles" "$HOME"