Advertisement
Rnery

Installing driver rtl8821CU Linux

Oct 15th, 2023
807
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.90 KB | Source Code | 0 0
  1. #!/usr/bin/env bash
  2.  
  3. _check_directory() {
  4.     if [[ -d build ]]; then
  5.         echo "O diretório /build já existe"
  6.     else
  7.         echo "Diretório /build criado!"
  8.         mkdir build
  9.     fi
  10. }
  11.  
  12. _check_git() {
  13.     local url="https://github.com/brektrou/rtl8821CU.git"
  14.     if wget -q --spider "$url"; then
  15.         return 0
  16.     else
  17.         return 1
  18.     fi
  19. }
  20.  
  21. _make_compile() {
  22.     _check_directory
  23.     cd build || exit 1
  24.  
  25.     if _check_git; then
  26.         git clone "https://github.com/brektrou/rtl8821CU.git"
  27.         cd rtl8821CU/ || exit 1
  28.         make && sudo make install
  29.     else
  30.         echo "Falha na operação."
  31.         exit 1
  32.     fi
  33. }
  34.  
  35. _check_driver() {
  36.     if ls /lib/modules/"$(uname -r)"/kernel/drivers/net/wireless/realtek/rtl8821cu &> /dev/null; then
  37.         echo "Instalado com sucesso!"
  38.     else
  39.         echo "Não instalado!"
  40.     fi
  41. }
  42.  
  43. _make_compile
  44. _check_driver
  45.  
Tags: BASH
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement