diff --git a/backport-noble.sh b/backport-noble.sh index f3ead15..ac7251a 100755 --- a/backport-noble.sh +++ b/backport-noble.sh @@ -86,12 +86,39 @@ run_in_vm() { if ! command_exists virsh; then echo -e "${RED}Error: virsh is not installed. Please install libvirt-clients first.${NC}" + echo "On Bazzite, try: ujust install libvirt-clients" exit 1 fi + # Check for virt-install (may not be available on immutable distros) if ! command_exists virt-install; then - echo -e "${RED}Error: virt-install is not installed. Please install virt-install first.${NC}" - exit 1 + echo -e "${YELLOW}Warning: virt-install not found. This is common on immutable distros like Bazzite.${NC}" + echo "" + echo "Alternative VM creation methods:" + echo "1. Use virt-manager (Flatpak) - GUI interface" + echo "2. Use virt-install via toolbox/distrobox" + echo "3. Use Podman containers instead (recommended)" + echo "" + echo "For virt-manager (Flatpak):" + echo " flatpak run org.virt_manager.virt-manager" + echo "" + echo "For toolbox/distrobox with virt-install:" + echo " toolbox create --distro fedora" + echo " toolbox enter" + echo " sudo dnf install virt-install" + echo "" + echo "For Podman container (recommended):" + echo " $0 --podman" + echo "" + read -p "Would you like to try Podman container instead? (Y/n): " -n 1 -r + echo + if [[ ! $REPLY =~ ^[Nn]$ ]]; then + echo "Switching to Podman container..." + run_in_podman + return + else + echo "Continuing with VM setup..." + fi fi echo "Creating Ubuntu Noble VM..." @@ -104,18 +131,43 @@ run_in_vm() { else echo "Creating new VM: $VM_NAME" - # Create VM with Ubuntu Noble - virt-install \ - --name "$VM_NAME" \ - --memory 4096 \ - --vcpus 2 \ - --disk size=20 \ - --network default \ - --os-variant ubuntu24.04 \ - --location http://archive.ubuntu.com/ubuntu/dists/noble/main/installer-amd64/ \ - --extra-args "console=ttyS0,115200n8 serial" \ - --graphics none \ - --noautoconsole + # Try to create VM with virt-install if available + if command_exists virt-install; then + # Create VM with Ubuntu Noble + virt-install \ + --name "$VM_NAME" \ + --memory 4096 \ + --vcpus 2 \ + --disk size=20 \ + --network default \ + --os-variant ubuntu24.04 \ + --location http://archive.ubuntu.com/ubuntu/dists/noble/main/installer-amd64/ \ + --extra-args "console=ttyS0,115200n8 serial" \ + --graphics none \ + --noautoconsole + else + echo -e "${YELLOW}virt-install not available. Please create VM manually:${NC}" + echo "" + echo "1. Open virt-manager (Flatpak):" + echo " flatpak run org.virt_manager.virt-manager" + echo "" + echo "2. Create new VM with these settings:" + echo " - Name: $VM_NAME" + echo " - Memory: 4096 MB" + echo " - CPUs: 2" + echo " - Disk: 20 GB" + echo " - OS: Ubuntu 24.04 (Noble Numbat)" + echo " - Network: Default" + echo "" + echo "3. Once VM is created and running, connect to it and run:" + echo " git clone https://git.raines.xyz/robojerk/libostree-dev.git" + echo " cd libostree-dev" + echo " ./backport-noble.sh" + echo "" + echo "Alternatively, use Podman container:" + echo " $0 --podman" + return + fi echo -e "${GREEN}VM created successfully. You can connect to it with:${NC}" echo "virsh console $VM_NAME" diff --git a/backport-trixie.sh b/backport-trixie.sh index 14c2d3f..31c67dc 100755 --- a/backport-trixie.sh +++ b/backport-trixie.sh @@ -86,12 +86,39 @@ run_in_vm() { if ! command_exists virsh; then echo -e "${RED}Error: virsh is not installed. Please install libvirt-clients first.${NC}" + echo "On Bazzite, try: ujust install libvirt-clients" exit 1 fi + # Check for virt-install (may not be available on immutable distros) if ! command_exists virt-install; then - echo -e "${RED}Error: virt-install is not installed. Please install virt-install first.${NC}" - exit 1 + echo -e "${YELLOW}Warning: virt-install not found. This is common on immutable distros like Bazzite.${NC}" + echo "" + echo "Alternative VM creation methods:" + echo "1. Use virt-manager (Flatpak) - GUI interface" + echo "2. Use virt-install via toolbox/distrobox" + echo "3. Use Podman containers instead (recommended)" + echo "" + echo "For virt-manager (Flatpak):" + echo " flatpak run org.virt_manager.virt-manager" + echo "" + echo "For toolbox/distrobox with virt-install:" + echo " toolbox create --distro fedora" + echo " toolbox enter" + echo " sudo dnf install virt-install" + echo "" + echo "For Podman container (recommended):" + echo " $0 --podman" + echo "" + read -p "Would you like to try Podman container instead? (Y/n): " -n 1 -r + echo + if [[ ! $REPLY =~ ^[Nn]$ ]]; then + echo "Switching to Podman container..." + run_in_podman + return + else + echo "Continuing with VM setup..." + fi fi echo "Creating Debian Trixie VM..." @@ -104,18 +131,43 @@ run_in_vm() { else echo "Creating new VM: $VM_NAME" - # Create VM with Debian Trixie - virt-install \ - --name "$VM_NAME" \ - --memory 4096 \ - --vcpus 2 \ - --disk size=20 \ - --network default \ - --os-variant debian12 \ - --location http://deb.debian.org/debian/dists/bookworm/main/installer-amd64/ \ - --extra-args "console=ttyS0,115200n8 serial" \ - --graphics none \ - --noautoconsole + # Try to create VM with virt-install if available + if command_exists virt-install; then + # Create VM with Debian Trixie + virt-install \ + --name "$VM_NAME" \ + --memory 4096 \ + --vcpus 2 \ + --disk size=20 \ + --network default \ + --os-variant debian12 \ + --location http://deb.debian.org/debian/dists/bookworm/main/installer-amd64/ \ + --extra-args "console=ttyS0,115200n8 serial" \ + --graphics none \ + --noautoconsole + else + echo -e "${YELLOW}virt-install not available. Please create VM manually:${NC}" + echo "" + echo "1. Open virt-manager (Flatpak):" + echo " flatpak run org.virt_manager.virt-manager" + echo "" + echo "2. Create new VM with these settings:" + echo " - Name: $VM_NAME" + echo " - Memory: 4096 MB" + echo " - CPUs: 2" + echo " - Disk: 20 GB" + echo " - OS: Debian 12 (Bookworm)" + echo " - Network: Default" + echo "" + echo "3. Once VM is created and running, connect to it and run:" + echo " git clone https://git.raines.xyz/robojerk/libostree-dev.git" + echo " cd libostree-dev" + echo " ./backport-trixie.sh" + echo "" + echo "Alternatively, use Podman container:" + echo " $0 --podman" + return + fi echo -e "${GREEN}VM created successfully. You can connect to it with:${NC}" echo "virsh console $VM_NAME" diff --git a/usage-guide.sh b/usage-guide.sh index 0c94f44..a201708 100755 --- a/usage-guide.sh +++ b/usage-guide.sh @@ -45,6 +45,12 @@ echo " • --vm: Run in isolated VM with virsh (full isolation)" echo " • --help: Show usage information and safety warnings" echo " • Interactive prompts for direct host execution" echo "" +echo "📋 Bazzite/Immutable Distro Notes:" +echo " • virt-manager is installed as Flatpak" +echo " • virt-install may not be available by default" +echo " • Podman containers are recommended for testing" +echo " • Use 'ujust install libvirt-clients' if needed" +echo "" echo "⚠️ Safety Notes:" echo " • Test in a VM first" @@ -80,4 +86,17 @@ echo "" echo "🔄 Rollback:" echo " sudo apt install --reinstall libostree-dev libostree-1-1 ostree" -echo " # Reinstall original packages from distribution repositories" \ No newline at end of file +echo " # Reinstall original packages from distribution repositories" +echo "" +echo "🔧 Bazzite VM Creation:" +echo " # Option 1: Use virt-manager (Flatpak)" +echo " flatpak run org.virt_manager.virt-manager" +echo "" +echo " # Option 2: Use toolbox for virt-install" +echo " toolbox create --distro fedora" +echo " toolbox enter" +echo " sudo dnf install virt-install" +echo "" +echo " # Option 3: Use Podman containers (recommended)" +echo " ./backport-noble.sh --podman" +echo " ./backport-trixie.sh --podman" \ No newline at end of file