Update install.sh
This commit is contained in:
parent
bcffe84551
commit
f7e41d7c25
111
install.sh
111
install.sh
|
@ -1,6 +1,12 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Simple install script for 8188eu
|
# Simple install script for 8188eu
|
||||||
# December, 25 2022 v0.0.1 borislavIvanov
|
# December, 25 2022 v0.0.2 borislavIvanov
|
||||||
|
|
||||||
|
MODNAME="8188eu"
|
||||||
|
DRVNAME="rtl8188eu"
|
||||||
|
DRVVER="5.13.3"
|
||||||
|
KVER="$(uname -r)"
|
||||||
|
MODDESTDIR="/lib/modules/${KVER}/kernel/drivers/net/wireless/"
|
||||||
|
|
||||||
help () {
|
help () {
|
||||||
echo ""
|
echo ""
|
||||||
|
@ -8,8 +14,8 @@ help () {
|
||||||
echo ""
|
echo ""
|
||||||
echo "options:"
|
echo "options:"
|
||||||
echo ""
|
echo ""
|
||||||
echo " -i : Install Realtek RTL8188EU Wireless Lan Driver"
|
echo " -i : Install Realtek ${DRVNAME} Wireless Lan Driver"
|
||||||
echo " -u : Uninstall Realtek RTL8188EU Wireless Lan Driver"
|
echo " -u : Uninstall Realtek ${DRVNAME} Wireless Lan Driver"
|
||||||
echo " -h, --help : Displays this usage screen"
|
echo " -h, --help : Displays this usage screen"
|
||||||
echo ""
|
echo ""
|
||||||
exit
|
exit
|
||||||
|
@ -17,7 +23,7 @@ help () {
|
||||||
|
|
||||||
inst_drv () {
|
inst_drv () {
|
||||||
if ! command -v dkms >/dev/null 2>&1;then
|
if ! command -v dkms >/dev/null 2>&1;then
|
||||||
if [ ! -f "/lib/modules/$(uname -r)/kernel/drivers/net/wireless/8188eu.ko" ];then
|
if [ ! -f "${MODDESTDIR}${MODNAME}.ko" ];then
|
||||||
make clean; Error=$?
|
make clean; Error=$?
|
||||||
make; Error=$?
|
make; Error=$?
|
||||||
if [ "$Error" != "0" ];then
|
if [ "$Error" != "0" ];then
|
||||||
|
@ -32,18 +38,101 @@ if ! command -v dkms >/dev/null 2>&1;then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "Module rtl8188eu already installed"
|
echo "Module ${DRVNAME} already installed"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [[ ! "`dkms status`" =~ "rtl8188eu" ]];then
|
if [[ ! "`dkms status`" =~ "${DRVNAME}" ]];then
|
||||||
if [ -e /usr/src/rtl8188eu-5.13.3 ];then
|
if [ -e /usr/src/${DRVNAME}-${DRVVER} ];then
|
||||||
if [ "$EUID" != "0" ];then
|
if [ "$EUID" != "0" ];then
|
||||||
echo "You need root permissions:"
|
echo "You need root permissions:"
|
||||||
sudo rm -r /usr/src/rtl8188eu-5.13.3
|
sudo rm -r /usr/src/${DRVNAME}-${DRVVER}
|
||||||
sudo cp -r "$(pwd)" /usr/src/rtl8188eu-5.13.3
|
sudo cp -r "$(pwd)" /usr/src/${DRVNAME}-${DRVVER}
|
||||||
else
|
else
|
||||||
rm -r /usr/src/rtl8188eu-5.13.3
|
rm -r /usr/src/${DRVNAME}-${DRVVER}
|
||||||
cp -r "$(pwd)" /usr/src/rtl8188eu-5.13.3
|
cp -r "$(pwd)" /usr/src/${DRVNAME}-${DRVVER}
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if [ "$EUID" != "0" ];then
|
||||||
|
echo "You need root permissions:"
|
||||||
|
sudo cp -r "$(pwd)" /usr/src/${DRVNAME}-${DRVVER}
|
||||||
|
else
|
||||||
|
cp -r "$(pwd)" /usr/src/${DRVNAME}-${DRVVER}
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [ -f "${MODDESTDIR}${MODNAME}.ko" ];then
|
||||||
|
if [ "$EUID" != "0" ];then
|
||||||
|
echo "You need root permissions:"
|
||||||
|
sudo rm -f ${MODDESTDIR}${MODNAME}.ko
|
||||||
|
else
|
||||||
|
rm -f ${MODDESTDIR}${MODNAME}.ko
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [ "$EUID" != "0" ];then
|
||||||
|
echo "You need root permissions:"
|
||||||
|
sudo dkms add -m ${DRVNAME} -v ${DRVVER}; Error=$?
|
||||||
|
sudo dkms build -m ${DRVNAME} -v ${DRVVER}; Error=$?
|
||||||
|
else
|
||||||
|
dkms add -m ${DRVNAME} -v ${DRVVER}; Error=$?
|
||||||
|
dkms build -m ${DRVNAME} -v ${DRVVER}; Error=$?
|
||||||
|
fi
|
||||||
|
if [ "$Error" != "0" ];then
|
||||||
|
echo "Install error: $Error"
|
||||||
|
exit
|
||||||
|
else
|
||||||
|
if [ "$EUID" != "0" ];then
|
||||||
|
echo "You need root permissions:"
|
||||||
|
sudo dkms install -m ${DRVNAME} -v ${DRVVER}; Error=$?
|
||||||
|
else
|
||||||
|
dkms install -m ${DRVNAME} -v ${DRVVER}; Error=$?
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Module ${DRVNAME} already installed"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
uinst_drv () {
|
||||||
|
if ! command -v dkms >/dev/null 2>&1;then
|
||||||
|
if [ -f "${MODDESTDIR}${MODNAME}.ko" ];then
|
||||||
|
if [ "$EUID" != "0" ];then
|
||||||
|
echo "You need root permissions:"
|
||||||
|
sudo make uninstall; Error=$?
|
||||||
|
else
|
||||||
|
make uninstall; Error=$?
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Module ${DRVNAME} already uninstalled"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if [[ "`dkms status`" =~ "${DRVNAME}" ]];then
|
||||||
|
if [ "$EUID" != "0" ];then
|
||||||
|
echo "You need root permissions:"
|
||||||
|
sudo dkms remove -m ${DRVNAME} -v ${DRVVER} --all; Error=$?
|
||||||
|
else
|
||||||
|
dkms remove -m ${DRVNAME} -v ${DRVVER} --all; Error=$?
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Module ${DRVNAME} already uninstalled"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ -z "$1" ];then
|
||||||
|
echo "[options] is not defined"
|
||||||
|
help
|
||||||
|
elif [ "$1" = "-h" ] || [ "$1" = "--help" ];then
|
||||||
|
help
|
||||||
|
elif [ "$1" = "-i" ];then
|
||||||
|
echo "Install Realtek ${DRVNAME} Wireless Lan Driver..."
|
||||||
|
inst_drv
|
||||||
|
elif [ "$1" = "-u" ];then
|
||||||
|
echo "Uninstall Realtek ${DRVNAME} Wireless Lan Driver..."
|
||||||
|
uinst_drv
|
||||||
|
else
|
||||||
|
echo "Incorrect [options] "$1""
|
||||||
|
help
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [ "$EUID" != "0" ];then
|
if [ "$EUID" != "0" ];then
|
||||||
|
|
Loading…
Reference in New Issue