🖖 Features: - Master 'engage' script for one-command setup - 120+ CLI tools via Homebrew - 40+ Applications (casks + MAS apps) - Complete macOS system configuration - Security hardening and privacy settings - Obsidian knowledge vault setup - Comprehensive backup strategies - Automated symlink management Live long and prosper\! 🚀 🤖 Generated with Claude Code (https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
59 lines
1.8 KiB
Bash
Executable File
59 lines
1.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Backup script for sensitive dotfiles
|
|
# This handles files that shouldn't be stored directly in git
|
|
|
|
set -euo pipefail
|
|
|
|
DOTFILES_DIR="$HOME/dotfiles"
|
|
BACKUP_DIR="$DOTFILES_DIR/backups"
|
|
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
|
|
|
|
# Colors for output
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[1;33m'
|
|
NC='\033[0m' # No Color
|
|
|
|
echo -e "${GREEN}Starting sensitive files backup...${NC}"
|
|
|
|
# Create backup directory
|
|
mkdir -p "$BACKUP_DIR"
|
|
|
|
# Function to backup a file/directory with encryption
|
|
backup_encrypted() {
|
|
local source="$1"
|
|
local name="$2"
|
|
|
|
if [ -e "$source" ]; then
|
|
echo -e "${YELLOW}Backing up $name...${NC}"
|
|
tar -czf - "$source" | gpg --symmetric --cipher-algo AES256 -o "$BACKUP_DIR/${name}_${TIMESTAMP}.tar.gz.gpg"
|
|
echo -e "${GREEN}✓ $name backed up and encrypted${NC}"
|
|
else
|
|
echo -e "${RED}✗ $source not found${NC}"
|
|
fi
|
|
}
|
|
|
|
# Backup SSH keys and config (encrypted)
|
|
backup_encrypted "$HOME/.ssh" "ssh"
|
|
|
|
# Backup shell history
|
|
cp "$HOME/.zsh_history" "$BACKUP_DIR/zsh_history_${TIMESTAMP}"
|
|
echo -e "${GREEN}✓ Shell history backed up${NC}"
|
|
|
|
# Create a sanitized SSH config for git
|
|
if [ -f "$HOME/.ssh/config" ]; then
|
|
echo -e "${YELLOW}Creating sanitized SSH config...${NC}"
|
|
# Remove sensitive host details but keep structure
|
|
sed -E 's/(HostName|User|IdentityFile) .*/\1 <REDACTED>/' "$HOME/.ssh/config" > "$DOTFILES_DIR/ssh/config.example"
|
|
echo -e "${GREEN}✓ SSH config template created${NC}"
|
|
fi
|
|
|
|
# List what needs manual backup
|
|
echo -e "\n${YELLOW}Remember to manually backup:${NC}"
|
|
echo "- Any private keys stored outside ~/.ssh"
|
|
echo "- Any credentials in ~/.aws, ~/.gcloud, etc."
|
|
echo "- Application-specific secrets"
|
|
|
|
echo -e "\n${GREEN}Backup complete!${NC}"
|
|
echo -e "Encrypted backups stored in: $BACKUP_DIR"
|
|
echo -e "To decrypt: gpg -d file.tar.gz.gpg | tar -xzf -" |