Files
backup_to_external_m.2/old_scripts/check_packages.sh
root 56c07dbe49 Complete rewrite: Single working LVM block-level backup script
- Removed 40+ broken/messy scripts, moved to old_scripts/
- Created lvm_block_backup.sh - proper block-level LVM snapshot backup
- Uses dd for block-level cloning instead of file-level rsync
- Successfully tested: 462GB backup in 33 minutes
- Creates exact, bootable clone of internal drive to external drive
- Proper LVM snapshot management with cleanup
- Clear documentation in README_BACKUP.md
- Clean, minimal solution that actually works
2025-09-30 17:35:22 +02:00

92 lines
2.5 KiB
Bash
Executable File

#!/bin/bash
# Package Availability Checker for Live Systems
# Checks what packages are available before attempting installation
set -e
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m'
log() { echo -e "${BLUE}[INFO]${NC} $1"; }
success() { echo -e "${GREEN}[FOUND]${NC} $1"; }
warning() { echo -e "${YELLOW}[MISSING]${NC} $1"; }
echo -e "${GREEN}=== Package Availability Checker ===${NC}"
echo "Checking package availability for LVM migration..."
echo
# Detect distribution
if [ -f /etc/os-release ]; then
. /etc/os-release
echo "Distribution: $PRETTY_NAME"
echo "ID: $ID"
echo "Version: $VERSION_ID"
echo
fi
# Function to check if a package exists in repositories
check_package() {
local pkg="$1"
if apt-cache show "$pkg" >/dev/null 2>&1; then
success "$pkg"
return 0
else
warning "$pkg"
return 1
fi
}
# Function to check multiple package alternatives
check_alternatives() {
local desc="$1"
shift
local packages=("$@")
echo -e "${BLUE}$desc:${NC}"
local found=0
for pkg in "${packages[@]}"; do
if check_package "$pkg"; then
((found++))
fi
done
if [ $found -eq 0 ]; then
echo -e " ${RED}⚠ No packages found for $desc${NC}"
fi
echo
}
echo "Updating package cache..."
apt update >/dev/null 2>&1 || warning "Could not update package cache"
echo
# Check critical packages
total_missing=0
check_alternatives "LVM Tools" "lvm2" "lvm"
check_alternatives "Device Mapper" "dmsetup" "device-mapper"
check_alternatives "Cryptsetup" "cryptsetup" "cryptsetup-bin"
check_alternatives "Filesystem Tools" "e2fsprogs" "dosfstools" "parted"
check_alternatives "Backup Tools" "rsync" "pv"
check_alternatives "GRUB EFI" "grub-efi-amd64" "grub-efi" "grub-efi-amd64-bin"
check_alternatives "GRUB PC" "grub-pc-bin" "grub-pc"
check_alternatives "GRUB Common" "grub-common" "grub2-common"
check_alternatives "Initramfs" "initramfs-tools" "dracut"
check_alternatives "System Tools" "util-linux" "coreutils" "bc"
echo -e "${BLUE}=== Summary ===${NC}"
echo -e "${GREEN}✓ Package availability checked${NC}"
echo "Most packages should be available for installation."
echo
echo "To install packages, run:"
echo " sudo ./emergency_install.sh"
echo
echo "To check individual commands after installation:"
echo " command -v lvm && echo 'LVM available'"
echo " command -v cryptsetup && echo 'Cryptsetup available'"
echo " command -v grub-install && echo 'GRUB available'"