chia.sh 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. #!/bin/bash
  2. set -e
  3. Gui=No #can be Yes No or Only
  4. Service=No
  5. Version=3.0
  6. function print_centered {
  7. [[ $# == 0 ]] && return 1
  8. declare -i TERM_COLS="$(tput cols)"
  9. declare -i str_len="${#1}"
  10. [[ $str_len -ge $TERM_COLS ]] && {
  11. echo "$1";
  12. return 0;
  13. }
  14. declare -i filler_len="$(( (TERM_COLS - str_len) / 2 ))"
  15. [[ $# -ge 2 ]] && ch="${2:0:1}" || ch=" "
  16. filler=""
  17. for (( i = 0; i < filler_len; i++ )); do
  18. filler="${filler}${ch}"
  19. done
  20. printf "%s%s%s" "$filler" "$1" "$filler"
  21. [[ $(( (TERM_COLS - str_len) % 2 )) -ne 0 ]] && printf "%s" "${ch}"
  22. printf "\n"
  23. return 0
  24. }
  25. function jumpto
  26. {
  27. label=$1
  28. cmd=$(sed -n "/$label:/{:a;n;p;ba};" $0 | grep -v ':$')
  29. eval "$cmd"
  30. exit
  31. }
  32. print_centered "$(tput setaf 10)"
  33. print_centered " ______ __ __ "
  34. print_centered "| | |--.|__|.---.-."
  35. print_centered "| ---| || || _ |"
  36. print_centered "|______|__|__||__||___._|"
  37. echo -n "$(tput setaf 7)"
  38. print_centered "Toolkit for Chia v$Version"
  39. if [ $Gui = "Yes" ]
  40. then
  41. echo -n "$(tput setaf 3)"
  42. print_centered "Chia Gui + mining Enabled"
  43. echo -n "$(tput setaf 7)"
  44. fi
  45. if [ $Gui = "Only" ]
  46. then
  47. echo -n "$(tput setaf 3)"
  48. print_centered "Chia blockchain Gui Only"
  49. echo -n "$(tput setaf 7)"
  50. fi
  51. if [ $Gui = "No" ]
  52. then
  53. echo -n "$(tput setaf 3)"
  54. print_centered "Chia Mining Enabled"
  55. echo -n "$(tput setaf 7)"
  56. fi
  57. sleep 3
  58. echo -e "$(tput setaf 2)\nUpdate and install packages:$(tput sgr0)"
  59. sudo apt-get install python3-venv python3-distutils python3-dev libsodium-dev -y
  60. echo -e "\e[97mDone.\e[0m"
  61. if ! [ $Gui = "Only" ]
  62. then
  63. echo -e "$(tput setaf 2)\nDownload pack:$(tput sgr0)"
  64. wget -c -q --show-progress http://folivier.homelinux.org/cube/pack/chia-miner.tar.xz
  65. mv chia-miner.tar.xz /home/wareck/Build_Cube/pack/chia-miner.tar.xz
  66. echo -e "$(tput setaf 2)\nBuild Chia-Miner:$(tput sgr0)"
  67. cp ../pack/chia-miner.tar.xz /home/wareck/miners
  68. cd /home/wareck/miners
  69. tar xvfJ chia-miner.tar.xz
  70. rm chia-miner.tar.xz
  71. if [ $Service = "Yes" ]
  72. then
  73. cat <<'EOF'>> chia-miner.sh
  74. #!/bin/sh -e
  75. ### BEGIN INIT INFO
  76. # Provides: chiaminer
  77. # Required-Start: networking
  78. # Default-Start: 3 4 5
  79. # Default-Stop: 0 6
  80. ### END INIT INFO
  81. case "$1" in
  82. start)
  83. cd /home/wareck/miners/chia-miner/
  84. #su wareck -c "screen -dmS chia-miner /home/wareck/miners/chia-miner/hpool-miner-chia -config /home/wareck/miners/chia-miner/config.yaml"
  85. if ping -c 1 192.168.1.11
  86. then
  87. sleep 3
  88. su wareck -c "screen -dmS chia-miner /home/wareck/miners/chia-miner/hpool-miner-chia -config /home/wareck/miners/chia-miner/config_proxy.yaml"
  89. else
  90. sleep 3
  91. su wareck -c "screen -dmS chia-miner /home/wareck/miners/chia-miner/hpool-miner-chia -config /home/wareck/miners/chia-miner/config.yaml"
  92. fi
  93. ;;
  94. stop)
  95. sudo killall -9 hpool-miner-chia | true
  96. ;;
  97. *)
  98. echo "Usage: /etc/init.d/chia-miner {start|stop}"
  99. exit 1
  100. ;;
  101. esac
  102. exit 0
  103. EOF
  104. chmod +x chia-miner.sh
  105. sudo cp chia-miner.sh /etc/init.d/chia-miner
  106. sudo update-rc.d chia-miner defaults
  107. sudo rm chia-miner.sh
  108. fi
  109. echo -e "\e[97mDone.\e[0m"
  110. echo -e "$(tput setaf 2)\nBuild Chia-Plotter (MadMax) :$(tput sgr0)"
  111. cd /home/wareck
  112. if [ ! -d chia-plotter ]
  113. then
  114. git clone https://github.com/madMAx43v3r/chia-plotter.git
  115. else
  116. cd /home/wareck/chia-plotter
  117. git pull
  118. fi
  119. cd /home/wareck/chia-plotter
  120. git submodule init
  121. git submodule update
  122. ./make_devel.sh
  123. cd build
  124. cat <<'EOF'>> go.sh
  125. #!/bin/bash
  126. ./chia_plot -n 1 -r 4 -u 128 -t /media/Nvme/ -2 /media/Nvme/ -d /media/Partage/Plots/ -p a99e72c49c5ed39bf793caab9e074a80dd61011a859e975842874aab47b783f9ce84282febe2ca275c0930149b67990a -f 8ba5acd276b45fd0f749ce195dcddcf0e63c3bf2e751e9e273faa0125075c36a11f2ee231e7cf74abed2920be97fc373
  127. EOF
  128. chmod +x go.sh
  129. cat <<'EOF'>> nft.sh
  130. #!/bin/bash
  131. ./chia_plot -n 1 -r 4 -u 128 -t /media/Nvme/ -2 /media/Nvme/ -d /media/Partage/Plots-nft/ -c xch18c2jp56msc47yzww25wcnzz5fk9y268zl3zh357kftsp0n7l6m8scyqg4e -f 8ba5acd276b45fd0f749ce195dcddcf0e63c3bf2e751e9e273faa0125075c36a11f2ee231e7cf74abed2920be97fc373
  132. EOF
  133. chmod +x nft.sh
  134. echo -e "\e[97mDone.\e[0m"
  135. echo -e "$(tput setaf 2)\nBuild Chia-Pos:$(tput sgr0)"
  136. cd /home/wareck/
  137. if [ ! -d /home/wareck/chia-pos ]
  138. then
  139. git clone https://github.com/Chia-Network/chiapos.git chia-pos
  140. cd /home/wareck/chia-pos
  141. else
  142. cd /home/wareck/chia-pos
  143. git pull
  144. fi
  145. if [ ! -d build ]; then mkdir build;fi
  146. cd build
  147. cmake ..
  148. make -j4
  149. echo -e "\e[97mDone.\e[0m"
  150. fi
  151. if [ $Gui = "Yes" ] || [ $Gui = "Only" ]
  152. then
  153. echo -e "$(tput setaf 2)\nBuild Chia-Gui :$(tput sgr0)"
  154. cd /home/wareck
  155. if [ ! -d /home/wareck/chia-blockchain ]
  156. then
  157. git clone https://github.com/Chia-Network/chia-blockchain.git -b latest --recurse-submodules
  158. cd chia-blockchain
  159. else
  160. cd chia-blockchain
  161. git pull
  162. fi
  163. sh install.sh
  164. source ./activate
  165. sh install-gui.sh
  166. fi
  167. giga:
  168. echo -e "$(tput setaf 2)\nChiaGiga Horse:$(tput sgr0)"
  169. if [ -d /home/wareck/chia-gigahorse ]
  170. then
  171. cd /home/wareck/chia-gigahorse
  172. git pull
  173. else
  174. cd /home/wareck/
  175. git clone https://github.com/madMAx43v3r/chia-gigahorse.git
  176. fi
  177. sudo cp ~/chia-gigahorse/plot-sink/linux/x86_64/* /usr/local/bin/
  178. sudo cp ~/chia-gigahorse/cpu-plotter/linux/x86_64/* /usr/local/bin/
  179. cd ~
  180. if [ -f distrib_chia.sh ];then rm distrib_chia.sh;fi
  181. cat <<'EOF'>> distrib_chia.sh
  182. #!/bin/bash
  183. chia_plot_sink -p 1447 /Chia/Chia1/Plots-nft/ /Chia/Chia2/Plots-nft/ /Partage/Plots-nft/ /Cloud/Plots-nft/ /Store/Cloud/Plots-nft/
  184. EOF
  185. chmod +x distrib_chia.sh
  186. sudo cp distrib_chia.sh /usr/local/bin/
  187. cat <<'EOF'>> cpu_chiagh_plot.sh
  188. #!/bin/bash
  189. chia_plot_k34 -M 8 -C 7 -n -1 -t /Nvme/plotting/ -d /Chia/Chia2/Plots-nft/ \
  190. -c xch10yjksfwm8s66z32qy35x950608hk8l67vmsur4rwpaanpkd6ks3qhfw5nk \
  191. -f 8ba5acd276b45fd0f749ce195dcddcf0e63c3bf2e751e9e273faa0125075c36a11f2ee231e7cf74abed2920be97fc373
  192. EOF
  193. chmod +x cpu_chiagh_plot.sh
  194. cp cpu_chiagh_plot.sh ~/chia-plotter/build/
  195. rm ~/cpu_chiagh_plot.sh
  196. echo -e "\n\e[97mEnd of process...\e[0m"