123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- #!/bin/bash
- if [ ! -f /home/wareck/.lhr ]
- then
- if (( $EUID != 0 )); then
- echo -e "$(tput setaf 9)This must be run as root. Try 'sudo $0'.$(tput setaf 7)"
- exit 1
- fi
- fi
- function print_centered {
- [[ $# == 0 ]] && return 1
- declare -i TERM_COLS="$(tput cols)"
- declare -i str_len="${#1}"
- [[ $str_len -ge $TERM_COLS ]] && {
- echo "$1";
- return 0;
- }
- declare -i filler_len="$(( (TERM_COLS - str_len) / 2 ))"
- [[ $# -ge 2 ]] && ch="${2:0:1}" || ch=" "
- filler=""
- for (( i = 0; i < filler_len; i++ )); do
- filler="${filler}${ch}"
- done
- printf "%s%s%s" "$filler" "$1" "$filler"
- [[ $(( (TERM_COLS - str_len) % 2 )) -ne 0 ]] && printf "%s" "${ch}"
- printf "\n"
- return 0
- }
- function intro {
- if [ ! -f /home/wareck/.lhr ]
- then
- print_centered "$(tput bold)$(tput setaf 2)"
- print_centered " _______ .__ .___.__ ";
- print_centered " \ \___ _|__| __| _/|__|____ ";
- print_centered " / | \ \/ / |/ __ | | \__ \ ";
- print_centered "/ | \ /| / /_/ | | |/ __ \_";
- print_centered "\____|__ /\_/ |__\____ | |__(____ /";
- print_centered " \/ \/ \/ ";
- else
- print_centered "$(tput bold)$(tput setaf 2)"
- print_centered "Nvidia LHR kernel installer v1.0"
- fi
- echo -n "$(tput setaf 9)$(tput blink)"
- print_centered "LHR mining"
- echo -n "$(tput setaf 7)$(tput sgr0)"
- echo -n "$(tput setaf 7)"
- if ! [ -f /home/wareck/.rtx ]
- then
- echo -e ""
- print_centered "Vous devez d'abord installer NVIDIA-RTX (build_linux.sh)"
- print_centered ""
- exit
- fi
- }
- function nvidia_driver_ {
- if ! [ -f /home/wareck/.pass1 ]
- then
- cd /home/wareck/
- wget -c http://wareck.free.fr/genethos/NVIDIA-Linux-x86_64-470.129.06.run
- chmod +x /home/wareck/NVIDIA-Linux-x86_64-470.129.06.run
- touch /home/wareck/.pass1
- touch /home/wareck/.lhr
- sudo systemctl isolate multi-user.target
- fi
- if ! [ -f /home/wareck/.pass2 ]
- then
- sudo modprobe -r nvidia-drm
- cd /home/wareck/
- sudo ./NVIDIA-Linux-x86_64-470.129.06.run -a --install-compat32-libs --dkms --run-nvidia-xconfig --no-backup -q
- touch /home/wareck/.pass2
- fi
- if ! [ -f /home/wareck/.pass3 ]
- then
- sudo rm /home/wareck/.pass1
- sudo rm /home/wareck/.pass2
- sudo rm /home/wareck/.lhr
- sudo rm /home/wareck/NVIDIA-Linux-x86_64-470.129.06.run
- sudo rm /home/wareck/.config/autostart/build.desktop
- if grep "nvidia_lhr.sh" /home/wareck/.bashrc >/dev/null
- then
- sed -i '$ d' /home/wareck/.bashrc
- fi
- sudo systemctl start graphical.target
- fi
- }
- function autorunme {
- if [ ! -f /home/wareck/.lhr ]
- then
- if ! grep "wareck" /etc/sudoers >/dev/null
- then
- sudo sh -c "echo \"wareck ALL=(ALL) NOPASSWD: ALL\" >> /etc/sudoers"
- fi
- if ! grep "nvidia_lhr.sh" /home/wareck/.bashrc >/dev/null
- then
- echo "/home/wareck/backup_users_win10/build/nvidia_lhr.sh" >> /home/wareck/.bashrc
- fi
- if [ ! -d /home/wareck/.config/autostart ]
- then
- echo -e "$(tput setaf 10)\nInit install & autostart:$(tput sgr0)"
- mkdir /home/wareck/.config/autostart
- echo -e "Done."
- fi
- if [ ! -f /home/wareck/.config/autostart/build.desktop ]
- then
- cat <<'EOF'>> /home/wareck/.config/autostart/build.desktop
- [Desktop Entry]
- # VERSION=3.36.2
- Name=Terminal
- Comment=Use the command line
- Keywords=shell;prompt;command;commandline;cmd;
- TryExec=gnome-terminal
- Exec=gnome-terminal -- bash -c "/home/wareck/backup_users_win10/build/nvidia_lhr.sh"
- Icon=org.gnome.Terminal
- Type=Application
- Categories=GNOME;GTK;System;TerminalEmulator;
- StartupNotify=true
- X-GNOME-SingleWindow=false
- OnlyShowIn=GNOME;Unity;
- Actions=new-window;preferences;
- X-Ubuntu-Gettext-Domain=gnome-terminal
- [Desktop Action new-window]
- Name=New Window
- Exec=gnome-terminal --window
- [Desktop Action preferences]
- Name=Preferences
- Exec=gnome-terminal --preferences
- EOF
- chmod +x /home/wareck/.config/autostart/build.desktop
- fi
- fi
- }
- intro
- autorunme
- nvidia_driver_
|