Votre Nom il y a 1 an
Parent
commit
d341f99547
1 fichiers modifiés avec 192 ajouts et 109 suppressions
  1. 192 109
      options/chia.sh

+ 192 - 109
options/chia.sh

@@ -1,9 +1,12 @@
 #!/bin/bash
 set -e
-Gui=Yes #can be Yes No or Only
-Service=No
-Version=3.0
-
+Gui=No #can be Yes No or Only
+Service=Yes
+Version=4.0
+MadMax=Yes
+GigaHorse=Yes
+BladeBit=Yes
+ChiaPos=Yes
 function print_centered {
      [[ $# == 0 ]] && return 1
 
@@ -35,7 +38,22 @@ function jumpto
     eval "$cmd"
     exit
 }
+function simplify_config {
+error_flag=0
+Gui=${Gui^^}
+Service=${Service^^}
+MadMax=${MadMax^^}
+GigaHorse=${GigaHorse^^}
+BladeBit=${BladeBit^^}
+ChiaPos=${ChiaPos^^}
+if ! [ $MadMax = "YES" ] || [ $MadMax = "NO" ];then error_flag=1;fi
+if ! [ $GigaHorse = "YES" ] || [ $GigaHorse = "NO" ];then error_flag=1;fi
+if ! [ $BladeBit = "YES" ] || [ $BladeBit = "NO" ];then error_flag=1;fi
+if ! [ $ChiaPos = "YES" ] || [ $ChiaPos = "NO" ];then error_flag=1;fi
+if ! [ $Service = "YES" ] || [ $Service = "NO" ];then error_flag=1;fi
+}
 
+function intro_ {
 print_centered "$(tput setaf 10)"
 print_centered " ______ __     __        "
 print_centered "|      |  |--.|__|.---.-."
@@ -43,87 +61,67 @@ print_centered "|   ---|     ||  ||  _  |"
 print_centered "|______|__|__||__||___._|"
 echo -n "$(tput sgr0)"
 print_centered "Toolkit for Chia v$Version"
-if [ $Gui = "Yes" ]
-then
-echo -n "$(tput setaf 3)"
-print_centered "Chia Gui + mining Enabled"
-echo -n "$(tput sgr0)"
-fi
-if [ $Gui = "Only" ]
+if [ $error_flag = 1 ]
 then
-echo -n "$(tput setaf 3)"
-print_centered "Chia blockchain Gui Only"
-echo -n "$(tput sgr0)"
-fi
-if [ $Gui = "No" ]
-then
-echo -n "$(tput setaf 3)"
-print_centered "Chia Mining Enabled"
-echo -n "$(tput sgr0)"
+        echo -n "$(tput setaf 1 ;tput blink;tput bold)"
+        print_centered "Config Error !!!"
+        echo -n "$(tput sgr0)"
+        exit 0
 fi
+case $Gui in
+YES)
+	echo -n "$(tput setaf 11)"
+	print_centered "Blockchain wallet + Gui"
+	print_centered "Chia Plotting Tools"
+	echo -n "$(tput sgr0)"
+	;;
+NO)
+        echo -n "$(tput setaf 11)"
+        print_centered "Chia Plotting Tools"
+        echo -n "$(tput sgr0)"
 
-sleep 3
-echo -e "$(tput setaf 2)\nUpdate and install packages:$(tput sgr0)"
-sudo apt-get install python3-venv python3-distutils python3-dev libsodium-dev -y
-if grep "Drivers=NVIDIA" ../build_cube.sh >/dev/null
+	;;
+ONLY)
+	echo -n "$(tput setaf 11)"
+	print_centered "Blockchain wallet Only"
+	echo -n "$(tput sgr0)"
+	;;
+*)
+	echo -n "$(tput setaf 1 ;tput blink;tput bold)"
+	print_centered "Config Error !!!"
+	echo -n "$(tput sgr0)"
+	exit 0
+	;;
+esac
+if [ $Gui = "NO" ] || [ $Gui = "YES" ]
 then
-sudo apt install libgomp1 ocl-icd-opencl-dev -y
+case $Service in
+YES)
+	echo -n "$(tput setaf 11)"
+	print_centered "Mining service Enabled"
+	echo -n "$(tput sgr0)"
+	;;
+esac
 fi
-echo -e "\e[97mDone.\e[0m"
-
-
-if ! [ $Gui = "Only" ]
-then
-echo -e "$(tput setaf 2)\nDownload pack:$(tput sgr0)"
-wget -c -q --show-progress http://folivier.homelinux.org/cube/pack/chia-miner.tar.xz -O /home/wareck/Build_Cube/pack/chia-miner.tar.xz
-
-echo -e "$(tput setaf 2)\nBuild Chia-Miner:$(tput sgr0)"
-cp ../pack/chia-miner.tar.xz /home/wareck/miners
-cd /home/wareck/miners
-tar xvfJ chia-miner.tar.xz
-rm chia-miner.tar.xz
+sleep 3
+}
 
-if [ $Service = "Yes" ]
+function update_ {
+echo -e "$(tput setaf 2)\nUpdate and install packages:$(tput sgr0)"
+sleep 1
+if grep "Drivers=NVIDIA" /home/wareck/Build_Cube/build_cube.sh >/dev/null
 then
-cat <<'EOF'>> chia-miner.sh
-#!/bin/sh -e
-### BEGIN INIT INFO
-# Provides:          chiaminer
-# Required-Start:    networking
-# Default-Start:     3 4 5
-# Default-Stop:      0 6
-### END INIT INFO
-case "$1" in
-        start)
-	cd /home/wareck/miners/chia-miner/
-	#su wareck -c "screen -dmS chia-miner /home/wareck/miners/chia-miner/hpool-miner-chia -config /home/wareck/miners/chia-miner/config.yaml"
-	if ping -c 1 192.168.1.11
-	then
-	sleep 3
-	su wareck -c "screen -dmS chia-miner /home/wareck/miners/chia-miner/hpool-miner-chia -config /home/wareck/miners/chia-miner/config_proxy.yaml"
-	else
-	sleep 3
-	su wareck -c "screen -dmS chia-miner /home/wareck/miners/chia-miner/hpool-miner-chia -config /home/wareck/miners/chia-miner/config.yaml"
-	fi
-	;;
-	stop)
-	sudo killall -9 hpool-miner-chia | true
-	;;
-        *)
-        echo "Usage: /etc/init.d/chia-miner {start|stop}"
-        exit 1
-        ;;
-esac
-exit 0
-EOF
-chmod +x chia-miner.sh
-sudo cp chia-miner.sh /etc/init.d/chia-miner
-sudo update-rc.d chia-miner defaults
-sudo rm chia-miner.sh
+extend="libgomp1 ocl-icd-opencl-dev libgmp-dev libnuma-dev"
+else
+extend=""
 fi
+sudo apt-get install python3-venv python3-distutils python3-dev libsodium-dev $extend -y
 echo -e "\e[97mDone.\e[0m"
+}
 
-echo -e "$(tput setaf 2)\nBuild Chia-Plotter (MadMax) :$(tput sgr0)"
+function chia_plotter {
+echo -e "$(tput setaf 2)\nBuild Chia-Plotter (MadMax4ever) :$(tput sgr0)"
+sleep 1
 cd /home/wareck
 if [ ! -d chia-plotter ]
 then
@@ -139,54 +137,37 @@ git submodule update
 cd build
 cat <<'EOF'>> go.sh
 #!/bin/bash
-./chia_plot -n 1 -r 4 -u 128 -t /media/nvme0/ -2 /media/nvme0/ -d /media/Partage/Plots/ -p a99e72c49c5ed39bf793caab9e074a80dd61011a859e975842874aab47b783f9ce84282febe2ca275c0930149b67990a -f 8ba5acd276b45fd0f749ce195dcddcf0e63c3bf2e751e9e273faa0125075c36a11f2ee231e7cf74abed2920be97fc373
+./chia_plot -n 1 -r 4 -u 128 -t /media/nvme0/ -2 /media/nvme0/ -d /media/Partage/Plots/ -p a99e72c49c5ed39bf7>
 EOF
 chmod +x go.sh
 
 cat <<'EOF'>> nft.sh
 #!/bin/bash
-./chia_plot -n 1 -r 4 -u 128 -t /media/nvme0/ -2 /media/nvme1/ -d /media/Partage/Plots-nft/ -c xch18c2jp56msc47yzww25wcnzz5fk9y268zl3zh357kftsp0n7l6m8scyqg4e -f 8ba5acd276b45fd0f749ce195dcddcf0e63c3bf2e751e9e273faa0125075c36a11f2ee231e7cf74abed2920be97fc373
+./chia_plot -n 1 -r 4 -u 128 -t /media/nvme0/ -2 /media/nvme1/ -d /media/Partage/Plots-nft/ -c xch18c2jp56msc>
 EOF
 chmod +x nft.sh
 echo -e "\e[97mDone.\e[0m"
+}
 
-echo -e "$(tput setaf 2)\nBuild Chia-Pos:$(tput sgr0)"
-cd /home/wareck/
-if [ ! -d  /home/wareck/chia-pos ]
+function bladebit {
+echo -e "$(tput setaf 2)\nBuild Bladebit v2 :$(tput sgr0)"
+sleep 1
+cd /home/wareck
+if [ ! -d bladebit ]
 then
-git clone https://github.com/Chia-Network/chiapos.git chia-pos
-cd /home/wareck/chia-pos
-else
-cd /home/wareck/chia-pos
-git pull
+git clone https://github.com/Chia-Network/bladebit.git
 fi
-if [ ! -d build ]; then mkdir build;fi
+cd /home/wareck/bladebit/
+if [ ! -d build ];then mkdir build;fi
 cd build
 cmake ..
 make -j6
 echo -e "\e[97mDone.\e[0m"
-fi
-
-if [ $Gui = "Yes" ] || [ $Gui = "Only" ]
-then
-echo -e "$(tput setaf 2)\nBuild Chia-Gui :$(tput sgr0)"
-cd /home/wareck
-if [ ! -d  /home/wareck/chia-blockchain ]
-then
-git clone https://github.com/Chia-Network/chia-blockchain.git -b latest --recurse-submodules
-cd chia-blockchain
-else
-cd chia-blockchain
-git pull
-fi
-sh install.sh
-source ./activate
-sh install-gui.sh
-fi
+}
 
-if ! [ $Gui = "Only" ]
-then
-echo -e "$(tput setaf 2)\nChiaGiga Horse:$(tput sgr0)"
+function gigahorse {
+echo -e "$(tput setaf 2)\nMadMax4ever GigaHorse:$(tput sgr0)"
+sleep 1
 if [ -d /home/wareck/chia-gigahorse ]
 then
 cd /home/wareck/chia-gigahorse
@@ -195,6 +176,7 @@ else
 cd /home/wareck/
 git clone https://github.com/madMAx43v3r/chia-gigahorse.git
 fi
+echo "generate bash files..."
 sudo cp ~/chia-gigahorse/plot-sink/linux/x86_64/* /usr/local/bin/
 sudo cp ~/chia-gigahorse/cpu-plotter/linux/x86_64/* /usr/local/bin/
 cd ~
@@ -203,7 +185,7 @@ if [ -f /usr/local/bin/distrib_chia.sh ];then sudo rm /usr/local/bin/distrib_chi
 cat <<'EOF'>> distrib_chia.sh
 #!/bin/bash
 echo "IP : $(hostname -I)"
-chia_plot_sink -p 1447 /Chia/Chia1/Plots-nft/ /Chia/Chia2/Plots-nft/ /Chia/Chia3/Plots-nft/ /Partage/Plots-nft/ /Cloud/Plots-nft/ /Store/Plots-nft/ /Exos/Plots-nft
+chia_plot_sink -p 1447 /Chia/Chia1/Plots-nft/ /Chia/Chia2/Plots-nft/ /Chia/Chia3/Plots-nft/ /Partage/Plots-nf>
 EOF
 chmod +x distrib_chia.sh
 sudo mv distrib_chia.sh /usr/local/bin/
@@ -217,7 +199,108 @@ EOF
 chmod +x ~/go.sh
 cp ~/go.sh ~/chia-gigahorse/cpu-plotter/linux/x86_64/
 rm ~/go.sh
+echo -e "\e[97mDone.\e[0m"
+}
+
+function chiapos {
+echo -e "$(tput setaf 2)\nBuild Chia-Pos:$(tput sgr0)"
+sleep 1
+cd /home/wareck/
+if [ ! -d  /home/wareck/chia-pos ]
+then
+git clone https://github.com/Chia-Network/chiapos.git chia-pos
+cd /home/wareck/chia-pos
+else
+cd /home/wareck/chia-pos
+git pull
 fi
+if [ ! -d build ]; then mkdir build;fi
+cd build
+cmake -DBUILD_PROOF_OF_SPACE_STATICALLY=ON ../
+cmake --build . -- -j 6
+echo -e "\e[97mDone.\e[0m"
+}
 
-echo -e "\n\e[97mEnd of process...\e[0m"
+function miner {
+echo -e "$(tput setaf 2)\nChia-Miner (hpool):$(tput sgr0)"
+sleep 1
+wget -c -q --show-progress http://folivier.homelinux.org/cube/pack/chia-miner.tar.xz -O /home/wareck/Build_Cube/pack/chia-miner.tar.xz
+cp /home/wareck/Build_Cube/pack/chia-miner.tar.xz /home/wareck/miners
+cd /home/wareck/miners
+tar xvfJ chia-miner.tar.xz
+rm chia-miner.tar.xz
+echo -e "\e[97mDone.\e[0m"
+}
+
+function chia_blockchain {
+echo -e "$(tput setaf 2)\nBuild Chia-blockchain & Gui :$(tput sgr0)"
+sleep 1
+cd /home/wareck
+if [ ! -d  /home/wareck/chia-blockchain ]
+then
+git clone https://github.com/Chia-Network/chia-blockchain.git -b latest --recurse-submodules
+cd chia-blockchain
+else
+cd chia-blockchain
+git pull
+fi
+sh install.sh
+source ./activate
+sh install-gui.sh
+echo -e "\e[97mDone.\e[0m"
+}
 
+function service_ {
+echo -e "$(tput setaf 2)\nInstall chia-miner service (hpool) :$(tput sgr0)"
+sleep 1
+echo "Generation du fichier /etc/init.d/chia-miner"
+cat <<'EOF'>> chia-miner.sh
+#!/bin/sh -e
+### BEGIN INIT INFO
+# Provides:          chiaminer
+# Required-Start:    networking
+# Default-Start:     3 4 5
+# Default-Stop:      0 6
+### END INIT INFO
+case "$1" in
+        start|restart)
+        cd /home/wareck/miners/chia-miner/
+	sudo killall -9 hpool-miner-chia > /dev/null 2>&1
+	sleep 1
+        su wareck -c "screen -dmS chia-miner /home/wareck/miners/chia-miner/hpool-miner-chia -config /home/wareck/miners/chia-miner/config.yaml"
+        ;;
+        stop)
+        sudo killall -9 hpool-miner-chia | true
+        ;;
+        *)
+        echo "Usage: /etc/init.d/chia-miner {start|stop|restart}"
+        exit 1
+        ;;
+esac
+exit 0
+EOF
+chmod +x chia-miner.sh
+sudo cp chia-miner.sh /etc/init.d/chia-miner
+sudo update-rc.d chia-miner defaults
+sudo rm chia-miner.sh
+echo -e "\e[97mDone.\e[0m"
+}
+
+simplify_config
+intro_
+update_
+case $Gui in
+YES|ONLY)
+        chia_blockchain
+        ;;
+NO)
+	if [ $MadMax = "YES" ];then chia_plotter;fi
+	if [ $BladeBit = "YES" ];then bladebit;fi
+	if [ $GigaHorse = "YES" ];then gigahorse;fi
+	if [ $ChiaPos = "YES" ];then chiapos;fi
+	if [ $Service = "YES" ];then service_;fi
+	;;
+*)
+        ;;
+esac
+echo -e "\n\e[97mEnd of process...\e[0m"