fix script

-fix script and nvidia-smi
This commit is contained in:
stornic56
2026-07-25 22:53:18 -05:00
committed by GitHub
parent cd965a6678
commit 762285f993
5 changed files with 23 additions and 22 deletions
+2 -2
View File
@@ -17,7 +17,7 @@ _detect_all_network_devices() {
PCI_NET_DEVS=()
while IFS= read -r line; do
PCI_NET_DEVS+=("$line")
done < <(lspci -nn 2>/dev/null | grep -iE 'network controller|ethernet controller' || true)
done < <(timeout 2 lspci -nn 2>/dev/null | grep -iE 'network controller|ethernet controller' || true)
USB_WIFI_DEVS=()
while IFS= read -r line; do
@@ -29,7 +29,7 @@ _detect_all_network_devices() {
PCI_BT_DEVS=()
while IFS= read -r line; do
PCI_BT_DEVS+=("$line")
done < <(lspci -nn 2>/dev/null | grep -i 'Bluetooth controller' || true)
done < <(timeout 2 lspci -nn 2>/dev/null | grep -i 'Bluetooth controller' || true)
USB_BT_DEVS=()
while IFS= read -r line; do
+2 -2
View File
@@ -61,7 +61,7 @@ _install_amd_intel_stack() {
local desc
desc=$(echo "$gpu_line" | sed -E 's/.*: //; s/ *\(rev.*//')
plan+=" GPU ${gpu_count}: ${desc}\n"
done < <(lspci -nn | grep -E "VGA|3D" || true)
done < <(timeout 2 lspci -nn | grep -E "VGA|3D" || true)
plan+="\nPlanned components:\n"
if $HAS_INTEL; then
local _gen; _gen=$(get_intel_generation)
@@ -165,7 +165,7 @@ _install_nvidia_stack() {
local desc
desc=$(echo "$gpu_line" | sed -E 's/.*: //; s/ *\(rev.*//')
plan+=" GPU ${gpu_count}: ${desc}\n"
done < <(lspci -nn | grep -E "VGA|3D" || true)
done < <(timeout 2 lspci -nn | grep -E "VGA|3D" || true)
plan+="\nPlanned:\n [+] NVIDIA proprietary driver"
_msg "NVIDIA Stack — Plan" "$plan" 14 65
+6 -6
View File
@@ -3,7 +3,7 @@
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)
dev_id=$(timeout 2 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
@@ -23,7 +23,7 @@ is_nvidia_kepler() {
is_nvidia_fermi() {
local dev_id
dev_id=$(lspci -nn | grep -iE "VGA|3D" | grep -i nvidia | grep -oP '10de:\K[0-9a-fA-F]+' | head -n1)
dev_id=$(timeout 2 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
@@ -56,7 +56,7 @@ is_nvidia_fermi() {
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)
dev_id=$(timeout 2 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
@@ -76,7 +76,7 @@ is_nvidia_maxwell() {
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)
dev_id=$(timeout 2 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
@@ -98,7 +98,7 @@ is_nvidia_pascal() {
is_nvidia_blackwell() {
local dev_id
dev_id=$(lspci -nn | grep -iE "VGA|3D" | grep -i nvidia | grep -oP '10de:\K[0-9a-fA-F]+' | head -n1)
dev_id=$(timeout 2 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
@@ -114,7 +114,7 @@ is_nvidia_blackwell() {
is_amd_legacy_gcn() {
local dev_id
dev_id=$(lspci -nn | grep -iE "VGA|3D" | grep -i amd | grep -oP '1002:\K[0-9a-fA-F]{4}' | head -n1)
dev_id=$(timeout 2 lspci -nn | grep -iE "VGA|3D" | grep -i amd | grep -oP '1002:\K[0-9a-fA-F]{4}' | head -n1)
[ -z "$dev_id" ] && { echo false; return; }
local legacy_ids
+5 -5
View File
@@ -27,7 +27,7 @@ _show_sysinfo() {
if echo "$gpu_line" | grep -qi "nvidia"; then
local nv_ver=""
nv_ver=$(nvidia-smi --query-gpu=driver_version --format=csv,noheader 2>/dev/null | head -1)
nv_ver=$(timeout 3 nvidia-smi --query-gpu=driver_version --format=csv,noheader 2>/dev/null | head -1)
[ -z "$nv_ver" ] && nv_ver=$(dpkg -l nvidia-driver 2>/dev/null | awk '/^ii/ {print $3}' | sed 's/-.*//')
msg+="GPU ${gpu_count}: ${desc}\n"
msg+=" Driver: ${nv_ver:+NVIDIA }${nv_ver:-not installed}\n"
@@ -37,7 +37,7 @@ _show_sysinfo() {
msg+="GPU ${gpu_count}: ${desc}\n"
msg+=" Driver: ${mesa_ver:+Mesa }${mesa_ver:-unknown}\n"
fi
done < <(lspci -nn | grep -E "VGA|3D" || true)
done < <(timeout 2 lspci -nn | grep -E "VGA|3D" || true)
fi
if ! $found_gpu; then
@@ -52,13 +52,13 @@ _show_sysinfo() {
declare -a pci_eth_lines=()
while IFS= read -r line; do
pci_eth_lines+=("$line")
done < <(lspci -d ::0200 2>/dev/null || true)
done < <(timeout 2 lspci -d ::0200 2>/dev/null || true)
# ── 2. Detect ALL WiFi chipsets (class 0x0280 + vendor fallbacks) ──
declare -a pci_wifi_lines=()
while IFS= read -r line; do
pci_wifi_lines+=("$line")
done < <(lspci -d ::0280 2>/dev/null || true)
done < <(timeout 2 lspci -d ::0280 2>/dev/null || true)
# Broadcom vendor-ID fallback (14e4) — include only if not already captured
while IFS= read -r line; do
@@ -69,7 +69,7 @@ _show_sysinfo() {
done
! $already && pci_wifi_lines+=("$line")
fi
done < <(lspci -nn 2>/dev/null || true)
done < <(timeout 2 lspci -nn 2>/dev/null || true)
# USB WiFi fallback
local usb_wifi_lines=()
+8 -7
View File
@@ -191,7 +191,7 @@ detect_kernel() {
# ----------------------------------
detect_gpu() {
local gpu_lines
gpu_lines=$(lspci -nn | grep -E "VGA|3D") || true
gpu_lines=$(timeout 2 lspci -nn | grep -E "VGA|3D") || true
if [ -z "$gpu_lines" ]; then
GPU_TYPE="unknown"
GPU_DESC="No GPU detected"
@@ -201,7 +201,8 @@ detect_gpu() {
local has_nvidia=false has_amd=false has_intel=false
local desc_lines="" nvidia_dev_id="" intel_dev_id=""
while IFS= read -r line || true; do
while IFS= read -r line || [[ -n "$line" ]]; do
[[ -z "$line" ]] && continue
local desc
desc=$(echo "$line" | sed -E 's/.*: //; s/ *\(rev.*//')
[ -n "$desc_lines" ] && desc_lines+=" + "
@@ -282,21 +283,21 @@ declare -a WIFI_SSIDS=()
detect_network() {
local eth_line
eth_line=$(lspci -nn | grep -i 'Ethernet controller' | head -n1) || true
eth_line=$(timeout 2 lspci -nn | grep -i 'Ethernet controller' | head -n1) || true
if [ -n "$eth_line" ]; then
ETH_DESC=$(echo "$eth_line" | sed -E 's/^.*\]: //; s/ \[[0-9a-fA-F]{4}:[0-9a-fA-F]{4}\]//; s/ \(rev [0-9a-fA-F]+\)//')
fi
local wifi_line
# Layer 1: grep by PCI class description text
wifi_line=$(lspci -nn 2>/dev/null | grep -iE 'network controller|wireless|wi-fi|wlan|802\.11' | head -n1) || true
wifi_line=$(timeout 2 lspci -nn 2>/dev/null | grep -iE 'network controller|wireless|wi-fi|wlan|802\.11' | head -n1) || true
# Layer 2: grep by exact PCI class code 0x0280 (Network controller)
if [ -z "$wifi_line" ]; then
wifi_line=$(lspci -d ::0280 2>/dev/null | head -n1) || true
wifi_line=$(timeout 2 lspci -d ::0280 2>/dev/null | head -n1) || true
fi
# Layer 3: Broadcom vendor ID fallback (14e4)
if [ -z "$wifi_line" ]; then
wifi_line=$(lspci -nn 2>/dev/null | grep -i '14e4:' | head -n1) || true
wifi_line=$(timeout 2 lspci -nn 2>/dev/null | grep -i '14e4:' | head -n1) || true
fi
if [ -n "$wifi_line" ]; then
WIFI_CHIPSET="$wifi_line"
@@ -382,7 +383,7 @@ detect_storage() {
elif [ "$rota" = "1" ]; then
type="HDD"
else
rm=$(cat /sys/block/"$name"/removable 2>/dev/null || echo 0)
rm=$(timeout 2 cat /sys/block/"$name"/removable 2>/dev/null || echo 0)
if [ "$rm" = "1" ]; then
type="USB/SD"
else