- Added comprehensive configuration files for seamless migration - SSH, GPG, Karabiner, iTerm2, Neofetch, SwiftBar configs - Pass license management system with templates and documentation - Enhanced shell functions with MAS updates and moon phase tracking - Comprehensive encrypted backup system (GPG AES256) - Included encrypted backups of all sensitive data - BBEdit as default editor with proper configuration - Fixed shell compatibility issues - Merged existing .zsh configs with improvements Security: - All sensitive data is GPG encrypted (.gpg files) - Private keys excluded from version control - Only configs and encrypted backups are tracked Following prime directive: durable, thoughtful solutions 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
121 lines
3.7 KiB
Bash
Executable File
121 lines
3.7 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Symlink dotfiles to home directory
|
|
|
|
set -euo pipefail
|
|
|
|
DOTFILES_DIR="$HOME/dotfiles"
|
|
|
|
# Colors
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[1;33m'
|
|
RED='\033[0;31m'
|
|
BLUE='\033[0;34m'
|
|
NC='\033[0m'
|
|
|
|
echo -e "${BLUE}Creating symlinks for dotfiles...${NC}"
|
|
|
|
# Function to create symlink with backup
|
|
link_file() {
|
|
local source="$1"
|
|
local target="$2"
|
|
local backup_dir="$HOME/.dotfiles-backup/$(date +%Y%m%d_%H%M%S)"
|
|
|
|
# Create target directory if it doesn't exist
|
|
mkdir -p "$(dirname "$target")"
|
|
|
|
# If target exists and is not a symlink, back it up
|
|
if [ -e "$target" ] && [ ! -L "$target" ]; then
|
|
echo -e "${YELLOW}Backing up existing $target${NC}"
|
|
mkdir -p "$backup_dir"
|
|
mv "$target" "$backup_dir/"
|
|
fi
|
|
|
|
# Remove existing symlink
|
|
[ -L "$target" ] && rm "$target"
|
|
|
|
# Create new symlink
|
|
ln -sf "$source" "$target"
|
|
echo -e "${GREEN}✓ Linked: $target -> $source${NC}"
|
|
}
|
|
|
|
# Shell configurations
|
|
echo -e "${YELLOW}Linking shell configurations...${NC}"
|
|
link_file "$DOTFILES_DIR/shell/.zshrc" "$HOME/.zshrc"
|
|
link_file "$DOTFILES_DIR/shell/.bashrc" "$HOME/.bashrc"
|
|
link_file "$DOTFILES_DIR/shell/.zprofile" "$HOME/.zprofile"
|
|
link_file "$DOTFILES_DIR/shell/.p10k.zsh" "$HOME/.p10k.zsh"
|
|
link_file "$DOTFILES_DIR/shell/.fzf.bash" "$HOME/.fzf.bash"
|
|
link_file "$DOTFILES_DIR/shell/.fzf.zsh" "$HOME/.fzf.zsh"
|
|
link_file "$DOTFILES_DIR/.gitconfig" "$HOME/.gitconfig"
|
|
link_file "$DOTFILES_DIR/.vimrc" "$HOME/.vimrc"
|
|
link_file "$DOTFILES_DIR/.npmrc" "$HOME/.npmrc"
|
|
|
|
# Link plugin manifest
|
|
link_file "$DOTFILES_DIR/shell/.zsh-plugins.txt" "$HOME/.zsh-plugins.txt"
|
|
|
|
# SSH config
|
|
echo -e "${YELLOW}Setting up SSH configuration...${NC}"
|
|
if [ -f "$DOTFILES_DIR/ssh/config" ]; then
|
|
mkdir -p "$HOME/.ssh"
|
|
link_file "$DOTFILES_DIR/ssh/config" "$HOME/.ssh/config"
|
|
chmod 600 "$HOME/.ssh/config"
|
|
fi
|
|
|
|
# GPG configuration
|
|
echo -e "${YELLOW}Setting up GPG configuration...${NC}"
|
|
if [ -d "$DOTFILES_DIR/gnupg" ]; then
|
|
mkdir -p "$HOME/.gnupg"
|
|
chmod 700 "$HOME/.gnupg"
|
|
for gpg_file in gpg.conf gpg-agent.conf dirmngr.conf; do
|
|
if [ -f "$DOTFILES_DIR/gnupg/$gpg_file" ]; then
|
|
link_file "$DOTFILES_DIR/gnupg/$gpg_file" "$HOME/.gnupg/$gpg_file"
|
|
chmod 600 "$HOME/.gnupg/$gpg_file"
|
|
fi
|
|
done
|
|
fi
|
|
|
|
# Config directories
|
|
echo -e "${YELLOW}Linking config directories...${NC}"
|
|
mkdir -p "$HOME/.config"
|
|
|
|
# Link config subdirectories if they exist
|
|
for config_dir in git iterm2 kitty karabiner neofetch swiftbar; do
|
|
if [ -d "$DOTFILES_DIR/config/$config_dir" ]; then
|
|
link_file "$DOTFILES_DIR/config/$config_dir" "$HOME/.config/$config_dir"
|
|
fi
|
|
done
|
|
|
|
# Custom scripts
|
|
echo -e "${YELLOW}Linking custom scripts...${NC}"
|
|
mkdir -p "$HOME/bin"
|
|
if [ -d "$DOTFILES_DIR/bin" ]; then
|
|
for script in "$DOTFILES_DIR/bin"/*; do
|
|
if [ -f "$script" ] && [ -x "$script" ]; then
|
|
script_name=$(basename "$script")
|
|
link_file "$script" "$HOME/bin/$script_name"
|
|
fi
|
|
done
|
|
fi
|
|
|
|
# Git hooks
|
|
echo -e "${YELLOW}Setting up global git hooks...${NC}"
|
|
if [ -d "$DOTFILES_DIR/git/hooks" ]; then
|
|
git config --global core.hooksPath "$DOTFILES_DIR/git/hooks"
|
|
echo -e "${GREEN}✓ Global git hooks configured${NC}"
|
|
fi
|
|
|
|
# Mackup configuration
|
|
if [ -f "$DOTFILES_DIR/.mackup.cfg" ]; then
|
|
link_file "$DOTFILES_DIR/.mackup.cfg" "$HOME/.mackup.cfg"
|
|
fi
|
|
|
|
# Shell enhancements are now integrated into the main .zshrc
|
|
echo -e "${GREEN}✓ Shell enhancements integrated into main configuration${NC}"
|
|
|
|
echo ""
|
|
echo -e "${GREEN}Symlinks created successfully! 🔗${NC}"
|
|
echo ""
|
|
echo -e "${YELLOW}Next steps:${NC}"
|
|
echo "1. Edit ~/.ssh/config with your actual values"
|
|
echo "2. Restart your shell or run: source ~/.zshrc"
|
|
echo "3. Review and customize any linked configurations" |