#ndiswrapper_setup - designed to set up your bcm4318 wireless card
#Copyright (C) 2006 Jesse N. Richardson
#
#This program is free software; you can redistribute it and/or
#modify it under the terms of the GNU General Public License
#as published by the Free Software Foundation; either version 2
#of the License, or (at your option) any later version.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU General Public License
#along with this program; if not, write to the Free Software
#Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#!/bin/bash
ckreboot()
{
echo "Do you want to reboot now? y/n: "
read rb
if [[ $rb == "y" || $rb == "yes" ]]; then
echo "rebooting..."
sudo reboot
else
exit
fi
}
install()
{
echo "ndiswrapper_setup, Copyright (C) 2006 Jesse N. Richardson
ndiswrapper_setup comes with ABSOLUTELY NO WARRANTY; for details
type please see the file gpl.txt in the same directory as this program.
This is free software, and you are welcome to redistribute it
under certain conditions; type see the file gpl.txt in the same directory
as this program for details."
echo "Installing ndiswrapper..."
logsave -a wifisetup.log dpkg -i ndiswrapper.deb
echo "Extracting the drivers..."
tar -xf wifidrivers.tar.gz
echo "Deleting temporary files..."
rm wifidrivers.tar.gz
echo "Changing driver permissions..."
chmod 777 drivers
chmod 777 ndiswrapper.deb
echo "Changing working directory..."
cd drivers
echo "Removing previous attempts to use ndiswrapper, if any...please ignore errors in this section..."
logsave -a wifisetup.log rmmod ndiswrapper
logsave -a wifisetup.log ndiswrapper -e bcmwl5a
logsave -a wifisetup.log ndiswrapper -e bcmwl5
echo "Removing default driver..."
logsave -a wifisetup.log rmmod bcm43xx
echo "Installing driver through ndiswrapper..."
logsave -a wifisetup.log ndiswrapper -i ./bcmwl5.inf
logsave -a wifisetup.log ndiswrapper -l
logsave -a wifisetup.log ndiswrapper -m
echo "Modprobing ndiswrapper..."
logsave -a wifisetup.log modprobe ndiswrapper
echo "Moving back to original working directory..."
cd ..
echo "Deleting more temporary files..."
rm -rf drivers
rm ndiswrapper.deb
echo "Blacklisting bcm43xx..."
echo "# knock out the default broadcom driver that doesn't work for bcm4318 wifi cards..." >> /etc/modprobe.d/blacklist
echo "blacklist bcm43xx" >> /etc/modprobe.d/blacklist
echo "Adding ndiswrapper to /etc/modules, so it should load on boot..."
echo "ndiswrapper" >> /etc/modules
echo "Removing excess entries from your network interfaces file..."
cat /etc/network/interfaces | grep " lo" >> /etc/network/interfaces_new
mv /etc/network/interfaces /etc/network/interfaces.backup.bcm4318_setup
mv /etc/network/interfaces_new /etc/network/interfaces
echo "Searching for a wifi point..."
logsave -a wifi-setup.log iwlist eth1 scan
logsave -a wifi-setup.log dhclient
echo "Hopefully connected, you should be able to use the internet now..."
echo "Installing network-manager-gnome via apt-get, this requires an internet connection..."
logsave -a wifisetup.log apt-get --assume-yes install network-manger-gnome
echo "Installation completed."
rm ndiswrapper_setup
}
echo "This is the log of the ndiswrapper-setup script. See below for log details." >> wifisetup.log
if lspci -v | grep "BCM4318"; then
install
ckreboot
else
echo "You don't seem to have a Broadcom Wireless card. Pass the option --force to install anyways, but that's probably a bad idea."
fi
if [[ $1 == "--force" ]]; then
echo "--force option detected, forcing install." >> wifisetup.log
install
ckreboot
fi
exit