Votre Nom 1 year ago
parent
commit
2510c021e1
4 changed files with 70 additions and 23 deletions
  1. 48 19
      build_cube.sh
  2. 12 1
      options/download_pack.sh
  3. 9 3
      options/watchdog.sh
  4. 1 0
      pack/clean.sh

+ 48 - 19
build_cube.sh

@@ -1,7 +1,7 @@
 #!/bin/bash
 set -e
 Version=14.9
-Cuda=No
+Cuda=YES
 kernel_custom=YES
 Webmin="webmin-2.021"
 kernel_dkms="5.15.0-71-generic"
@@ -48,7 +48,7 @@ function print_centered {
 
 function decompte_ {
 echo -e "$(tput setaf 10)\nReboot in 10 seconds (CRTL+C to abord):$(tput sgr0)"
-for i in {10..0}
+for i in {9..0}
 do
 echo -e -n "$i "
 sleep 1
@@ -155,32 +155,52 @@ if ! [ -f /home/wareck/.pass1 ]
 then
 	if ! [ -f /etc/modprobe.d/blacklist-nvidia-nouveau.conf ]
 	then
-			echo "Blacklist nvidia-nouveau driver..."
-			echo "System will reboot"
+        echo "Blacklist nvidia-nouveau driver..."
+        echo "System will reboot"
+        sudo bash -c "echo blacklist nouveau > /etc/modprobe.d/blacklist-nvidia-nouveau.conf"
+        sudo bash -c "echo options nouveau modeset=0 >> /etc/modprobe.d/blacklist-nvidia-nouveau.conf"
+        fi
+case $Cuda in
+NO)
 			sudo apt-get install build-essential libglvnd-dev -y
-			sudo bash -c "echo blacklist nouveau > /etc/modprobe.d/blacklist-nvidia-nouveau.conf"
-			sudo bash -c "echo options nouveau modeset=0 >> /etc/modprobe.d/blacklist-nvidia-nouveau.conf"
-			sudo update-initramfs -u
-			touch /home/wareck/.pass1
-			decompte_
-	fi
+			;;
+YES)
+			sudo apt-get install build-essential libglvnd-dev cmake libhugetlbfs-dev libc-dev libc6-dev g++ -y
+	                ;;
+*)
+   		        ;;
+esac
 
+#sudo update-initramfs -u
+touch /home/wareck/.pass1
+decompte_
 fi
 
 if ! [ -f /home/wareck/.pass2 ]
 then
-sleep 2
-
-echo -e "$(tput setaf 10)\nInstall NVIDIA GTX1080 Drivers :$(tput sgr0)"
-	cd /home/wareck/
-        #echo -e "Download MegaDownload:"
-        #git clone https://github.com/wareck/megadown.git
-        #sudo cp /home/wareck/megadown/megadown /usr/local/bin/megadown
-        #sudo rm -r /home/wareck/megadown
-        cd /home/wareck
+sleep 1
+case $Cuda in
+NO)
+	echo -e "$(tput setaf 10)\nInstall NVIDIA GTX1080 Drivers :$(tput sgr0)"
 	sudo apt-get install nvidia-driver-525 -y
 	touch /home/wareck/.pass2
 	decompte_
+	;;
+YES)
+	echo -e "$(tput setaf 10)\nInstall CUDA Drivers :$(tput sgr0)"
+	cd /home/wareck/
+	echo -e "Download MegaDownload:"
+	git clone https://github.com/wareck/megadown.git
+	sudo cp /home/wareck/megadown/megadown /usr/local/bin/megadown
+	sudo rm -r /home/wareck/megadown
+	megadown https://mega.nz/file/r0wwnZCJ#27WWRMwSsGYXiMUHf2OgcGYp2O2itChsBxcK9znmr5E
+	chmod +x cuda_11.8.0_520.61.05_linux.run
+	sudo ./cuda_11.8.0_520.61.05_linux.run
+	sudo rm cuda_11.8.0_520.61.05_linux.run
+	touch /home/wareck/.pass2
+	decompte_
+	;;
+esac
 fi
 }
 
@@ -855,6 +875,7 @@ if ! grep "wareck" /etc/sudoers >/dev/null
 then
 sudo sh -c "echo \"wareck ALL=(ALL) NOPASSWD: ALL\" >> /etc/sudoers"
 fi
+echo -e "$(tput setaf 10)\nUpdate and install packages:$(tput sgr0)"
 sudo apt-get update
 sudo apt-get install lxde lxde-icon-theme -y
 sleep 1
@@ -879,7 +900,15 @@ pids=""
 wait $pids
 }
 
+function watchdog_ {
+pids=""
+/home/wareck/Build_Cube/options/watchdog.sh ext & pids="$pids $!"
+wait $pids
+}
+
+
 intro_
+watchdog_
 autoroot_
 ubuntu_version_check
 update_

+ 12 - 1
options/download_pack.sh

@@ -4,13 +4,18 @@ if [ ! -d temp ]; then
 mkdir temp
 fi
 cd temp
-if grep "driver=AMD" /home/wareck/Build_Cube/build_cube.sh
+if grep "driver=AMD" /home/wareck/Build_Cube/build_cube.sh >/dev/null
 then
 driver="AMD"
 else
 driver="NVIDIA"
 fi
 
+if grep "Cuda=Yes" /home/wareck/Build_Cube/build_cube.sh >/dev/null
+then
+Cuda="YES"
+fi
+
 function download_copy {
 FILE=/home/wareck/Build_Cube/pack/$box
 if [ ! -f "$FILE" ]; then
@@ -53,6 +58,12 @@ box=amdgpu-install_5.4.50403-1_all.deb
 download_copy
 fi
 
+if [ $Cuda = "YES" ]
+then
+box=cuda_11.8.0_520.61.05_linux.run
+download_copy
+fi
+
 box=linux-firmware.tar.xz
 download_copy
 

+ 9 - 3
options/watchdog.sh

@@ -1,6 +1,8 @@
 #!/bin/bash
 set -e
-version=1.1
+version=1.2
+if [ -z $1 ];then mode="0";else mode="1";fi
+
 function print_centered {
      [[ $# == 0 ]] && return 1
 
@@ -24,7 +26,8 @@ function print_centered {
 
      return 0
 }
-
+if [ $mode = "0" ]
+then
 print_centered "$(tput setaf 9)"
 print_centered " _ _ _     _       _   ____          "
 print_centered "| | | |___| |_ ___| |_|    \ ___ ___ "
@@ -33,6 +36,7 @@ print_centered "|_____|__,|_| |___|_|_|____/|___|_  |"
 print_centered "                                |___|"
 echo -n "$(tput sgr0)"
 print_centered "Watchdog hardware v$version"
+fi
 
 if  [ -f /tmp/watchdog.1 ];then rm /tmp/watchdog.1;fi
 cat <<'EOF'>> /tmp/watchdog.1
@@ -62,7 +66,9 @@ sudo mv /tmp/crontab /etc/
 fi
 
 sudo /etc/init.d/cron restart >/dev/null
+if [ $mode = "0" ]
+then
 sleep 1
 print_centered "Installation Done..."
 print_centered ""
-
+fi

+ 1 - 0
pack/clean.sh

@@ -14,6 +14,7 @@ if [ -f gpu_miners.tar.xz ];then sudo rm gpu_miners.tar.xz ;fi
 if [ -f linux-firmware.tar.xz ]; then sudo rm linux-firmware.tar.xz;fi
 if [ -f gpu-miners.tar.xz ]; then sudo rm gpu-miners.tar.xz;fi
 if [ -f flexfarmer.tar.xz ]; then sudo rm flexfarmer.tar.xz;fi
+if [ -f cuda_11.8.0_520.61.05_linux.run ];then sudo rm cuda_11.8.0_520.61.05_linux.run;fi
 
 Webmin=$(grep "Webmin=" ../build_cube.sh  | cut -d '"' -f 2)
 if [ -f $Webmin.tar.xz ];then sudo rm $Webmin.tar.xz;fi