dohack() {
  local conf="$BTRFS/@root/lib/modprobe.d/broadcom-wl-dkms.conf"

  say "Removing wl config"
  {
    run [ -f "$conf" ] && run mv "$conf"{,.bak}
    run root-append "$BTRFS/@root/etc/modprobe.d/blacklist.conf" "# Unload wl from initramfs
install wl /bin/true
"
  }

  say "Configuring BRCM43602 mac address"
  {
    [ -f "/sys/class/net/wlan0/address" ] \
      && mac="$(cat "/sys/class/net/wlan0/address")"
    sudo sed -i -e "s/macaddr=.*/macaddr=$mac/" \
      "$BTRFS/@root/lib/firmware/brcm/brcmfmac43602-pcie.txt"
  }
}

dohack
