if ! whiptail --title "Coral TPU Installation" --yesno "Installing Coral TPU drivers requires rebooting the server after installation. Do you want to proceed?"8 60;then
echo -ne "\r${TAB}${YW}-$(translate 'Installation cancelled by user. Exiting.')${CL}"
exit0
fi
}
# Verificar y configurar repositorios en el host
verify_and_add_repos(){
msg_info "Configuring necessary repositories on the host..."
sleep 2
if ! grep -q "pve-no-subscription" /etc/apt/sources.list /etc/apt/sources.list.d/* 2>/dev/null;then
echo"deb http://download.proxmox.com/debian/pve $(lsb_release -sc) pve-no-subscription"| tee /etc/apt/sources.list.d/pve-no-subscription.list
msg_ok "Repositorio pve-no-subscription añadido."
fi
if ! grep -q "non-free-firmware" /etc/apt/sources.list;then
echo"deb http://deb.debian.org/debian $(lsb_release -sc) main contrib non-free-firmware
deb http://deb.debian.org/debian $(lsb_release -sc)-updates main contrib non-free-firmware
deb http://security.debian.org/debian-security $(lsb_release -sc)-security main contrib non-free-firmware" | tee -a /etc/apt/sources.list
msg_ok "Repositorios non-free-firmware añadidos."
fi
msg_ok "Added repositories"
sleep 2
msg_info "Verifying repositories..."
apt-get update &>/dev/null
msg_ok "Verified and updated repositories."
}
# Function to install Coral TPU drivers on the host
msg_error "Error: Could not clone the repository."
exit1
fi
cd gasket-driver/
debuild -us -uc -tc -b
if[$? -ne 0];then
msg_error "Error: Failed to build driver packages."
exit1
fi
dpkg -i ../gasket-dkms_*.deb
if[$? -ne 0];then
msg_error "Error: Failed to install the driver packages."
exit1
fi
msg_ok "Coral TPU drivers installed successfully on the host."
}
# Prompt for reboot after installation
restart_prompt(){
if whiptail --title "Coral TPU Installation" --yesno "The installation requires a server restart to apply changes. Do you want to restart now?"8 60;then
echo -ne "\r${TAB}${YW}-$(translate 'Restarting the server...')${CL}"