melhorando o script

This commit is contained in:
gmdutra 2017-11-14 10:54:05 -02:00
parent 29fff40b39
commit b21b8e9669

View File

@ -1,51 +1,63 @@
#!/bin/bash #!/bin/bash
if [ "$(id -u)" != "0" ]; then function vefificaRoot(){
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 1>&2 echo "This script must be run as root" 1>&2
exit 1 exit 1
fi fi
}
sudo apt install build-essential bc git wget function installDep(){
for dep in build-essential bc git wget; do
sudo apt install $dep
done
}
cd /usr/src function configure(){
git clone --depth 1 https://github.com/raspberrypi/linux.git cd /usr/src
git clone --depth 1 https://github.com/raspberrypi/linux.git
ln -s linux $(uname -r) ln -s linux $(uname -r)
ln -s /usr/src/linux /lib/modules/$(uname -r)/build ln -s /usr/src/linux /lib/modules/$(uname -r)/build
cd linux cd linux
wget -O Module.symvers https://raw.githubusercontent.com/raspberrypi/firmware/master/extra/Module7.symvers wget -O Module.symvers https://raw.githubusercontent.com/raspberrypi/firmware/master/extra/Module7.symvers
KERNEL=kernel7 KERNEL=kernel7
make bcm2709_defconfig && make prepare && make modules_prepare make bcm2709_defconfig && make prepare && make modules_prepare
sudo wget "https://raw.githubusercontent.com/notro/rpi-source/master/rpi-source" -O /usr/bin/rpi-source sudo wget "https://raw.githubusercontent.com/notro/rpi-source/master/rpi-source" -O /usr/bin/rpi-source
sudo chmod 755 /usr/bin/rpi-source sudo chmod 755 /usr/bin/rpi-source
rpi-source --skip-gcc rpi-source --skip-gcc
git clone "https://github.com/gnab/rtl8812au" git clone "https://github.com/gnab/rtl8812au"
cd rtl8812au cd rtl8812au
sed -i 's/CONFIG_PLATFORM_I386_PC = y/CONFIG_PLATFORM_I386_PC = n/g' Makefile sed -i 's/CONFIG_PLATFORM_I386_PC = y/CONFIG_PLATFORM_I386_PC = n/g' Makefile
sed -i 's/CONFIG_PLATFORM_ARM_RPI = n/CONFIG_PLATFORM_ARM_RPI = y/g' Makefile sed -i 's/CONFIG_PLATFORM_ARM_RPI = n/CONFIG_PLATFORM_ARM_RPI = y/g' Makefile
make make
sudo cp 8812au.ko /lib/modules/`uname -r`/kernel/drivers/net/wireless sudo cp 8812au.ko /lib/modules/`uname -r`/kernel/drivers/net/wireless
sudo depmod -a sudo depmod -a
sudo modprobe 8812au sudo modprobe 8812au
echo " echo "
***Success*** ***Success***
***Module will be activated automatically at next reboot*** ***Module will be activated automatically at next reboot***
" && " &&
while true; do while true; do
read -p "Do you wish to activate the module now? (y/n)" yn read -p "Do you wish to activate the module now? (y/n)" yn
case $yn in case $yn in
[Yy]* ) insmod 8812au.ko && echo "***Module activated***" && break;; [Yy]* ) insmod 8812au.ko && echo "***Module activated***" && break;;
[Nn]* ) exit;; [Nn]* ) exit;;
* ) echo "Please answer yes or no.";; * ) echo "Please answer yes or no.";;
esac esac
done done
}
verificaRoot
installDep
configure