mirror of
https://github.com/stornic56/debianito-post-install.git
synced 2026-07-16 05:49:49 +00:00
Add files via upload
This commit is contained in:
+41
-22
@@ -1,34 +1,50 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
install_firmware() {
|
||||
local fw_pkgs=""
|
||||
echo -e "${YELLOW}Base firmware check...${NC}"
|
||||
|
||||
local fw_pkg="firmware-linux-nonfree"
|
||||
local fw_bpo
|
||||
fw_bpo=$(apt-cache madison firmware-linux-nonfree 2>/dev/null | \
|
||||
fw_bpo=$(apt-cache madison "$fw_pkg" 2>/dev/null | \
|
||||
grep "${DEBIAN_CODENAME}-backports" | awk '{print $3}' | head -1)
|
||||
if [ -n "$fw_bpo" ]; then
|
||||
local fw_stable
|
||||
fw_stable=$(apt-cache policy firmware-linux-nonfree 2>/dev/null | awk 'NR==3 {print $2; exit}')
|
||||
fw_pkgs=" - firmware-linux-nonfree ${fw_bpo} (backports) / ${fw_stable} (stable)\n"
|
||||
else
|
||||
local fw_ver
|
||||
fw_ver=$(apt-cache policy firmware-linux-nonfree 2>/dev/null | awk 'NR==3 {print $2; exit}')
|
||||
fw_pkgs=" - firmware-linux-nonfree ${fw_ver}\n"
|
||||
fi
|
||||
if ! _confirm "Base Firmware" "Install firmware?\n\n${fw_pkgs}"; then
|
||||
echo "Skipping base firmware."
|
||||
|
||||
local fw_stable
|
||||
fw_stable=$(apt-cache policy "$fw_pkg" 2>/dev/null | awk 'NR==3 {print $2; exit}')
|
||||
|
||||
if is_installed "$fw_pkg"; then
|
||||
if [ -n "$fw_bpo" ]; then
|
||||
local current_ver
|
||||
current_ver=$(dpkg -l "$fw_pkg" 2>/dev/null | awk '/^ii/{print $3}')
|
||||
if _confirm "Firmware" "firmware-linux-nonfree ${current_ver} already installed.\n\nUpgrade to backports version ${fw_bpo}?\n\nBackports often includes newer hardware support."; then
|
||||
_run_cmd "Firmware" "sudo apt install -y -t ${DEBIAN_CODENAME}-backports $fw_pkg" "Upgrading firmware..."
|
||||
fi
|
||||
else
|
||||
echo "$fw_pkg already installed."
|
||||
fi
|
||||
handle_wifi_firmware
|
||||
return
|
||||
fi
|
||||
|
||||
echo -e "${YELLOW}Installing base firmware...${NC}"
|
||||
local pkg="firmware-linux-nonfree"
|
||||
if [ "$(is_backports_enabled)" == true ] && [ -n "$fw_bpo" ]; then
|
||||
_run_cmd "Firmware" "sudo apt install -y -t ${DEBIAN_CODENAME}-backports $pkg" "Installing firmware from backports..."
|
||||
local msg="firmware-linux-nonfree provides hardware drivers for:\n"
|
||||
msg+=" WiFi, Bluetooth, GPU, audio, webcams, and more.\n\n"
|
||||
if [ -n "$fw_bpo" ]; then
|
||||
msg+=" Backports: ${fw_bpo} (newer, recommended)\n"
|
||||
msg+=" Stable: ${fw_stable}\n\n"
|
||||
msg+="Choose version:"
|
||||
if _confirm_custom "Firmware" "$msg" "Backports" "Stable"; then
|
||||
_run_cmd "Firmware" "sudo apt install -y -t ${DEBIAN_CODENAME}-backports $fw_pkg" "Installing firmware from backports..."
|
||||
else
|
||||
_run_cmd "Firmware" "sudo apt install -y $fw_pkg" "Installing firmware from stable..."
|
||||
fi
|
||||
else
|
||||
_run_cmd "Firmware" "sudo apt install -y $pkg" "Installing firmware..."
|
||||
msg+=" Version: ${fw_stable}\n\n"
|
||||
msg+="Install it?"
|
||||
if _confirm "Firmware" "$msg"; then
|
||||
_run_cmd "Firmware" "sudo apt install -y $fw_pkg" "Installing firmware..."
|
||||
fi
|
||||
fi
|
||||
|
||||
echo -e "${GREEN}Base firmware installed.${NC}"
|
||||
|
||||
handle_wifi_firmware
|
||||
}
|
||||
|
||||
@@ -55,11 +71,14 @@ handle_wifi_firmware() {
|
||||
device_id=$(echo "$broadcom_id" | cut -d: -f2)
|
||||
|
||||
if echo "$supported_ids" | grep -qw "$device_id"; then
|
||||
echo "Chipset supported by firmware-brcm80211. Installing..."
|
||||
_run_cmd "WiFi" "sudo apt install -y firmware-brcm80211" "Installing Broadcom firmware..."
|
||||
_run_install_pkg firmware-brcm80211
|
||||
else
|
||||
# Offer to install broadcom-sta-dkms for older chips
|
||||
if _confirm "Broadcom WiFi" "Install broadcom-sta-dkms?\n\nRequired for this Broadcom chipset.\nCompiles a kernel module (needs linux-headers)."; then
|
||||
local bcm_ver
|
||||
bcm_ver=$(apt-cache policy broadcom-sta-dkms 2>/dev/null | awk 'NR==3 {print $2; exit}')
|
||||
local header_ver
|
||||
header_ver=$(apt-cache policy linux-headers-$(uname -r) 2>/dev/null | awk 'NR==3 {print $2; exit}')
|
||||
if _confirm "Broadcom WiFi" "Install Broadcom driver?\n\nRequired for this chipset. Compiles a kernel module.\n\n broadcom-sta-dkms ${bcm_ver:-unknown}\n linux-headers-$(uname -r) ${header_ver:-unknown}\n\nProceed?"; then
|
||||
_run_cmd "Broadcom" "sudo apt install -y linux-headers-$(uname -r) broadcom-sta-dkms" "Installing Broadcom driver..."
|
||||
echo "Broadcom proprietary driver installed. A reboot may be required."
|
||||
else
|
||||
|
||||
+111
-35
@@ -1,12 +1,57 @@
|
||||
#!/usr/bin/env bash
|
||||
# Install gaming tools (Steam, gamemode, mangohud, etc.)
|
||||
# Gaming dispatcher — sources submodules and provides install_gaming()
|
||||
|
||||
_GAMING_DIR="${MODULES_DIR}/gaming"
|
||||
source "${_GAMING_DIR}/_helpers.sh"
|
||||
source "${_GAMING_DIR}/steam.sh"
|
||||
source "${_GAMING_DIR}/heroic.sh"
|
||||
source "${_GAMING_DIR}/tools.sh"
|
||||
|
||||
# Check if 'contrib' component is enabled; offer to add if missing
|
||||
ensure_contrib_repo() {
|
||||
local contrib_found=false
|
||||
|
||||
if [ -f /etc/apt/sources.list ]; then
|
||||
if grep -Eq '^[^#]*\bcontrib\b' /etc/apt/sources.list 2>/dev/null; then
|
||||
contrib_found=true
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! $contrib_found && [ -d /etc/apt/sources.list.d ]; then
|
||||
if grep -qr 'Components:.*\bcontrib\b' /etc/apt/sources.list.d/*.sources 2>/dev/null; then
|
||||
contrib_found=true
|
||||
fi
|
||||
fi
|
||||
|
||||
if $contrib_found; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
if _confirm "contrib Repository" "Component 'contrib' is required for Steam.\n\nAdd 'contrib' to your APT repositories?"; then
|
||||
if [ -f /etc/apt/sources.list ]; then
|
||||
sudo sed -i '/^deb / { /contrib/! s/main/main contrib/ }' /etc/apt/sources.list
|
||||
fi
|
||||
if [ -d /etc/apt/sources.list.d ]; then
|
||||
for f in /etc/apt/sources.list.d/*.sources; do
|
||||
[ -f "$f" ] || continue
|
||||
sudo sed -i '/^Components:/ { /contrib/! s/$/ contrib/ }' "$f"
|
||||
done
|
||||
fi
|
||||
sudo apt update
|
||||
echo -e "${GREEN}contrib repository enabled.${NC}"
|
||||
return 0
|
||||
fi
|
||||
|
||||
echo -e "${YELLOW}contrib repository not enabled. Steam installation may fail.${NC}"
|
||||
return 1
|
||||
}
|
||||
|
||||
install_gaming() {
|
||||
echo -e "${YELLOW}Gaming setup...${NC}"
|
||||
|
||||
# 1. 32-bit support prompt FIRST
|
||||
local enable_32bit=false
|
||||
if _confirm "32-bit Support" "Enable i386 for 32-bit games?\n\nRequired by Steam/Proton.\nInstalls matching 32-bit graphics drivers."; then
|
||||
if _confirm "32-bit Support" "Enable i386 architecture for 32-bit games?\n\nRequired by Steam/Proton for 32-bit games.\nInstalls matching 32-bit graphics drivers."; then
|
||||
enable_32bit=true
|
||||
fi
|
||||
|
||||
@@ -19,9 +64,59 @@ install_gaming() {
|
||||
|
||||
echo "Installing 32-bit graphics drivers..."
|
||||
if [ "$GPU_TYPE" = "nvidia" ]; then
|
||||
_run_cmd "32-bit" "sudo apt install -y nvidia-driver-libs:i386" "Installing 32-bit NVIDIA drivers..."
|
||||
case "${NVIDIA_DRIVER_MODE:-stable}" in
|
||||
cuda-repo)
|
||||
_msg "NVIDIA 32-bit" \
|
||||
"32-bit NVIDIA CUDA libraries already deployed.\n\nThe complete multiarch stack was installed\nwith the v590 driver from the official CUDA repo." 10 70
|
||||
;;
|
||||
backports)
|
||||
local nv32_pkg="nvidia-driver-libs:i386"
|
||||
local nv32_ver
|
||||
nv32_ver=$(apt-cache policy "$nv32_pkg" 2>/dev/null | awk 'NR==3 {print $2; exit}')
|
||||
local msg="Source: Debian ${DEBIAN_CODENAME^}-Backports\n"
|
||||
msg+="NVIDIA 32-bit Libraries ${nv32_ver:-unknown}\n\n"
|
||||
msg+="[+] nvidia-driver-libs:i386"
|
||||
if _confirm "NVIDIA 32-bit" "$msg" 12 70; then
|
||||
_run_cmd "32-bit NVIDIA" "sudo apt install -y -t ${DEBIAN_CODENAME}-backports ${nv32_pkg}" \
|
||||
"Installing 32-bit NVIDIA drivers from backports..."
|
||||
fi
|
||||
;;
|
||||
stable)
|
||||
local nv32_pkg="nvidia-driver-libs:i386"
|
||||
local nv32_ver
|
||||
nv32_ver=$(apt-cache policy "$nv32_pkg" 2>/dev/null | awk 'NR==3 {print $2; exit}')
|
||||
local use_bpo32=false
|
||||
if [ "$(is_backports_enabled)" == "true" ]; then
|
||||
local bpo_nv32_ver
|
||||
bpo_nv32_ver=$(apt-cache madison "$nv32_pkg" 2>/dev/null | \
|
||||
grep "${DEBIAN_CODENAME}-backports" | awk '{print $3}' | head -1)
|
||||
if [ -n "$bpo_nv32_ver" ]; then
|
||||
local msg="Source: Debian ${DEBIAN_CODENAME^} (Backports available)\n"
|
||||
msg+="NVIDIA 32-bit Libraries: ${nv32_pkg}\n\n"
|
||||
msg+=" Backports: ${bpo_nv32_ver}\n"
|
||||
msg+=" Stable: ${nv32_ver:-unknown}\n\n"
|
||||
msg+="Choose version:"
|
||||
if _confirm_custom "NVIDIA 32-bit" "$msg" "Backports" "Stable" 14 70; then
|
||||
use_bpo32=true
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if $use_bpo32; then
|
||||
_run_cmd "32-bit NVIDIA" "sudo apt install -y -t ${DEBIAN_CODENAME}-backports ${nv32_pkg}" \
|
||||
"Installing 32-bit NVIDIA drivers from backports..."
|
||||
else
|
||||
local msg="Source: Debian ${DEBIAN_CODENAME^} Stable\n"
|
||||
msg+="NVIDIA 32-bit Libraries ${nv32_ver:-unknown}\n\n"
|
||||
msg+="[+] nvidia-driver-libs:i386"
|
||||
if _confirm "NVIDIA 32-bit" "$msg" 12 70; then
|
||||
_run_cmd "32-bit NVIDIA" "sudo apt install -y ${nv32_pkg}" \
|
||||
"Installing 32-bit NVIDIA drivers..."
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
else
|
||||
_run_cmd "32-bit" "sudo apt install -y mesa-vulkan-drivers libglx-mesa0:i386 mesa-vulkan-drivers:i386 libgl1-mesa-dri:i386" "Installing 32-bit Mesa drivers..."
|
||||
_install_mesa_32bit
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -29,10 +124,10 @@ install_gaming() {
|
||||
local choices
|
||||
choices=$(whiptail --title "Gaming Setup" --checklist \
|
||||
"Select gaming packages to install:" $TUI_ALTO $TUI_ANCHO $TUI_ALTO_LISTA \
|
||||
"steam" "Steam (official .deb, needs 32-bit)" ON \
|
||||
"steam" "Steam (requires 32-bit support)" ON \
|
||||
"gamemode" "Game performance optimization" ON \
|
||||
"mangohud" "Performance overlay (Vulkan/GL)" ON \
|
||||
"heroic" "Heroic Launcher (Epic/GOG) .deb" OFF \
|
||||
"mangohud" "Performance overlay (Vulkan/OpenGL)" ON \
|
||||
"heroic" "Heroic Launcher (Epic/GOG)" OFF \
|
||||
"goverlay" "MangoHud config GUI" ON \
|
||||
"lutris" "Game launcher/manager" OFF \
|
||||
3>&1 1>&2 2>&3)
|
||||
@@ -55,37 +150,18 @@ install_gaming() {
|
||||
for pkg in $cleaned; do
|
||||
case $pkg in
|
||||
steam)
|
||||
local steam_deb="/tmp/steam_latest.deb"
|
||||
_run_cmd "Steam" "wget -O $steam_deb https://cdn.fastly.steamstatic.com/client/installer/steam.deb" "Downloading Steam..."
|
||||
_run_cmd "Steam" "sudo apt install -y $steam_deb" "Installing Steam..."
|
||||
echo -e "${GREEN}Steam installed.${NC}"
|
||||
;;
|
||||
mangohud)
|
||||
_run_cmd "MangoHud" "sudo apt install -y mangohud" "Installing MangoHud..."
|
||||
if $enable_32bit; then
|
||||
echo "Installing 32-bit MangoHud..."
|
||||
_run_cmd "MangoHud" "sudo apt install -y mangohud:i386" "Installing 32-bit MangoHud..."
|
||||
fi
|
||||
;;
|
||||
heroic)
|
||||
local heroic_deb="/tmp/heroic.deb"
|
||||
_run_cmd "Heroic" "sudo apt install -y curl wget" "Installing dependencies..."
|
||||
local gh_url
|
||||
gh_url=$(curl -s --connect-timeout 10 https://api.github.com/repos/Heroic-Games-Launcher/\
|
||||
HeroicGamesLauncher/releases/latest | \
|
||||
grep -oP 'https://[^"]+amd64\.deb' | head -1)
|
||||
if [ -z "$gh_url" ]; then
|
||||
echo -e "${RED}Could not determine latest Heroic release.${NC}"
|
||||
if ensure_contrib_repo; then
|
||||
install_steam
|
||||
else
|
||||
_run_cmd "Heroic" "wget -O $heroic_deb $gh_url" "Downloading Heroic..."
|
||||
_run_cmd "Heroic" "sudo apt install -y $heroic_deb" "Installing Heroic..."
|
||||
rm -f "$heroic_deb"
|
||||
echo -e "${GREEN}Heroic Games Launcher installed.${NC}"
|
||||
echo -e "${YELLOW}Skipping Steam installation (contrib repository not enabled).${NC}"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
_run_install "$pkg"
|
||||
;;
|
||||
heroic) install_heroic ;;
|
||||
mangohud) install_mangohud ;;
|
||||
gamemode) install_gamemode ;;
|
||||
goverlay) install_goverlay ;;
|
||||
lutris) install_lutris ;;
|
||||
*) _run_install "$pkg" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
#!/usr/bin/env bash
|
||||
# Shared helpers for gaming submodules
|
||||
|
||||
_install_mesa_32bit() {
|
||||
local mesa_pkgs=(
|
||||
"mesa-vulkan-drivers" "mesa-vulkan-drivers:i386"
|
||||
"libgl1-mesa-dri" "libgl1-mesa-dri:i386"
|
||||
"libglx-mesa0" "libglx-mesa0:i386"
|
||||
"libegl-mesa0" "libegl-mesa0:i386"
|
||||
"mesa-va-drivers" "mesa-va-drivers:i386"
|
||||
)
|
||||
|
||||
local ref_ver
|
||||
ref_ver=$(apt-cache policy mesa-vulkan-drivers:i386 2>/dev/null | awk 'NR==3 {print $2; exit}')
|
||||
local ref_bpo_ver
|
||||
ref_bpo_ver=$(apt-cache madison mesa-vulkan-drivers:i386 2>/dev/null | \
|
||||
grep "${DEBIAN_CODENAME}-backports" | awk '{print $3}' | head -1)
|
||||
local comp_line="Components: Vulkan:i386, OpenGL:i386, GLX:i386, EGL:i386, VA-API:i386"
|
||||
|
||||
if [ "$(is_backports_enabled)" == "true" ] && [ -n "$ref_bpo_ver" ]; then
|
||||
local bpo_pkgs=()
|
||||
local stable_pkgs=()
|
||||
|
||||
for mpkg in "${mesa_pkgs[@]}"; do
|
||||
local bpo_ver
|
||||
bpo_ver=$(apt-cache madison "$mpkg" 2>/dev/null | \
|
||||
grep "${DEBIAN_CODENAME}-backports" | awk '{print $3}' | head -1)
|
||||
if [ -n "$bpo_ver" ]; then
|
||||
bpo_pkgs+=("$mpkg")
|
||||
else
|
||||
stable_pkgs+=("$mpkg")
|
||||
fi
|
||||
done
|
||||
|
||||
local src_label="Debian ${DEBIAN_CODENAME^}-Backports"
|
||||
[ ${#stable_pkgs[@]} -gt 0 ] && src_label+=" + Stable"
|
||||
|
||||
local msg="Mesa 32-bit drivers required for gaming.\n\n"
|
||||
msg+="Source: ${src_label}\n"
|
||||
msg+="Mesa ${ref_bpo_ver:-$ref_ver}\n"
|
||||
msg+="${comp_line}\n\n"
|
||||
[ ${#stable_pkgs[@]} -gt 0 ] && msg+="Some packages only available in stable.\n"
|
||||
msg+="Choose version:"
|
||||
|
||||
if _confirm_custom "Mesa 32-bit" "$msg" "Backports" "Stable" 14 70; then
|
||||
_run_cmd "Mesa 32-bit" "sudo apt install -y -t ${DEBIAN_CODENAME}-backports ${bpo_pkgs[*]}" \
|
||||
"Installing 32-bit Mesa from backports..."
|
||||
if [ ${#stable_pkgs[@]} -gt 0 ]; then
|
||||
_run_cmd "Mesa 32-bit" "sudo apt install -y ${stable_pkgs[*]}" \
|
||||
"Installing remaining 32-bit Mesa from stable..."
|
||||
fi
|
||||
else
|
||||
_run_cmd "Mesa 32-bit" "sudo apt install -y ${mesa_pkgs[*]}" \
|
||||
"Installing 32-bit Mesa from stable..."
|
||||
fi
|
||||
else
|
||||
local msg="Mesa 32-bit drivers required for gaming.\n\n"
|
||||
msg+="Source: Debian Stable\n"
|
||||
msg+="Mesa ${ref_ver}\n"
|
||||
msg+="${comp_line}\n\n"
|
||||
msg+="Install Mesa 32-bit drivers?"
|
||||
if _confirm "Mesa 32-bit" "$msg" 14 70; then
|
||||
_run_cmd "Mesa 32-bit" "sudo apt install -y ${mesa_pkgs[*]}" \
|
||||
"Installing 32-bit Mesa..."
|
||||
fi
|
||||
fi
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env bash
|
||||
# Heroic Games Launcher installation from GitHub releases
|
||||
|
||||
install_heroic() {
|
||||
local heroic_deb="/tmp/heroic.deb"
|
||||
_run_cmd "Heroic" "sudo apt install -y curl wget" "Installing dependencies..."
|
||||
local gh_url
|
||||
gh_url=$(curl -s --connect-timeout 10 https://api.github.com/repos/Heroic-Games-Launcher/\
|
||||
HeroicGamesLauncher/releases/latest | \
|
||||
grep -oP 'https://[^"]+amd64\.deb' | head -1)
|
||||
if [ -z "$gh_url" ]; then
|
||||
echo -e "${RED}Could not determine latest Heroic release.${NC}"
|
||||
else
|
||||
_run_cmd "Heroic" "wget -O $heroic_deb $gh_url" "Downloading Heroic..."
|
||||
_run_cmd "Heroic" "sudo apt install -y $heroic_deb" "Installing Heroic..."
|
||||
rm -f "$heroic_deb"
|
||||
echo -e "${GREEN}Heroic Games Launcher installed.${NC}"
|
||||
fi
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
# Steam installation from Debian repos
|
||||
|
||||
install_steam() {
|
||||
_run_cmd "Steam" "sudo apt install -y steam-installer" "Installing Steam from Debian repos..."
|
||||
echo -e "${GREEN}Steam installed.${NC}"
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
# Gaming performance tools installation
|
||||
|
||||
install_mangohud() {
|
||||
_run_cmd "MangoHud" "sudo apt install -y mangohud" "Installing MangoHud..."
|
||||
if dpkg --print-foreign-architectures | grep -q i386; then
|
||||
echo "Installing 32-bit MangoHud..."
|
||||
_run_cmd "MangoHud" "sudo apt install -y mangohud:i386" "Installing 32-bit MangoHud..."
|
||||
fi
|
||||
}
|
||||
|
||||
install_gamemode() {
|
||||
_run_install gamemode
|
||||
}
|
||||
|
||||
install_goverlay() {
|
||||
_run_install goverlay
|
||||
}
|
||||
|
||||
install_lutris() {
|
||||
_run_install lutris
|
||||
}
|
||||
+105
-152
@@ -1,164 +1,117 @@
|
||||
#!/usr/bin/env bash
|
||||
# Detects and installs GPU firmwares for AMD, Intel, and NVIDIA
|
||||
# Graphics Stack — sources submodules and provides install_gpu_drivers()
|
||||
|
||||
_GPU_DIR="${MODULES_DIR}/gpu"
|
||||
source "${_GPU_DIR}/_helpers.sh"
|
||||
source "${_GPU_DIR}/amd_intel.sh"
|
||||
source "${_GPU_DIR}/nvidia.sh"
|
||||
|
||||
# Consumed by gaming.sh to know which NVIDIA driver path was taken
|
||||
NVIDIA_DRIVER_MODE=""
|
||||
|
||||
install_gpu_drivers() {
|
||||
case "$GPU_TYPE" in
|
||||
amd) install_amd ;;
|
||||
intel) install_intel ;;
|
||||
nvidia) install_nvidia ;;
|
||||
*)
|
||||
_msg "GPU" "No dedicated GPU detected.\n\nIf you are in a virtual machine, GPU acceleration\ndepends on VM configuration (SPICE, VirtIO).\n\nNo additional drivers will be installed." 12 60
|
||||
return
|
||||
;;
|
||||
esac
|
||||
# Step 1: Info banner
|
||||
local info="This section installs the latest Mesa graphics stack\n"
|
||||
info+="from Debian backports (or stable), plus GPU firmware\n"
|
||||
info+="and monitoring tools tailored to your hardware.\n\n"
|
||||
info+="Components:\n"
|
||||
info+=" Mesa (OpenGL / Vulkan / VA-API)\n"
|
||||
if [ "$GPU_TYPE" != "unknown" ]; then
|
||||
info+=" GPU firmware for ${GPU_DESC}\n"
|
||||
fi
|
||||
info+=" Monitoring tools (nvtop, vainfo, ...)"
|
||||
|
||||
if [ "$GPU_TYPE" != "nvidia" ] && [ "$(is_backports_enabled)" == true ]; then
|
||||
local mesa_pkgs=""
|
||||
for mpkg in libgl1-mesa-dri mesa-vulkan-drivers; do
|
||||
local bpo_ver
|
||||
bpo_ver=$(apt-cache madison "$mpkg" 2>/dev/null | \
|
||||
grep "${DEBIAN_CODENAME}-backports" | awk '{print $3}' | head -1)
|
||||
if [ -n "$bpo_ver" ]; then
|
||||
mesa_pkgs+=" - ${mpkg} ${bpo_ver} (backports)\n"
|
||||
if ! _confirm "Graphics Stack" "$info"; then
|
||||
echo "Skipping Graphics Stack."
|
||||
return
|
||||
fi
|
||||
|
||||
# Step 2: GPU detected?
|
||||
if [ "$GPU_TYPE" = "unknown" ] || [ -z "$GPU_TYPE" ]; then
|
||||
# --- BLOQUE B: No GPU / VM (inline, no _install_mesa_backports) ---
|
||||
local mesa_pkgs=(mesa-vulkan-drivers libgl1-mesa-dri libglx-mesa0 libegl-mesa0 mesa-va-drivers)
|
||||
local ref_ver
|
||||
ref_ver=$(apt-cache policy mesa-vulkan-drivers 2>/dev/null | awk 'NR==3 {print $2; exit}')
|
||||
local ref_bpo_ver
|
||||
ref_bpo_ver=$(apt-cache madison mesa-vulkan-drivers 2>/dev/null | \
|
||||
grep "${DEBIAN_CODENAME}-backports" | awk '{print $3}' | head -1)
|
||||
local comp_line="Components: Vulkan, OpenGL, GLX, EGL, VA-API (64-bit)"
|
||||
|
||||
if [ -n "$ref_bpo_ver" ] && [ "$(is_backports_enabled)" == "true" ]; then
|
||||
local header="No dedicated GPU was detected (VM or headless).\n"
|
||||
header+="Install Mesa stack for compute / display acceleration?\n\n"
|
||||
header+="Source: Debian ${DEBIAN_CODENAME^}-Backports\n"
|
||||
header+="Mesa ${ref_bpo_ver}\n"
|
||||
header+="${comp_line}\n\n"
|
||||
header+="Choose version:"
|
||||
if _confirm_custom "No GPU Detected" "$header" "Backports" "Stable" 14 70; then
|
||||
_run_cmd "Mesa" "sudo apt install -y -t ${DEBIAN_CODENAME}-backports ${mesa_pkgs[*]}" \
|
||||
"Installing Mesa from backports..."
|
||||
else
|
||||
mesa_pkgs+=" - ${mpkg} (from stable)\n"
|
||||
_run_cmd "Mesa" "sudo apt install -y ${mesa_pkgs[*]}" \
|
||||
"Installing Mesa from stable..."
|
||||
fi
|
||||
done
|
||||
if _confirm_custom "Mesa Backports" "Install Mesa?\n${mesa_pkgs}" "Backports" "Stable"; then
|
||||
_run_cmd "Mesa" "sudo apt install -y -t ${DEBIAN_CODENAME}-backports libgl1-mesa-dri mesa-vulkan-drivers" "Installing Mesa from backports..."
|
||||
else
|
||||
_run_cmd "Mesa" "sudo apt install -y libgl1-mesa-dri mesa-vulkan-drivers" "Installing Mesa from stable..."
|
||||
fi
|
||||
fi
|
||||
|
||||
local tool_pkgs
|
||||
tool_pkgs=$(pkg_versions nvtop vainfo)
|
||||
if _confirm "GPU Tools" "Install monitoring tools?\n${tool_pkgs}"; then
|
||||
_run_cmd "GPU Tools" "sudo apt install -y nvtop vainfo" "Installing GPU tools..."
|
||||
vainfo
|
||||
else
|
||||
echo "Skipping GPU monitoring tools."
|
||||
fi
|
||||
echo -e "${GREEN}GPU setup complete.${NC}"
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# AMD GPU
|
||||
# ----------------------------------------------------------------------
|
||||
install_amd() {
|
||||
local pkgs
|
||||
pkgs=$(pkg_versions firmware-amd-graphics radeontop)
|
||||
if ! _confirm "AMD GPU" "Install AMD drivers?\n${pkgs}"; then
|
||||
echo "Skipping AMD GPU drivers."
|
||||
return
|
||||
fi
|
||||
_run_cmd "AMD" "sudo apt install -y firmware-amd-graphics radeontop" "Installing AMD drivers..."
|
||||
echo -e "${GREEN}AMD drivers installed.${NC}"
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Intel GPU
|
||||
# ----------------------------------------------------------------------
|
||||
install_intel() {
|
||||
local gen
|
||||
gen=$(get_intel_generation)
|
||||
local va_driver
|
||||
if [ "$gen" = "gen7-" ]; then
|
||||
va_driver="i965-va-driver-shaders"
|
||||
else
|
||||
va_driver="intel-media-va-driver-non-free"
|
||||
fi
|
||||
|
||||
local pkgs
|
||||
pkgs=$(pkg_versions firmware-intel-graphics "$va_driver")
|
||||
if ! _confirm "Intel GPU" "Install Intel drivers?\n${pkgs}"; then
|
||||
echo "Skipping Intel GPU drivers."
|
||||
return
|
||||
fi
|
||||
|
||||
_run_cmd "Intel" "sudo apt install -y firmware-intel-graphics" "Installing Intel firmware..."
|
||||
|
||||
echo "Detected Intel GPU generation: $gen"
|
||||
echo "Installing ${va_driver}..."
|
||||
_run_cmd "Intel" "sudo apt install -y $va_driver" "Installing Intel VA driver..."
|
||||
|
||||
echo -e "${GREEN}Intel GPU drivers installed.${NC}"
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# NVIDIA GPU
|
||||
# ----------------------------------------------------------------------
|
||||
install_nvidia() {
|
||||
echo -e "${YELLOW}NVIDIA GPU detected.${NC}"
|
||||
|
||||
# --- WARNING CHECK: Backports vs NVIDIA ---
|
||||
if [ "$(is_backports_enabled)" == true ]; then
|
||||
echo -e "${YELLOW}============================================${NC}"
|
||||
echo -e "${YELLOW} IMPORTANT: Backports are currently enabled${NC}"
|
||||
echo -e "${YELLOW}============================================${NC}"
|
||||
echo ""
|
||||
echo "If you are using a backports kernel (e.g., 6.19+), the NVIDIA"
|
||||
echo "driver (especially the 550 series on Debian Trixie) may fail to"
|
||||
echo "compile via DKMS due to kernel incompatibilities."
|
||||
echo ""
|
||||
echo "We strongly recommend using the stable Debian kernel with the"
|
||||
echo "NVIDIA driver. The script will now install the recommended driver"
|
||||
echo "from the STABLE repositories only, NOT from backports."
|
||||
|
||||
if ! _confirm "NVIDIA + Backports" "Backports kernel (6.19+) may break NVIDIA driver.\nContinue with stable NVIDIA driver?"; then
|
||||
echo "Skipping NVIDIA driver installation."
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
|
||||
_run_cmd "NVIDIA" "sudo apt install -y nvidia-detect" "Installing nvidia-detect..."
|
||||
|
||||
# Run nvidia-detect and parse the recommended package
|
||||
echo "Detecting recommended NVIDIA driver..."
|
||||
local recommended
|
||||
recommended=$(nvidia-detect 2>/dev/null | grep -oP 'nvidia[\w-]+(?= package)')
|
||||
|
||||
if [ -z "$recommended" ]; then
|
||||
echo -e "${RED}nvidia-detect could not determine a suitable driver.${NC}"
|
||||
echo "Your GPU may not be supported by current Debian packages."
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo "Recommended driver package: $recommended"
|
||||
|
||||
# --- CHECK FOR UNSUPPORTED LEGACY DRIVERS ---
|
||||
if [[ "$recommended" =~ tesla-470|legacy-390|legacy-340 ]]; then
|
||||
if [ "$DEBIAN_CODENAME" = "trixie" ]; then
|
||||
echo -e "${RED}============================================${NC}"
|
||||
echo -e "${RED} NVIDIA DRIVER NOT AVAILABLE${NC}"
|
||||
echo -e "${RED}============================================${NC}"
|
||||
echo ""
|
||||
echo "Your GPU requires the $recommended driver, which is not available"
|
||||
echo "in Debian 13 (Trixie)."
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo " 1. Install Debian 12 (Bookworm) where $recommended is still available"
|
||||
echo " 2. Use Debian Sid (Unstable) which may still provide $recommended"
|
||||
echo " 3. Use the open-source Nouveau driver (limited performance)"
|
||||
echo ""
|
||||
echo "No driver will be installed."
|
||||
return 1
|
||||
else
|
||||
if [[ "$recommended" =~ legacy-390|legacy-340 ]]; then
|
||||
echo -e "${RED}Your GPU requires $recommended, which is not available.${NC}"
|
||||
echo "No driver will be installed."
|
||||
return 1
|
||||
if _confirm "No GPU Detected" \
|
||||
"No dedicated GPU was detected (VM or headless).\n\nInstall Mesa stack?\n\nSource: Debian Stable\nMesa ${ref_ver}\n${comp_line}" 14 70; then
|
||||
_run_cmd "Mesa" "sudo apt install -y ${mesa_pkgs[*]}" \
|
||||
"Installing Mesa..."
|
||||
else
|
||||
echo "Skipping Mesa installation."
|
||||
offer_generic_tools
|
||||
return
|
||||
fi
|
||||
fi
|
||||
offer_generic_tools
|
||||
else
|
||||
# --- BLOQUE A: GPU detectada (AMD / Intel / NVIDIA) ---
|
||||
local ref_ver
|
||||
ref_ver=$(apt-cache policy mesa-vulkan-drivers 2>/dev/null | awk 'NR==3 {print $2; exit}')
|
||||
local ref_bpo_ver
|
||||
ref_bpo_ver=$(apt-cache madison mesa-vulkan-drivers 2>/dev/null | \
|
||||
grep "${DEBIAN_CODENAME}-backports" | awk '{print $3}' | head -1)
|
||||
local comp_line="Components: Vulkan, OpenGL, GLX, EGL, VA-API (64-bit)"
|
||||
|
||||
local src_line="Source: Debian Stable"
|
||||
[ -n "$ref_bpo_ver" ] && [ "$(is_backports_enabled)" == "true" ] && src_line="Source: Debian ${DEBIAN_CODENAME^}-Backports"
|
||||
|
||||
local plan="GPU detected: ${GPU_DESC}\n\n"
|
||||
plan+="${src_line}\n"
|
||||
plan+="Mesa ${ref_bpo_ver:-$ref_ver}\n"
|
||||
plan+="${comp_line}\n"
|
||||
|
||||
case "$GPU_TYPE" in
|
||||
amd) plan+="[+] Firmware: firmware-amd-graphics\n" ;;
|
||||
intel)
|
||||
local _gen; _gen=$(get_intel_generation)
|
||||
local _va; [ "$_gen" = "gen7-" ] && _va="i965-va-driver-shaders" || _va="intel-media-va-driver-non-free"
|
||||
plan+="[+] Firmware: firmware-intel-graphics + ${_va}\n"
|
||||
;;
|
||||
nvidia) plan+="[+] NVIDIA driver (details in next step)\n" ;;
|
||||
esac
|
||||
|
||||
if ! _confirm "Graphics Stack — ${GPU_DESC}" "$plan" 14 70; then
|
||||
echo "Skipping Graphics Stack."
|
||||
return
|
||||
fi
|
||||
|
||||
# 3. _run_cmd (via vendor functions — each with its own pkg_versions + _confirm)
|
||||
case "$GPU_TYPE" in
|
||||
amd) install_amd_firmware ;;
|
||||
intel) install_intel_firmware ;;
|
||||
nvidia) install_nvidia_driver ;;
|
||||
esac
|
||||
|
||||
# Mesa (backports / stable)
|
||||
_install_mesa_backports
|
||||
|
||||
# Vendor-specific tools
|
||||
case "$GPU_TYPE" in
|
||||
amd) offer_amd_tools ;;
|
||||
intel) offer_intel_tools ;;
|
||||
nvidia) offer_generic_tools ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
local nv_pkgs
|
||||
nv_pkgs=$(pkg_versions "$recommended" firmware-misc-nonfree nvidia-vaapi-driver)
|
||||
if ! _confirm "NVIDIA Driver" "Install NVIDIA driver?\n${nv_pkgs}\nReboot required."; then
|
||||
echo "Skipping NVIDIA driver installation."
|
||||
return 0
|
||||
fi
|
||||
|
||||
_run_cmd "NVIDIA" "sudo apt install -y $recommended firmware-misc-nonfree nvidia-vaapi-driver" "Installing NVIDIA driver..."
|
||||
echo -e "${GREEN}NVIDIA drivers installed. Reboot required.${NC}"
|
||||
echo -e "${GREEN}Graphics stack setup complete.${NC}"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,144 @@
|
||||
#!/usr/bin/env bash
|
||||
# Shared helpers for GPU submodules
|
||||
|
||||
is_nvidia_kepler() {
|
||||
local dev_id
|
||||
dev_id=$(lspci -nn | grep -iE "VGA|3D" | grep -i nvidia | grep -oP '10de:\K[0-9a-fA-F]+' | head -n1)
|
||||
[ -z "$dev_id" ] && { echo false; return; }
|
||||
|
||||
local dev_int
|
||||
dev_int=$((16#${dev_id,,}))
|
||||
|
||||
# Known Kepler device ID ranges (GKxxx)
|
||||
if [ "$dev_int" -ge $((16#0FC0)) ] && [ "$dev_int" -le $((16#0FCF)) ]; then echo true; return; fi
|
||||
if [ "$dev_int" -ge $((16#1180)) ] && [ "$dev_int" -le $((16#118F)) ]; then echo true; return; fi
|
||||
if [ "$dev_int" -ge $((16#11C0)) ] && [ "$dev_int" -le $((16#11CF)) ]; then echo true; return; fi
|
||||
if [ "$dev_int" -ge $((16#0FE0)) ] && [ "$dev_int" -le $((16#0FEF)) ]; then echo true; return; fi
|
||||
if [ "$dev_int" -ge $((16#1280)) ] && [ "$dev_int" -le $((16#129F)) ]; then echo true; return; fi
|
||||
if [ "$dev_int" -ge $((16#0EB0)) ] && [ "$dev_int" -le $((16#0EBF)) ]; then echo true; return; fi
|
||||
|
||||
echo false
|
||||
}
|
||||
|
||||
is_nvidia_maxwell() {
|
||||
local dev_id
|
||||
dev_id=$(lspci -nn | grep -iE "VGA|3D" | grep -i nvidia | grep -oP '10de:\K[0-9a-fA-F]+' | head -n1)
|
||||
[ -z "$dev_id" ] && { echo false; return; }
|
||||
|
||||
local dev_int
|
||||
dev_int=$((16#${dev_id,,}))
|
||||
|
||||
# GM108 (GT 830M, GT 840M, GT 940M)
|
||||
if [ "$dev_int" -ge $((16#1340)) ] && [ "$dev_int" -le $((16#134F)) ]; then echo true; return; fi
|
||||
# GM107 (GTX 750 Ti, GTX 860M)
|
||||
if [ "$dev_int" -ge $((16#1380)) ] && [ "$dev_int" -le $((16#138F)) ]; then echo true; return; fi
|
||||
# GM200 (TITAN X, GTX 980 Ti)
|
||||
if [ "$dev_int" -ge $((16#13C0)) ] && [ "$dev_int" -le $((16#13CF)) ]; then echo true; return; fi
|
||||
# GM204 (GTX 980, GTX 970)
|
||||
if [ "$dev_int" -ge $((16#13D0)) ] && [ "$dev_int" -le $((16#13DF)) ]; then echo true; return; fi
|
||||
# GM206 (GTX 960, GTX 950)
|
||||
if [ "$dev_int" -ge $((16#1480)) ] && [ "$dev_int" -le $((16#148F)) ]; then echo true; return; fi
|
||||
|
||||
echo false
|
||||
}
|
||||
|
||||
is_nvidia_pascal() {
|
||||
local dev_id
|
||||
dev_id=$(lspci -nn | grep -iE "VGA|3D" | grep -i nvidia | grep -oP '10de:\K[0-9a-fA-F]+' | head -n1)
|
||||
[ -z "$dev_id" ] && { echo false; return; }
|
||||
|
||||
local dev_int
|
||||
dev_int=$((16#${dev_id,,}))
|
||||
|
||||
# GP100 (Tesla P100, Quadro GP100)
|
||||
if [ "$dev_int" -ge $((16#15F0)) ] && [ "$dev_int" -le $((16#15FF)) ]; then echo true; return; fi
|
||||
# GP104 (GTX 1080, GTX 1070)
|
||||
if [ "$dev_int" -ge $((16#1B00)) ] && [ "$dev_int" -le $((16#1B1F)) ]; then echo true; return; fi
|
||||
# GP102 (TITAN Xp, GTX 1080 Ti)
|
||||
if [ "$dev_int" -ge $((16#1B80)) ] && [ "$dev_int" -le $((16#1B8F)) ]; then echo true; return; fi
|
||||
# GP106 (GTX 1060)
|
||||
if [ "$dev_int" -ge $((16#1C00)) ] && [ "$dev_int" -le $((16#1C2F)) ]; then echo true; return; fi
|
||||
# GP107 (GTX 1050 Ti, GTX 1050)
|
||||
if [ "$dev_int" -ge $((16#1C80)) ] && [ "$dev_int" -le $((16#1C8F)) ]; then echo true; return; fi
|
||||
# GP108 (GT 1030, GT 1010)
|
||||
if [ "$dev_int" -ge $((16#1D00)) ] && [ "$dev_int" -le $((16#1DFF)) ]; then echo true; return; fi
|
||||
|
||||
echo false
|
||||
}
|
||||
|
||||
_install_mesa_backports() {
|
||||
if [ "$(is_backports_enabled)" != "true" ]; then
|
||||
install_mesa_stable
|
||||
return
|
||||
fi
|
||||
|
||||
local mesa_pkgs=("mesa-vulkan-drivers" "libgl1-mesa-dri" "libglx-mesa0" "libegl-mesa0" "mesa-va-drivers")
|
||||
local bpo_pkgs=()
|
||||
local stable_pkgs=()
|
||||
|
||||
for mpkg in "${mesa_pkgs[@]}"; do
|
||||
local bpo_ver
|
||||
bpo_ver=$(apt-cache madison "$mpkg" 2>/dev/null | \
|
||||
grep "${DEBIAN_CODENAME}-backports" | awk '{print $3}' | head -1)
|
||||
if [ -n "$bpo_ver" ]; then
|
||||
bpo_pkgs+=("$mpkg")
|
||||
else
|
||||
stable_pkgs+=("$mpkg")
|
||||
fi
|
||||
done
|
||||
|
||||
local ref_ver
|
||||
ref_ver=$(apt-cache policy mesa-vulkan-drivers 2>/dev/null | awk 'NR==3 {print $2; exit}')
|
||||
local ref_bpo_ver
|
||||
ref_bpo_ver=$(apt-cache madison mesa-vulkan-drivers 2>/dev/null | \
|
||||
grep "${DEBIAN_CODENAME}-backports" | awk '{print $3}' | head -1)
|
||||
local comp_line="Components: Vulkan, OpenGL, GLX, EGL, VA-API (64-bit)"
|
||||
|
||||
if [ ${#bpo_pkgs[@]} -gt 0 ]; then
|
||||
local src_label="Debian ${DEBIAN_CODENAME^}-Backports"
|
||||
[ ${#stable_pkgs[@]} -gt 0 ] && src_label+=" + Stable"
|
||||
local msg="Mesa provides OpenGL/Vulkan/VA-API acceleration.\n\n"
|
||||
msg+="Source: ${src_label}\n"
|
||||
msg+="Mesa ${ref_bpo_ver:-$ref_ver}\n"
|
||||
msg+="${comp_line}\n\n"
|
||||
[ ${#stable_pkgs[@]} -gt 0 ] && msg+="Some packages only available in stable.\n"
|
||||
msg+="Choose version for backports-capable packages:"
|
||||
if _confirm_custom "Mesa (Graphics)" "$msg" "Backports" "Stable" 14 70; then
|
||||
_run_cmd "Mesa (backports)" "sudo apt install -y -t ${DEBIAN_CODENAME}-backports ${bpo_pkgs[*]}" \
|
||||
"Installing Mesa from backports..."
|
||||
if [ ${#stable_pkgs[@]} -gt 0 ]; then
|
||||
_run_cmd "Mesa (stable)" "sudo apt install -y ${stable_pkgs[*]}" \
|
||||
"Installing remaining Mesa packages from stable..."
|
||||
fi
|
||||
else
|
||||
_run_cmd "Mesa" "sudo apt install -y ${mesa_pkgs[*]}" \
|
||||
"Installing Mesa from stable..."
|
||||
fi
|
||||
else
|
||||
local msg="Mesa provides OpenGL/Vulkan/VA-API acceleration.\n\n"
|
||||
msg+="Source: Debian Stable\n"
|
||||
msg+="Mesa ${ref_ver}\n"
|
||||
msg+="${comp_line}\n\n"
|
||||
msg+="Install Mesa from available repositories?"
|
||||
if _confirm "Mesa (Graphics)" "$msg" 14 70; then
|
||||
_run_cmd "Mesa" "sudo apt install -y ${mesa_pkgs[*]}" \
|
||||
"Installing Mesa..."
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
install_mesa_stable() {
|
||||
local mesa_pkgs=("mesa-vulkan-drivers" "libgl1-mesa-dri" "libglx-mesa0" "libegl-mesa0" "mesa-va-drivers")
|
||||
_run_cmd "Mesa" "sudo apt install -y ${mesa_pkgs[*]}" "Installing Mesa from stable..."
|
||||
}
|
||||
|
||||
offer_generic_tools() {
|
||||
local tool_pkgs
|
||||
tool_pkgs=$(pkg_versions nvtop vainfo)
|
||||
if _confirm "GPU Tools" "Install monitoring and info tools?\n\n${tool_pkgs}"; then
|
||||
_run_cmd "GPU Tools" "sudo apt install -y nvtop vainfo" "Installing GPU tools..."
|
||||
vainfo
|
||||
else
|
||||
echo "Skipping GPU monitoring tools."
|
||||
fi
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
#!/usr/bin/env bash
|
||||
# AMD and Intel GPU firmware + tools
|
||||
|
||||
install_amd_firmware() {
|
||||
local fw_info
|
||||
fw_info=$(pkg_versions firmware-amd-graphics)
|
||||
if _confirm "AMD Firmware" "Install AMD GPU firmware?\n\n${fw_info}"; then
|
||||
_run_cmd "AMD" "sudo apt install -y firmware-amd-graphics" "Installing AMD GPU firmware..."
|
||||
fi
|
||||
}
|
||||
|
||||
offer_amd_tools() {
|
||||
local amd_tools=("radeontop")
|
||||
local corectrl_available=false
|
||||
|
||||
if [ "$DEBIAN_CODENAME" = "trixie" ]; then
|
||||
corectrl_available=true
|
||||
elif [ "$(is_backports_enabled)" = "true" ] && apt-cache madison corectrl 2>/dev/null | grep -q "bookworm-backports"; then
|
||||
corectrl_available=true
|
||||
fi
|
||||
|
||||
local pkgs
|
||||
pkgs=$(pkg_versions "${amd_tools[@]}" nvtop vainfo)
|
||||
if $corectrl_available; then
|
||||
local ctrl_ver
|
||||
ctrl_ver=$(apt-cache policy corectrl 2>/dev/null | awk 'NR==3 {print $2; exit}')
|
||||
pkgs+=" - corectrl ${ctrl_ver}\n"
|
||||
fi
|
||||
|
||||
if ! _confirm "AMD Tools" "Install AMD monitoring and control tools?\n\n${pkgs}"; then
|
||||
echo "Skipping AMD tools."
|
||||
return
|
||||
fi
|
||||
|
||||
_run_cmd "AMD Tools" "sudo apt install -y ${amd_tools[*]} nvtop vainfo" "Installing AMD tools..."
|
||||
vainfo
|
||||
|
||||
if $corectrl_available; then
|
||||
if [ "$DEBIAN_CODENAME" = "trixie" ]; then
|
||||
_run_cmd "corectrl" "sudo apt install -y corectrl" "Installing corectrl..."
|
||||
else
|
||||
_run_cmd "corectrl" "sudo apt install -y -t ${DEBIAN_CODENAME}-backports corectrl" "Installing corectrl from backports..."
|
||||
fi
|
||||
fi
|
||||
|
||||
echo -e "${GREEN}AMD tools installed.${NC}"
|
||||
}
|
||||
|
||||
install_intel_firmware() {
|
||||
local gen
|
||||
gen=$(get_intel_generation)
|
||||
local va_driver
|
||||
if [ "$gen" = "gen7-" ]; then
|
||||
va_driver="i965-va-driver-shaders"
|
||||
else
|
||||
va_driver="intel-media-va-driver-non-free"
|
||||
fi
|
||||
|
||||
local fw_info
|
||||
fw_info=$(pkg_versions firmware-intel-graphics "$va_driver")
|
||||
if _confirm "Intel Firmware" "Install Intel GPU firmware?\n\n${fw_info}"; then
|
||||
_run_cmd "Intel" "sudo apt install -y firmware-intel-graphics $va_driver" "Installing Intel GPU firmware..."
|
||||
fi
|
||||
}
|
||||
|
||||
offer_intel_tools() {
|
||||
local driver_info=""
|
||||
local has_xe=false
|
||||
local has_i915=false
|
||||
local pkg_list=()
|
||||
local pkg_info=""
|
||||
|
||||
[ -d "/sys/bus/pci/drivers/xe" ] && has_xe=true
|
||||
[ -d "/sys/bus/pci/drivers/i915" ] && has_i915=true
|
||||
|
||||
if $has_xe; then
|
||||
driver_info="Modern Intel GPU detected (Xe driver).\nintel-gpu-tools is NOT compatible with Xe.\nOnly nvtop will be offered."
|
||||
pkg_list=("nvtop")
|
||||
elif $has_i915; then
|
||||
driver_info="Classic Intel GPU detected (i915 driver).\nintel-gpu-tools is compatible and will be offered."
|
||||
pkg_list=("intel-gpu-tools" "nvtop")
|
||||
else
|
||||
driver_info="Intel GPU driver not identified.\nOffering nvtop as a safe default."
|
||||
pkg_list=("nvtop")
|
||||
fi
|
||||
|
||||
pkg_info=$(pkg_versions "${pkg_list[@]}" vainfo)
|
||||
|
||||
if _confirm "Intel Tools" "Intel GPU monitoring tools\n\n${driver_info}\n\nPackages:\n${pkg_info}"; then
|
||||
_run_cmd "Intel Tools" "sudo apt install -y ${pkg_list[*]} vainfo" "Installing Intel monitoring tools..."
|
||||
vainfo
|
||||
else
|
||||
echo "Skipping Intel monitoring tools."
|
||||
fi
|
||||
}
|
||||
@@ -0,0 +1,276 @@
|
||||
#!/usr/bin/env bash
|
||||
# NVIDIA GPU driver installation — 3-CASE dispatch
|
||||
#
|
||||
# CASE A : Trixie + backports kernel → Official NVIDIA CUDA Repo (Pinned v590)
|
||||
# CASE B : Bookworm + backports kernel → Debian backports (-t bookworm-backports)
|
||||
# CASE C : Kernel stable (any distro) → Debian stable (optional backports)
|
||||
|
||||
install_nvidia_driver() {
|
||||
echo -e "${YELLOW}NVIDIA GPU detected.${NC}"
|
||||
NVIDIA_DRIVER_MODE=""
|
||||
|
||||
local is_bpo_kernel; is_bpo_kernel=$(is_backports_kernel)
|
||||
local is_kepler; is_kepler=$(is_nvidia_kepler)
|
||||
local is_maxwell; is_maxwell=$(is_nvidia_maxwell)
|
||||
local is_pascal; is_pascal=$(is_nvidia_pascal)
|
||||
|
||||
# ── Veto: Kepler en Trixie no tiene driver disponible ──
|
||||
if [ "$is_kepler" = "true" ] && [ "$DEBIAN_CODENAME" = "trixie" ]; then
|
||||
_msg "NVIDIA Kepler" \
|
||||
"Your GPU is NVIDIA Kepler architecture.\n\nThe nvidia-tesla-470 driver is not available\nin Debian 13 (Trixie).\n\nNo NVIDIA driver will be installed." 14 65
|
||||
return 1
|
||||
fi
|
||||
|
||||
# ── Bloqueo: Maxwell/Pascal no son compatibles con v590 ──
|
||||
if [ "$DEBIAN_CODENAME" = "trixie" ] && [ "$is_bpo_kernel" = "true" ]; then
|
||||
if [ "$is_maxwell" = "true" ] || [ "$is_pascal" = "true" ]; then
|
||||
local gpu_gen="Maxwell"
|
||||
[ "$is_pascal" = "true" ] && gpu_gen="Pascal"
|
||||
local block_msg="INCOMPATIBILITY DETECTED: Your NVIDIA ${gpu_gen} GPU\n"
|
||||
block_msg+="is NOT supported by the modern v590 driver.\n\n"
|
||||
block_msg+="To run NVIDIA safely on Debian 13 (Trixie), you MUST use\n"
|
||||
block_msg+="the official Debian v550 driver, which requires the\n"
|
||||
block_msg+="standard STABLE Kernel.\n\n"
|
||||
block_msg+="The script will automatically downgrade your path to\n"
|
||||
block_msg+="Stable Kernel mode for NVIDIA."
|
||||
_msg "NVIDIA — Trixie + Backports" "$block_msg" 14 70
|
||||
is_bpo_kernel=false
|
||||
fi
|
||||
fi
|
||||
|
||||
# ── Dispatch por casos ──
|
||||
if [ "$DEBIAN_CODENAME" = "trixie" ] && [ "$is_bpo_kernel" = "true" ]; then
|
||||
_install_nvidia_cuda_repo
|
||||
elif [ "$DEBIAN_CODENAME" = "bookworm" ] && [ "$is_bpo_kernel" = "true" ]; then
|
||||
_install_nvidia_bookworm_bpo
|
||||
else
|
||||
_install_nvidia_standard
|
||||
fi
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
# CASE A: Trixie + Backports Kernel → Official CUDA Repo (Pinned v590)
|
||||
# -------------------------------------------------------------------
|
||||
_install_nvidia_cuda_repo() {
|
||||
local i386_active=false
|
||||
dpkg --print-foreign-architectures | grep -q i386 && i386_active=true
|
||||
|
||||
local warn="WARNING: Official Debian NVIDIA driver (v550)\n"
|
||||
warn+="fails to compile on Trixie Backports Kernels.\n\n"
|
||||
warn+="The script will configure the official NVIDIA CUDA\n"
|
||||
warn+="repository and force-install the stable production\n"
|
||||
warn+="branch v590.48.01 on your system.\n\n"
|
||||
warn+="Source: Official NVIDIA CUDA Repo (Pinned v590.*)\n"
|
||||
warn+="Driver: Production Branch 590.48.01 (Kernel 7.0+ Compliant)\n"
|
||||
warn+="[+] Full 64-bit Core & Compute Stack (DKMS)\n"
|
||||
if $i386_active; then
|
||||
warn+="[+] 32-bit Gaming Multiarch Libraries\n"
|
||||
fi
|
||||
warn+="[+] APT Pinning + Package Hold will be applied\n\n"
|
||||
warn+="Do you want to proceed at your own risk?"
|
||||
|
||||
if ! _confirm_custom "NVIDIA Driver — Trixie + Backports" "$warn" "Proceed" "Abort" 18 70; then
|
||||
echo -e "${YELLOW}NVIDIA installation aborted by user.${NC}"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Step 1: Download & install CUDA keyring
|
||||
_run_cmd "CUDA Keyring" \
|
||||
"wget -q https://developer.download.nvidia.com/compute/cuda/repos/debian13/x86_64/cuda-keyring_1.1-1_all.deb -O /tmp/cuda-keyring.deb && sudo dpkg -i /tmp/cuda-keyring.deb && rm -f /tmp/cuda-keyring.deb" \
|
||||
"Downloading and installing official CUDA keyring..."
|
||||
|
||||
# Step 2: Create APT pinning to lock v590
|
||||
_run_cmd "APT Pinning" \
|
||||
'printf "%s\n" "Package: *nvidia*" "Package: *cuda*" "Package: libcuda1" "Package: firmware-nvidia-gsp" "Pin: version 590.*" "Pin-Priority: 1001" | sudo tee /etc/apt/preferences.d/block-nvidia > /dev/null' \
|
||||
"Creating APT pinning to lock NVIDIA to v590 branch..."
|
||||
|
||||
# Step 3: Update package lists
|
||||
_run_cmd "APT Update" "sudo apt update" "Updating package lists..."
|
||||
|
||||
# Step 4: Build version-locked package list
|
||||
local pkgs=(
|
||||
"cuda-drivers=590.48.01-1"
|
||||
"libcuda1=590.48.01-1"
|
||||
"nvidia-driver=590.48.01-1"
|
||||
"nvidia-driver-libs=590.48.01-1"
|
||||
"firmware-nvidia-gsp=590.48.01-1"
|
||||
"libegl-nvidia0=590.48.01-1"
|
||||
"libglx-nvidia0=590.48.01-1"
|
||||
"libnvidia-eglcore=590.48.01-1"
|
||||
"libnvidia-glcore=590.48.01-1"
|
||||
"libnvidia-glvkspirv=590.48.01-1"
|
||||
"libnvidia-ml1=590.48.01-1"
|
||||
"nvidia-egl-icd=590.48.01-1"
|
||||
"nvidia-vulkan-icd=590.48.01-1"
|
||||
"libnvcuvid1=590.48.01-1"
|
||||
"libnvidia-encode1=590.48.01-1"
|
||||
"nvidia-kernel-dkms=590.48.01-1"
|
||||
"nvidia-settings=590.48.01-1"
|
||||
"nvidia-smi=590.48.01-1"
|
||||
)
|
||||
|
||||
if $i386_active; then
|
||||
pkgs+=(
|
||||
"libcuda1:i386=590.48.01-1"
|
||||
"nvidia-driver-libs:i386=590.48.01-1"
|
||||
"libegl-nvidia0:i386=590.48.01-1"
|
||||
"libglx-nvidia0:i386=590.48.01-1"
|
||||
"libnvidia-eglcore:i386=590.48.01-1"
|
||||
"libnvidia-glcore:i386=590.48.01-1"
|
||||
"libnvidia-glvkspirv:i386=590.48.01-1"
|
||||
"libnvidia-ml1:i386=590.48.01-1"
|
||||
"nvidia-egl-icd:i386=590.48.01-1"
|
||||
"nvidia-vulkan-icd:i386=590.48.01-1"
|
||||
)
|
||||
fi
|
||||
|
||||
_run_cmd "NVIDIA CUDA" "sudo apt install -y ${pkgs[*]}" \
|
||||
"Installing NVIDIA Production Driver v590.48.01..."
|
||||
|
||||
# Step 5: Hold critical packages
|
||||
_run_cmd "Package Hold" \
|
||||
"sudo apt-mark hold cuda-drivers libcuda1 firmware-nvidia-gsp" \
|
||||
"Locking v590 packages to prevent accidental upgrades..."
|
||||
|
||||
NVIDIA_DRIVER_MODE="cuda-repo"
|
||||
echo -e "${GREEN}NVIDIA Production Driver v590 installed from CUDA repo. Reboot required.${NC}"
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
# CASE B: Bookworm + Backports Kernel → Debian backports
|
||||
# -------------------------------------------------------------------
|
||||
_install_nvidia_bookworm_bpo() {
|
||||
local nv_pkg=""
|
||||
local is_kepler
|
||||
is_kepler=$(is_nvidia_kepler)
|
||||
|
||||
if [ "$is_kepler" = "true" ]; then
|
||||
nv_pkg="nvidia-tesla-470-driver"
|
||||
else
|
||||
local nd_ver
|
||||
nd_ver=$(apt-cache policy nvidia-detect 2>/dev/null | awk 'NR==3 {print $2; exit}')
|
||||
if _confirm "NVIDIA Detect" "Install nvidia-detect to determine the correct driver?\n\n nvidia-detect ${nd_ver:-unknown}" 12 70; then
|
||||
_run_cmd "NVIDIA" "sudo apt install -y nvidia-detect" "Installing nvidia-detect..."
|
||||
else
|
||||
echo "Skipping NVIDIA driver detection."
|
||||
NVIDIA_DRIVER_MODE=""
|
||||
return 0
|
||||
fi
|
||||
local recommended
|
||||
recommended=$(nvidia-detect 2>/dev/null | grep -oP 'nvidia[\w-]+(?= package)')
|
||||
if [ -z "$recommended" ]; then
|
||||
echo -e "${RED}nvidia-detect could not determine a suitable driver.${NC}"
|
||||
return 1
|
||||
fi
|
||||
if [[ "$recommended" =~ legacy-390|legacy-340 ]]; then
|
||||
echo -e "${RED}Your GPU requires $recommended, which is not available.${NC}"
|
||||
return 1
|
||||
fi
|
||||
nv_pkg="$recommended"
|
||||
fi
|
||||
|
||||
local nv_ver
|
||||
nv_ver=$(apt-cache policy "$nv_pkg" 2>/dev/null | awk 'NR==3 {print $2; exit}')
|
||||
local msg="Source: Debian Bookworm-Backports\n"
|
||||
msg+="NVIDIA Driver: ${nv_pkg} ${nv_ver:-unknown}\n"
|
||||
msg+=" (Compatible with Kernel v6.12+)\n"
|
||||
msg+="[+] firmware-misc-nonfree\n"
|
||||
msg+="[+] nvidia-vaapi-driver"
|
||||
|
||||
if ! _confirm "NVIDIA Driver — Backports" "$msg" 14 70; then
|
||||
echo "Skipping NVIDIA driver installation."
|
||||
return 0
|
||||
fi
|
||||
|
||||
_run_cmd "NVIDIA" "sudo apt install -y -t bookworm-backports $nv_pkg firmware-misc-nonfree nvidia-vaapi-driver" \
|
||||
"Installing NVIDIA driver from backports..."
|
||||
|
||||
NVIDIA_DRIVER_MODE="backports"
|
||||
echo -e "${GREEN}NVIDIA driver installed from backports. Reboot required.${NC}"
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
# CASE C: Kernel stable (any distro) → Debian stable, optional backports
|
||||
# -------------------------------------------------------------------
|
||||
_install_nvidia_standard() {
|
||||
local nv_pkg=""
|
||||
local use_bpo=false
|
||||
local is_kepler
|
||||
is_kepler=$(is_nvidia_kepler)
|
||||
|
||||
if [ "$is_kepler" = "true" ]; then
|
||||
if [ "$DEBIAN_CODENAME" = "trixie" ]; then
|
||||
_msg "NVIDIA Kepler" \
|
||||
"Your GPU is NVIDIA Kepler architecture.\n\nThe nvidia-tesla-470 driver is not available\nin Debian 13 (Trixie).\n\nOptions:\n 1. Use Debian 12 (Bookworm) with nvidia-tesla-470\n 2. Use open-source Nouveau driver (limited)\n\nNo NVIDIA driver will be installed." 14 65
|
||||
return 1
|
||||
fi
|
||||
nv_pkg="nvidia-tesla-470-driver"
|
||||
echo -e "${YELLOW}Kepler GPU detected. Will use ${nv_pkg}.${NC}"
|
||||
else
|
||||
local nd_ver
|
||||
nd_ver=$(apt-cache policy nvidia-detect 2>/dev/null | awk 'NR==3 {print $2; exit}')
|
||||
if _confirm "NVIDIA Detect" "Install nvidia-detect to determine the correct driver?\n\n nvidia-detect ${nd_ver:-unknown}" 12 70; then
|
||||
_run_cmd "NVIDIA" "sudo apt install -y nvidia-detect" "Installing nvidia-detect..."
|
||||
else
|
||||
echo "Skipping NVIDIA driver detection."
|
||||
return 0
|
||||
fi
|
||||
local recommended
|
||||
recommended=$(nvidia-detect 2>/dev/null | grep -oP 'nvidia[\w-]+(?= package)')
|
||||
if [ -z "$recommended" ]; then
|
||||
echo -e "${RED}nvidia-detect could not determine a suitable driver.${NC}"
|
||||
return 1
|
||||
fi
|
||||
if [[ "$recommended" =~ legacy-390|legacy-340 ]]; then
|
||||
echo -e "${RED}Your GPU requires $recommended, which is not available.${NC}"
|
||||
return 1
|
||||
fi
|
||||
nv_pkg="$recommended"
|
||||
fi
|
||||
|
||||
# Check for backports (optional, if repo enabled)
|
||||
local stable_nv_ver
|
||||
stable_nv_ver=$(apt-cache policy "$nv_pkg" 2>/dev/null | awk 'NR==3 {print $2; exit}')
|
||||
if [ "$(is_backports_enabled)" == "true" ]; then
|
||||
local bpo_nv_ver
|
||||
bpo_nv_ver=$(apt-cache madison "$nv_pkg" 2>/dev/null | \
|
||||
grep "${DEBIAN_CODENAME}-backports" | awk '{print $3}' | head -1)
|
||||
if [ -n "$bpo_nv_ver" ]; then
|
||||
local msg="Source: Debian ${DEBIAN_CODENAME^} (Backports available)\n"
|
||||
msg+="NVIDIA Driver: ${nv_pkg}\n\n"
|
||||
msg+=" Backports: ${bpo_nv_ver}\n"
|
||||
msg+=" Stable: ${stable_nv_ver:-unknown}\n\n"
|
||||
msg+="Choose version:"
|
||||
if _confirm_custom "NVIDIA Driver" "$msg" "Backports" "Stable" 14 70; then
|
||||
use_bpo=true
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
local src_label="Debian ${DEBIAN_CODENAME^} Stable"
|
||||
$use_bpo && src_label="Debian ${DEBIAN_CODENAME^}-Backports"
|
||||
|
||||
local msg="Source: ${src_label}\n"
|
||||
msg+="NVIDIA Driver: ${nv_pkg} ${stable_nv_ver:-unknown}\n"
|
||||
msg+="[+] firmware-misc-nonfree\n"
|
||||
msg+="[+] nvidia-vaapi-driver\n"
|
||||
msg+="[+] mesa-vdpau-drivers"
|
||||
|
||||
if ! _confirm "NVIDIA Driver" "$msg" 14 70; then
|
||||
echo "Skipping NVIDIA driver installation."
|
||||
return 0
|
||||
fi
|
||||
|
||||
local extra_pkgs="firmware-misc-nonfree nvidia-vaapi-driver mesa-vdpau-drivers"
|
||||
if $use_bpo; then
|
||||
_run_cmd "NVIDIA" "sudo apt install -y -t ${DEBIAN_CODENAME}-backports $nv_pkg $extra_pkgs" \
|
||||
"Installing NVIDIA driver from backports..."
|
||||
NVIDIA_DRIVER_MODE="backports"
|
||||
else
|
||||
_run_cmd "NVIDIA" "sudo apt install -y $nv_pkg $extra_pkgs" \
|
||||
"Installing NVIDIA driver from stable..."
|
||||
NVIDIA_DRIVER_MODE="stable"
|
||||
fi
|
||||
|
||||
echo -e "${GREEN}NVIDIA driver installed. Reboot required.${NC}"
|
||||
}
|
||||
+57
-7
@@ -32,8 +32,33 @@ check_sudo() {
|
||||
}
|
||||
|
||||
# --------------------------------
|
||||
# Time sync before network ops
|
||||
# Time sync detection + NTP
|
||||
# --------------------------------
|
||||
check_system_time() {
|
||||
if ! command -v timedatectl &> /dev/null; then
|
||||
return
|
||||
fi
|
||||
local year
|
||||
year=$(date +%Y)
|
||||
if [ "$year" -lt 2024 ]; then
|
||||
echo -e "${YELLOW}System date appears incorrect: $(date '+%Y-%m-%d %H:%M')${NC}"
|
||||
echo -e "${YELLOW}This can cause apt update to fail with sync/GPG errors.${NC}"
|
||||
if _confirm "System Date" "The system date is set to $(date '+%Y-%m-%d %H:%M'),\nwhich is before 2024.\n\nSync time via NTP?"; then
|
||||
sudo timedatectl set-ntp true 2>/dev/null || true
|
||||
echo -e "${YELLOW}Waiting a few seconds for time sync...${NC}"
|
||||
sleep 5
|
||||
local new_year
|
||||
new_year=$(date +%Y)
|
||||
if [ "$new_year" -ge 2024 ]; then
|
||||
echo -e "${GREEN}Time synced: $(date '+%Y-%m-%d %H:%M')${NC}"
|
||||
else
|
||||
echo -e "${RED}Could not sync time automatically.${NC}"
|
||||
echo "You may need to set it manually: sudo date --set \"YYYY-MM-DD HH:MM:SS\""
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
sync_system_time() {
|
||||
if command -v timedatectl &> /dev/null; then
|
||||
local ntp_active
|
||||
@@ -41,7 +66,7 @@ sync_system_time() {
|
||||
if [ "$ntp_active" != "yes" ]; then
|
||||
echo -e "${YELLOW}NTP not active. Attempting to enable time sync...${NC}"
|
||||
sudo timedatectl set-ntp true 2>/dev/null || true
|
||||
sleep 2
|
||||
sleep 3
|
||||
fi
|
||||
elif command -v hwclock &> /dev/null && command -v ntpd &> /dev/null; then
|
||||
sudo hwclock --hctosys 2>/dev/null || true
|
||||
@@ -93,6 +118,19 @@ get_ram_summary() {
|
||||
echo "$RAM_SUMMARY"
|
||||
}
|
||||
|
||||
# ----------------------------------
|
||||
# Check if running backports kernel
|
||||
# ----------------------------------
|
||||
is_backports_kernel() {
|
||||
local kver
|
||||
kver=$(uname -r)
|
||||
if echo "$kver" | grep -q 'bpo'; then
|
||||
echo true
|
||||
else
|
||||
echo false
|
||||
fi
|
||||
}
|
||||
|
||||
# ----------------------------------
|
||||
# Package installed check
|
||||
# ----------------------------------
|
||||
@@ -249,6 +287,7 @@ is_backports_enabled() {
|
||||
|
||||
install_backports_or_stable() {
|
||||
local pkg="$1"
|
||||
local pkg_desc="${2:-$pkg}"
|
||||
|
||||
local bpo_ver=""
|
||||
if [ "$(is_backports_enabled)" == true ]; then
|
||||
@@ -275,19 +314,18 @@ install_backports_or_stable() {
|
||||
if [ -n "$bpo_ver" ]; then
|
||||
local stable_ver
|
||||
stable_ver=$(apt-cache policy "$pkg" 2>/dev/null | awk 'NR==3 {print $2; exit}')
|
||||
if _confirm_custom "${pkg}" "Install from backports?\n\nBackports: ${bpo_ver}\nStable: ${stable_ver:-N/A}" "Backports" "Stable"; then
|
||||
if _confirm_custom "${pkg}" "Install ${pkg_desc}?\n\n Backports: ${bpo_ver} (newer, recommended for gaming/newer HW)\n Stable: ${stable_ver:-N/A}\n\nChoose version:" "Backports" "Stable"; then
|
||||
_run_cmd "Backports" \
|
||||
"sudo DEBIAN_FRONTEND=noninteractive apt install -y -t ${DEBIAN_CODENAME}-backports $pkg" \
|
||||
"Installing $pkg from backports..."
|
||||
return
|
||||
fi
|
||||
# User chose "Stable" — install stable directly, no re-prompt
|
||||
_run_cmd "APT" "sudo DEBIAN_FRONTEND=noninteractive apt install -y $pkg" "Installing $pkg from stable..."
|
||||
return
|
||||
fi
|
||||
local stable_ver
|
||||
stable_ver=$(apt-cache policy "$pkg" 2>/dev/null | awk 'NR==3 {print $2; exit}')
|
||||
if _confirm "Install: ${pkg}" "Install ${pkg} ${stable_ver:-} from stable?"; then
|
||||
if _confirm "Install: ${pkg}" "Install ${pkg} ${stable_ver:-}?"; then
|
||||
_run_cmd "APT" "sudo DEBIAN_FRONTEND=noninteractive apt install -y $pkg" "Installing $pkg..."
|
||||
fi
|
||||
}
|
||||
@@ -297,15 +335,17 @@ install_backports_or_stable() {
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
_confirm() {
|
||||
whiptail --title "$1" --yes-button "Execute" --no-button "Skip" \
|
||||
whiptail --title "$1" --yes-button "Yes" --no-button "No" \
|
||||
--yesno "$2" "${3:-10}" "${4:-65}"
|
||||
}
|
||||
|
||||
_confirm_custom() {
|
||||
local title="$1" text="$2" yes_btn="$3" no_btn="$4"
|
||||
shift 4
|
||||
local height="${1:-20}"
|
||||
local width="${2:-78}"
|
||||
whiptail --title "$title" --yes-button "$yes_btn" --no-button "$no_btn" \
|
||||
--yesno "$text" "${@:-10 65}"
|
||||
--yesno "$text" "$height" "$width"
|
||||
}
|
||||
|
||||
_msg() {
|
||||
@@ -365,6 +405,16 @@ _run_install_batch() {
|
||||
fi
|
||||
}
|
||||
|
||||
_run_install_pkg() {
|
||||
local pkg="$1"
|
||||
local ver
|
||||
ver=$(apt-cache policy "$pkg" 2>/dev/null | awk 'NR==3 {print $2; exit}')
|
||||
[ -z "$ver" ] && ver="(unknown)"
|
||||
if _confirm "Install: ${pkg}" "Package: ${pkg}\nVersion: ${ver}\n\nProceed with installation?"; then
|
||||
_run_cmd "Install" "sudo DEBIAN_FRONTEND=noninteractive apt install -y $pkg" "Installing $pkg..."
|
||||
fi
|
||||
}
|
||||
|
||||
get_backports_kernel_version() {
|
||||
local ver
|
||||
ver=$(apt-cache policy linux-image-amd64 2>/dev/null | \
|
||||
|
||||
Reference in New Issue
Block a user