#!/bin/sh
# Description: Load proprietary Broadcom wireless driver at boot.
BLACKLIST=$(grep -E 'blacklist b43$' /etc/modprobe.d/blacklist.conf)

case "$1" in
	start)
		[ ! "$BLACKLIST" ] && echo blacklist b43 >> /etc/modprobe.d/blacklist.conf
		rmmod b43
		rmmod wl
		rmmod ssb_hcd
		rmmod ssb
		rmmod brcmsmac
		rmmod bcma
		rmmod lib80211
		rmmod mac80211
		rmmod cfg80211
		modprobe lib80211
		modprobe cfg80211
		modprobe wl
		;;

	stop)
		sed -i '/blacklist\ b43$/d' /etc/modprobe.d/blacklist.conf
		echo -n "Nothing to stop"
		;;
	
	restart)
		echo -n "Nothing to restart"
		;;
 	
	status)
		lsmod | grep -q "^wl " && echo "BC-wl is running." || echo "BC-wl is stopped."
		;;		
 
esac
unset BLACKLIST
