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
|
||||
|
||||
Reference in New Issue
Block a user