dev: automated commit - 2025-06-02 11:26:41
This commit is contained in:
parent
02d5fd75c9
commit
c4cb841897
1 changed files with 0 additions and 0 deletions
151
runs/forbi
151
runs/forbi
|
@ -1,151 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
# NAME: Setup dotfiles and Neovim configuration
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
DOTFILES_REPO="https://git.mz.uy/marianozunino/dotfiles.git"
|
||||
NVIM_REPO="https://github.com/marianozunino/nvim.git"
|
||||
DOTFILES_DIR="$HOME/dotfiles"
|
||||
NVIM_CONFIG_DIR="$HOME/.config/nvim"
|
||||
|
||||
echo "🏠 Setting up Forbi's development environment..."
|
||||
|
||||
# ═══════════════════════════════════════════════════════════
|
||||
# 📁 CLONE DOTFILES
|
||||
# ═══════════════════════════════════════════════════════════
|
||||
echo "📦 Cloning dotfiles repository..."
|
||||
|
||||
if [[ -d "$DOTFILES_DIR" ]]; then
|
||||
echo "→ Dotfiles directory already exists, updating..."
|
||||
cd "$DOTFILES_DIR"
|
||||
git pull origin main || git pull origin master
|
||||
else
|
||||
echo "→ Cloning dotfiles to $DOTFILES_DIR"
|
||||
git clone "$DOTFILES_REPO" "$DOTFILES_DIR"
|
||||
fi
|
||||
|
||||
# ═══════════════════════════════════════════════════════════
|
||||
# 🔐 HANDLE GIT-CRYPT
|
||||
# ═══════════════════════════════════════════════════════════
|
||||
echo "🔐 Checking for git-crypt..."
|
||||
|
||||
cd "$DOTFILES_DIR"
|
||||
|
||||
# Check if repo uses git-crypt
|
||||
if [[ -f ".git-crypt/.gitattributes" ]] || git-crypt status &>/dev/null; then
|
||||
echo "→ git-crypt repository detected"
|
||||
|
||||
# Check if already unlocked
|
||||
if git-crypt status | grep -q "unlocked"; then
|
||||
echo "→ Repository already unlocked"
|
||||
else
|
||||
echo "→ Repository is encrypted, attempting to unlock..."
|
||||
|
||||
# Check if YubiKey/GPG setup is available
|
||||
if command -v gpg &>/dev/null; then
|
||||
echo "→ GPG found, checking for available keys..."
|
||||
|
||||
# List secret keys to see if YubiKey is connected
|
||||
if gpg --list-secret-keys &>/dev/null; then
|
||||
echo "→ GPG keys detected, attempting git-crypt unlock..."
|
||||
|
||||
# Attempt to unlock with GPG (YubiKey)
|
||||
if git-crypt unlock 2>/dev/null; then
|
||||
echo "✅ Repository unlocked successfully with GPG/YubiKey!"
|
||||
else
|
||||
echo "❌ Failed to unlock with GPG"
|
||||
echo
|
||||
echo "🔑 Manual unlock required:"
|
||||
echo " 1. Make sure your YubiKey is connected"
|
||||
echo " 2. Test GPG: gpg --card-status"
|
||||
echo " 3. Try: cd $DOTFILES_DIR && git-crypt unlock"
|
||||
echo " 4. Or unlock with key file: git-crypt unlock /path/to/key"
|
||||
echo " 5. Then re-run: ./run forbi"
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "❌ No GPG secret keys found"
|
||||
echo
|
||||
echo "🔑 YubiKey/GPG setup needed:"
|
||||
echo " 1. Connect your YubiKey"
|
||||
echo " 2. Import your GPG key: gpg --card-status"
|
||||
echo " 3. Set trust level: gpg --edit-key <your-key-id> trust"
|
||||
echo " 4. Then re-run: ./run forbi"
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "❌ GPG not available"
|
||||
echo
|
||||
echo "🔑 To unlock your dotfiles:"
|
||||
echo " 1. Install GPG and connect YubiKey, or"
|
||||
echo " 2. Use key file: cd $DOTFILES_DIR && git-crypt unlock /path/to/key"
|
||||
echo " 3. Then re-run: ./run forbi"
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo "→ No git-crypt encryption detected"
|
||||
fi
|
||||
|
||||
# ═══════════════════════════════════════════════════════════
|
||||
# ⚙️ CLONE NEOVIM CONFIG
|
||||
# ═══════════════════════════════════════════════════════════
|
||||
echo "📝 Setting up Neovim configuration..."
|
||||
|
||||
# Backup existing Neovim config if it exists
|
||||
if [[ -d "$NVIM_CONFIG_DIR" ]]; then
|
||||
BACKUP_DIR="$NVIM_CONFIG_DIR.backup.$(date +%Y%m%d_%H%M%S)"
|
||||
echo "→ Backing up existing Neovim config to $BACKUP_DIR"
|
||||
mv "$NVIM_CONFIG_DIR" "$BACKUP_DIR"
|
||||
fi
|
||||
|
||||
# Clone Neovim configuration
|
||||
echo "→ Cloning Neovim config to $NVIM_CONFIG_DIR"
|
||||
git clone "$NVIM_REPO" "$NVIM_CONFIG_DIR"
|
||||
|
||||
# ═══════════════════════════════════════════════════════════
|
||||
# 🔧 CONFIGURE GIT HOOKS
|
||||
# ═══════════════════════════════════════════════════════════
|
||||
echo "🎣 Setting up Git hooks for Neovim config..."
|
||||
|
||||
cd "$NVIM_CONFIG_DIR"
|
||||
if [[ -d ".githooks" ]]; then
|
||||
git config core.hooksPath .githooks
|
||||
echo "→ Git hooks configured"
|
||||
else
|
||||
echo "→ No .githooks directory found, skipping"
|
||||
fi
|
||||
|
||||
# ═══════════════════════════════════════════════════════════
|
||||
# 📂 CREATE NECESSARY DIRECTORIES
|
||||
# ═══════════════════════════════════════════════════════════
|
||||
echo "📂 Creating necessary directories..."
|
||||
|
||||
# Create .config directory if it doesn't exist
|
||||
mkdir -p "$HOME/.config"
|
||||
|
||||
# Create common development directories
|
||||
mkdir -p "$HOME/Dev"
|
||||
mkdir -p "$HOME/.local/bin"
|
||||
|
||||
echo
|
||||
echo "# Install everything"
|
||||
echo "stow */"
|
||||
echo
|
||||
echo "# Or install individual modules"
|
||||
echo "stow zsh"
|
||||
echo "stow nvim"
|
||||
echo "stow sway"
|
||||
echo
|
||||
echo "Run these commands in: $DOTFILES_DIR"
|
||||
|
||||
# ═══════════════════════════════════════════════════════════
|
||||
# 📋 SUMMARY & NEXT STEPS
|
||||
# ═══════════════════════════════════════════════════════════
|
||||
echo
|
||||
echo "📁 Locations:"
|
||||
echo " • Dotfiles: $DOTFILES_DIR"
|
||||
echo " • Neovim config: $NVIM_CONFIG_DIR"
|
Loading…
Add table
Add a link
Reference in a new issue