#!/bin/bash set -e echo "=== Installing MHVTL Kernel Module ===" # Check if running as root if [ "$EUID" -ne 0 ]; then echo "Error: This script must be run as root" exit 1 fi # Check Ubuntu version if ! grep -q "24.04" /etc/os-release; then echo "Warning: This script is designed for Ubuntu 24.04" echo "Your version: $(lsb_release -d | cut -f2)" read -p "Continue anyway? (y/n) " -n 1 -r echo if [[ ! $REPLY =~ ^[Yy]$ ]]; then exit 1 fi fi # Install dependencies echo "Installing dependencies..." apt-get update -qq apt-get install -y linux-headers-$(uname -r) build-essential git lsscsi sg3-utils # Download MHVTL source echo "Downloading MHVTL source..." cd /tmp rm -rf mhvtl git clone https://github.com/markh794/mhvtl.git cd mhvtl/kernel # Compile kernel module echo "Compiling kernel module..." make # Check if compilation succeeded if [ ! -f mhvtl.ko ]; then echo "Error: Kernel module compilation failed" exit 1 fi echo "Kernel module compiled successfully ($(du -h mhvtl.ko | cut -f1))" # Install kernel module echo "Installing kernel module..." make install # Update module dependencies echo "Updating module dependencies..." depmod -a # Load module echo "Loading mhvtl module..." modprobe mhvtl # Verify module is loaded if lsmod | grep -q mhvtl; then echo "✓ mhvtl module loaded successfully" else echo "Error: Failed to load mhvtl module" exit 1 fi # Configure auto-load on boot echo "Configuring auto-load on boot..." echo "mhvtl" > /etc/modules-load.d/mhvtl.conf # Cleanup cd / rm -rf /tmp/mhvtl echo "" echo "=== MHVTL Kernel Module Installation Complete ===" echo "Module: mhvtl" echo "Status: Loaded" echo "Auto-load: Enabled" echo "" echo "You can now start MHVTL service:" echo " systemctl start mhvtl" echo ""