#!/bin/bash # LVM Migration Launcher Script # Run this after booting from the USB stick set -e # Colors for output RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[1;33m' BLUE='\033[0;34m' NC='\033[0m' # No Color SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" TOOLS_DIR="$SCRIPT_DIR/lvm-migration-tools" echo -e "${GREEN}=== Complete LVM Migration System ===${NC}" echo "πŸš€ One-Button Migration with Automatic GRUB Repair!" echo echo "This USB stick contains:" echo "β€’ Debian live system (bootable)" echo "β€’ Complete LVM migration toolkit with GRUB repair" echo "β€’ Interactive drive selection with user confirmation" echo "β€’ All necessary scripts and documentation" echo if [ ! -d "$TOOLS_DIR" ]; then echo -e "${RED}Error: Migration tools directory not found!${NC}" echo "Expected: $TOOLS_DIR" exit 1 fi cd "$TOOLS_DIR" echo -e "${BLUE}Available tools:${NC}" ls -la *.sh | grep -E "(prepare|migrate|validate|emergency|check)" | while read line; do echo " $line" done echo echo -e "${YELLOW}🎯 One-Button Migration Process:${NC}" echo "0. Check packages -> ./check_packages.sh (verify package availability)" echo "1. Emergency install -> ./emergency_install.sh (if packages missing)" echo "2. Prepare live system -> ./prepare_live_system.sh" echo "3. πŸš€ Complete Migration -> ./migrate_to_lvm.sh (EVERYTHING in one script!)" echo "4. Validate migration -> ./validate_lvm_migration.sh" echo echo -e "${GREEN}✨ INTEGRATED FEATURES:${NC}" echo "β€’ βœ… Interactive drive selection with safety confirmations" echo "β€’ βœ… Automatic LVM layout creation and data migration" echo "β€’ βœ… Built-in GRUB repair (no more boot reset loops!)" echo "β€’ βœ… Complete bootloader installation and configuration" echo "β€’ βœ… LVM snapshot backup system setup" echo "β€’ βœ… Everything automated in one script!" echo echo "For complete documentation: less LIVE_USB_MIGRATION_GUIDE.md" echo read -p "What would you like to do? [0=Check, 1=Emergency, 2=Prepare, 3=πŸš€Complete Migration, 4=Validate, d=Docs, s=Shell]: " choice case $choice in 0) echo -e "${BLUE}Checking package availability...${NC}" ./check_packages.sh ;; 1) echo -e "${BLUE}Running emergency package installer...${NC}" sudo ./emergency_install.sh ;; 2) echo -e "${BLUE}Preparing live system...${NC}" sudo ./prepare_live_system.sh ;; 3) echo -e "${GREEN}πŸš€ Starting Complete One-Button Migration...${NC}" echo "This will:" echo " βœ… Migrate your system to LVM" echo " βœ… Install and repair GRUB bootloader" echo " βœ… Configure boot system" echo " βœ… Set up snapshot backup system" echo " βœ… Everything automated!" echo sudo ./migrate_to_lvm.sh ;; 4) echo -e "${BLUE}Validating migration...${NC}" sudo ./validate_lvm_migration.sh ;; d) less LIVE_USB_MIGRATION_GUIDE.md ;; s) echo -e "${BLUE}Starting shell in tools directory...${NC}" cd "$TOOLS_DIR" bash ;; *) echo -e "${GREEN}Manual usage:${NC}" echo "cd $TOOLS_DIR" echo "sudo ./check_packages.sh # Check package availability" echo "sudo ./emergency_install.sh # If you see missing package errors" echo "sudo ./prepare_live_system.sh" echo "sudo ./migrate_to_lvm.sh # πŸš€ Complete one-button migration!" ;; esac