Initial commit — Antergos NeXT
This commit is contained in:
Executable
+90
@@ -0,0 +1,90 @@
|
||||
#!/usr/bin/env bash
|
||||
# Detect Broadcom PCI WiFi chipset support for broadcom-wl and confirm before running install script
|
||||
|
||||
LOG_FILE="$HOME/broadcom-wl-check.log"
|
||||
touch "$LOG_FILE"
|
||||
|
||||
# Log function
|
||||
log() {
|
||||
echo -e "$1" | tee -a "$LOG_FILE"
|
||||
}
|
||||
|
||||
supported_ids=(
|
||||
"02d0:4345" "0846:9011" "0846:9020" "0a5c:bd17" "0a5c:bd1d" "1eda:2410" "14e4:0576" "14e4:4311" "14e4:4312" "14e4:4313" "14e4:4315" "14e4:4328" "14e4:4329" "14e4:432a" "14e4:432b" "14e4:432c" "14e4:432d" "14e4:4331" "14e4:4353" "14e4:4357" "14e4:4358" "14e4:4359" "14e4:4360" "14e4:4365" "14e4:43a0" "14e4:43b1" "14e4:4727" "14e4:a8d6" "14e4:a99d" "14e4:0619"
|
||||
)
|
||||
|
||||
chip_names=(
|
||||
"BCM4311" "BCM4312" "BCM4313" "BCM4321" "BCM4322" "BCM43222" "BCM43224" "BCM43225" "BCM43227" "BCM43228" "BCM43229" "BCM43231" "BCM43236" "BCM43241" "BCM43242" "BCM4330" "BCM4331" "BCM4334" "BCM4335" "BCM4339" "BCM4345" "BCM43421" "BCM43430" "BCM43455" "BCM4350" "BCM4352" "BCM4354" "BCM4356" "BCM4358" "BCM4359" "BCM4360" "BCM43602" "BCM4365" "BCM4366" "BCM4716" "BCM4717" "BCM4718"
|
||||
)
|
||||
|
||||
wifi_devices=$(lspci -nn | grep -iP 'network|wireless' | grep 'Broadcom')
|
||||
[ -e broadcom.txt ] && wifi_devices=$(< broadcom.txt) # TESTING!!!
|
||||
|
||||
if [[ -z "$wifi_devices" ]]; then
|
||||
# No devices, just log and silently exit
|
||||
log "No Broadcom WLAN device found, nothing changed."
|
||||
log "==== lspci -nn network devices start ===="
|
||||
lspci -nn | grep -iP 'network|wireless' | tee -a "$LOG_FILE"
|
||||
log "==== lspci -nn network devices end ===="
|
||||
exit 1
|
||||
fi
|
||||
|
||||
log "Detected Broadcom WLAN devices:"
|
||||
log "$wifi_devices"
|
||||
log ""
|
||||
|
||||
supported_found=0
|
||||
|
||||
while read -r line; do
|
||||
id=$(echo "$line" | grep -oP '[K[0-9a-f]{4}:[0-9a-f]{4}(?=])')
|
||||
log "Detected PCI ID: $id"
|
||||
|
||||
if [[ -n "$id" ]]; then
|
||||
if [[ " ${supported_ids[*]} " == *" $id "* ]]; then
|
||||
log "=> This device is SUPPORTED by broadcom-wl."
|
||||
supported_found=1
|
||||
else
|
||||
log "=> Not listed as supported PCI ID."
|
||||
fi
|
||||
else
|
||||
log "=> No PCI ID detected, skipping ID check."
|
||||
fi
|
||||
|
||||
chip=$(echo "$line" | sed -E 's|.* (BCM[0-9]+) .*|\1|')
|
||||
if printf "%s\n" "${chip_names[@]}" | grep -q "$chip" ; then
|
||||
log "=> Hint: Detected chip name \"$chip\" in device string."
|
||||
fi
|
||||
|
||||
log ""
|
||||
if [[ $supported_found -eq 1 ]]; then
|
||||
break
|
||||
fi
|
||||
done <<<"$wifi_devices"
|
||||
|
||||
if [[ $supported_found -eq 1 ]]; then
|
||||
log "Broadcom-wl compatible device found."
|
||||
log "==== inxi -Naz output start ===="
|
||||
inxi -Naz | tee -a "$LOG_FILE"
|
||||
log "==== inxi -Naz output end ===="
|
||||
|
||||
# Ask user with YAD dialog
|
||||
WICON="/usr/share/antergos/antergos-icon.png"
|
||||
[ -e $WICON ] || WICON="dialog-information" # fallback
|
||||
YAD=(yad --window-icon="$WICON" --center --title='Broadcom wireless device management')
|
||||
if "${YAD[@]}" --image=dialog-question --text="Broadcom-wl compatible device [$id] found.\nDo you want to run the install script?\n"; then
|
||||
log "User confirmed. Running install script..."
|
||||
/usr/bin/broadcom-wl_enable.sh >>"$LOG_FILE" 2>&1
|
||||
"${YAD[@]}" --image=dialog-information --text="Script executed successfully (check $LOG_FILE for details)."
|
||||
log "Install script finished."
|
||||
else
|
||||
log "User declined. No changes made."
|
||||
"${YAD[@]}" --image=dialog-information --text="Operation cancelled by user. Nothing changed."
|
||||
fi
|
||||
else
|
||||
# No supported device, just log, no yad window
|
||||
log "No compatible device found, nothing changed."
|
||||
log "==== lspci -nn network devices start ===="
|
||||
lspci -nn | grep -iP 'network|wireless' | tee -a "$LOG_FILE"
|
||||
log "==== lspci -nn network devices end ===="
|
||||
exit 1
|
||||
fi
|
||||
Executable
+48
@@ -0,0 +1,48 @@
|
||||
#!/usr/bin/env bash
|
||||
# script to install broadcom-wl package and enable modules needed
|
||||
|
||||
LOG_FILE="$HOME/broadcom-wl-wifi-activation.log"
|
||||
exec > >(tee -a "$LOG_FILE") 2>&1
|
||||
|
||||
WICON="/usr/share/antergos/antergos-icon.png"
|
||||
[ -e $WICON ] || WICON="dialog-information" # fallback
|
||||
|
||||
YAD=(yad --center --window-icon="$WICON")
|
||||
|
||||
show_error() {
|
||||
local MSG="$1"
|
||||
echo "[!] $MSG"
|
||||
"${YAD[@]}" --title="Broadcom-wl-WiFi failed to enable device [!]" \
|
||||
--image=network-wireless-disconnected \
|
||||
--width=500 \
|
||||
--height=150 \
|
||||
--text="[!] $MSG\n\nSee log: $LOG_FILE" \
|
||||
--button=OK:0 \
|
||||
--text-align=center
|
||||
exit 1
|
||||
}
|
||||
|
||||
echo "[*] Activate Broadcom-Wifi..."
|
||||
|
||||
if ! pacman -Q broadcom-wl &>/dev/null; then
|
||||
echo "[*] Installing broadcom-wl ..."
|
||||
sudo pacman -U --noconfirm /usr/share/packages/broadcom-wl-[0-9]*-x86_64.pkg.tar.zst || \
|
||||
show_error "Failed to install broadcom-wl package."
|
||||
fi
|
||||
|
||||
sudo rmmod b43 b43legacy bcm43xx bcma brcm80211 brcmfmac brcmsmac ssb tg3 wl 2>/dev/null
|
||||
sudo depmod -a
|
||||
|
||||
sudo modprobe wl || show_error "Failed to load wl module."
|
||||
sudo systemctl restart NetworkManager || show_error "Failed to restart NetworkManager."
|
||||
|
||||
echo "[✓] Broadcom-wl-Wifi activated."
|
||||
|
||||
"${YAD[@]}" --title="Broadcom-wl-WiFi" \
|
||||
--image=network-wireless \
|
||||
--width=500 \
|
||||
--height=150 \
|
||||
--text="Broadcom-Wifi activated. [✓]\n\nlog written: $LOG_FILE" \
|
||||
--button=OK:0 \
|
||||
--timeout=10 \
|
||||
--text-align=center
|
||||
Executable
+70
@@ -0,0 +1,70 @@
|
||||
#!/bin/bash
|
||||
|
||||
# This app checks if an Intel graphics device in the system is of generation from 1 to 3.
|
||||
# If an old Intel device is detected, app installs the xf86-video-intel package.
|
||||
# This app is meant to install the package into the ISO only.
|
||||
# Returns 0 (=true) if a match is found.
|
||||
# Returns 1 (=false) otherwise.
|
||||
# Also displays the found matching Intel device id, or a simple message if not found.
|
||||
|
||||
DIE() {
|
||||
echo "$progname: error: $1" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
IsIntelGeneration_1_to_3() {
|
||||
# See https://en.m.wikipedia.org/wiki/List_of_Intel_graphics_processing_units.
|
||||
|
||||
local id="$1"
|
||||
|
||||
local generation_1to3_ids=(
|
||||
7800 1240 7121 7123 7125 1132 # gen 1
|
||||
2562 3577 2572 3582 358E # gen 2 (table had duplicate 3582)
|
||||
2582 258A 2592 2772 27A2 27AE 29D2 29B2 29C2 A001 A011 # gen 3
|
||||
# 2972 2992 29A2 2982 2A02 2A12 2E42 2E92 2E12 2E32 2E22 2A42 # gen 4 (commented out but here if needed)
|
||||
)
|
||||
|
||||
id="${id^^[a-f]}" # makes all letters uppercase in $id
|
||||
|
||||
[[ "${generation_1to3_ids[*]}" =~ "$id" ]] # returns 0 if $id matches any of the listed values, returns 1 otherwise
|
||||
}
|
||||
|
||||
Main() {
|
||||
local progname="$(basename "$0")"
|
||||
|
||||
# User may give graphics item(s) to search (VGA, Display, 3D).
|
||||
# By default VGA, Display, and 3D are searched.
|
||||
|
||||
local input_items="VGA|Display|3D"
|
||||
local data=$(lspci -nn | grep -P "$input_items") # data = info about graphics devices
|
||||
local vendor_and_id
|
||||
local vendor
|
||||
local id
|
||||
local item
|
||||
local intel_vid=8086
|
||||
local pkg=xf86-video-intel
|
||||
|
||||
for item in ${input_items//|/ } ; do
|
||||
if [ -n "$(echo "$data" | grep -w "$item")" ] ; then
|
||||
vendor_and_id=$(echo "$data" | grep "$item" | sed -E 's|.*\[([0-9a-f]+:[0-9a-f]+)\].*|\1|') # "xxxx:yyyy"
|
||||
[ -n "$vendor_and_id" ] || DIE "failed finding $item info"
|
||||
vendor=${vendor_and_id%:*}
|
||||
if [ "$vendor" = "$intel_vid" ] ; then
|
||||
id=${vendor_and_id#*:}
|
||||
if IsIntelGeneration_1_to_3 "$id" ; then
|
||||
echo "==> $progname: found Intel graphics device with id $id, installing package $pkg"
|
||||
local pkgs=(/usr/share/packages/{$pkg,libxvmc}-*.pkg.tar.zst)
|
||||
sudo pacman -U --noconfirm "${pkgs[@]}"
|
||||
echo "==> $progname: disable compositor for legacy intel in KDE live session"
|
||||
mv /home/liveuser/.config/intel-kwinrc /home/liveuser/.config/kwinrc
|
||||
chown liveuser:liveuser /home/liveuser/.config/kwinrc
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done
|
||||
echo "==> $progname: No gen1..gen3 Intel graphics device was found."
|
||||
return 1 # Intel graphics device not found
|
||||
}
|
||||
|
||||
Main "$@"
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user