Advertisement
Rnery

Realtek..

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