summaryrefslogtreecommitdiffstats
path: root/hacks/ubuntu/install-wl.sh
diff options
context:
space:
mode:
authorAhmed Abdelhalim <[email protected]>2026-04-20 14:43:52 +0200
committerAhmed Abdelhalim <[email protected]>2026-04-20 14:48:09 +0200
commit8ee10fb59163977fb95fa688fcd6ee2409b48f02 (patch)
treef1c285250060eb74a0315b53b9424e808289b19a /hacks/ubuntu/install-wl.sh
parent5c2f4c0d74bcc321f3c34526c427456d3b03e9b9 (diff)
Add mac ubuntu install tasks
Add the hack scripts to download and install wifi drivers on Mac For ubuntu ISO, unlike archlinux, it doesn't ship with the wl drivers required for wifi to work on ubuntu, this is a hack workaround to download the missing dependencies on an external USB and use it on the Live ISO to install the missing drivers, allowing for the rest of automation to take place. Assisted-by: Claude (Sonnet 4.6)
Diffstat (limited to 'hacks/ubuntu/install-wl.sh')
-rwxr-xr-xhacks/ubuntu/install-wl.sh57
1 files changed, 57 insertions, 0 deletions
diff --git a/hacks/ubuntu/install-wl.sh b/hacks/ubuntu/install-wl.sh
new file mode 100755
index 0000000..04e1768
--- /dev/null
+++ b/hacks/ubuntu/install-wl.sh
@@ -0,0 +1,57 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+# Builds and loads the Broadcom BCM4360 wl driver on a Ubuntu live ISO.
+# Must be run with access to the debs downloaded by mac-drivers.sh.
+# gcc/make/binutils are extracted from the downloaded debs — not assumed pre-installed.
+#
+# Usage: bash install-wl.sh <path-to-debs-dir>
+
+usage() {
+ echo "Usage: $0 <debs-dir>"
+ echo " debs-dir: directory containing broadcom-sta-dkms and linux-headers debs"
+ exit 1
+}
+
+[[ $# -ne 1 ]] && usage
+
+DEBS_DIR="$1"
+KERNEL_VERSION="$(uname -r)"
+
+if [[ ! -d "$DEBS_DIR" ]]; then
+ echo "ERROR: $DEBS_DIR is not a directory" >&2
+ exit 1
+fi
+
+echo "Extracting packages to / (overlayfs — changes are in RAM, lost on reboot)..."
+for deb in "$DEBS_DIR"/*.deb; do
+ echo " $(basename "$deb")"
+ sudo dpkg -x "$deb" /
+done
+
+SRC_DIR=$(find /usr/src -maxdepth 1 -name "broadcom-sta-*" -type d 2>/dev/null | head -1)
+if [[ -z "$SRC_DIR" ]]; then
+ echo "ERROR: broadcom-sta source not found in /usr/src/ after extraction" >&2
+ exit 1
+fi
+
+if [[ ! -d "/lib/modules/$KERNEL_VERSION/build" ]]; then
+ echo "ERROR: /lib/modules/$KERNEL_VERSION/build not found" >&2
+ echo " Expected linux-headers-$KERNEL_VERSION to be extracted" >&2
+ exit 1
+fi
+
+echo "Building wl.ko for kernel $KERNEL_VERSION from $SRC_DIR..."
+sudo KBUILD_NOPEDANTIC=1 make \
+ -C "/lib/modules/$KERNEL_VERSION/build" \
+ M="$SRC_DIR" \
+ -j1
+
+echo "Unloading conflicting modules..."
+sudo rmmod wl 2>/dev/null || true
+sudo rmmod b43 ssb bcma brcmfmac brcmutil 2>/dev/null || true
+
+echo "Loading wl.ko..."
+sudo insmod "$SRC_DIR/wl.ko"
+sudo rfkill unblock all
+echo "Done."