chia.sh 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. #!/bin/bash
  2. set -e
  3. Version=2.3
  4. Gui=no #YES for gui build
  5. function print_centered {
  6. [[ $# == 0 ]] && return 1
  7. declare -i TERM_COLS="$(tput cols)"
  8. declare -i str_len="${#1}"
  9. [[ $str_len -ge $TERM_COLS ]] && {
  10. echo "$1";
  11. return 0;
  12. }
  13. declare -i filler_len="$(( (TERM_COLS - str_len) / 2 ))"
  14. [[ $# -ge 2 ]] && ch="${2:0:1}" || ch=" "
  15. filler=""
  16. for (( i = 0; i < filler_len; i++ )); do
  17. filler="${filler}${ch}"
  18. done
  19. printf "%s%s%s" "$filler" "$1" "$filler"
  20. [[ $(( (TERM_COLS - str_len) % 2 )) -ne 0 ]] && printf "%s" "${ch}"
  21. printf "\n"
  22. return 0
  23. }
  24. print_centered "$(tput setaf 10)"
  25. print_centered " ______ __ __ "
  26. print_centered "| | |--.|__|.---.-."
  27. print_centered "| ---| || || _ |"
  28. print_centered "|______|__|__||__||___._|"
  29. echo -n "$(tput setaf 7)"
  30. print_centered "Toolkit for Chia v$Version"
  31. if [ $Gui = "YES" ]
  32. then
  33. echo -n "$(tput setaf 7)"
  34. print_centered "(Gui / wallet enabled)"
  35. fi
  36. print_centered "$(tput setaf 7)"
  37. sleep 3
  38. echo -e "$(tput setaf 2)\nUpdate and install packages:$(tput sgr0)"
  39. sudo apt-get install python3-venv python3-distutils python3-dev libsodium-dev -y
  40. echo -e "\e[97mDone.\e[0m"
  41. echo -e "$(tput setaf 2)\nDownload pack:$(tput sgr0)"
  42. wget -c -q --show-progress http://folivier.homelinux.org/cube/pack/chia-miner.tar.xz
  43. mv chia-miner.tar.xz /home/wareck/Build_Cube/pack/chia-miner.tar.xz
  44. echo -e "$(tput setaf 2)\nBuild Chia-Miner:$(tput sgr0)"
  45. cp ../pack/chia-miner.tar.xz /home/wareck/
  46. cd /home/wareck
  47. tar xvfJ chia-miner.tar.xz
  48. rm chia-miner.tar.xz
  49. cat <<'EOF'>> chia-miner.sh
  50. #!/bin/sh -e
  51. ### BEGIN INIT INFO
  52. # Provides: chiaminer
  53. # Required-Start: networking
  54. # Default-Start: 3 4 5
  55. # Default-Stop: 0 6
  56. ### END INIT INFO
  57. cd /home/wareck/chia-miner/
  58. #su wareck -c "screen -dmS chia-miner /home/wareck/chia-miner/hpool-miner-chia -config /home/wareck/chia-miner/config.yaml"
  59. if ping -c 1 192.168.1.11
  60. then
  61. sleep 3
  62. su wareck -c "screen -dmS chia-miner /home/wareck/chia-miner/hpool-miner-chia -config /home/wareck/chia-miner/config_proxy.yaml"
  63. else
  64. sleep 3
  65. su wareck -c "screen -dmS chia-miner /home/wareck/chia-miner/hpool-miner-chia -config /home/wareck/chia-miner/config.yaml"
  66. fi
  67. exit 0
  68. EOF
  69. chmod +x chia-miner.sh
  70. sudo cp chia-miner.sh /etc/init.d/chia-miner
  71. sudo update-rc.d chia-miner defaults
  72. sudo rm chia-miner.sh
  73. echo -e "\e[97mDone.\e[0m"
  74. echo -e "$(tput setaf 2)\nBuild Chia-Plotter (MadMax) :$(tput sgr0)"
  75. cd /home/wareck
  76. if [ ! -d chia-plotter ]
  77. then
  78. git clone https://github.com/madMAx43v3r/chia-plotter.git
  79. else
  80. cd /home/wareck/chia-plotter
  81. git pull
  82. fi
  83. cd /home/wareck/chia-plotter
  84. git submodule init
  85. git submodule update
  86. ./make_devel.sh
  87. cd build
  88. cat <<'EOF'>> go.sh
  89. #!/bin/bash
  90. ./chia_plot -n 1 -r 4 -u 128 -t /media/Nvme/ -2 /media/Nvme/ -d /media/Partage/Plots/ -p a99e72c49c5ed39bf793caab9e074a80dd61011a859e975842874aab47b783f9ce84282febe2ca275c0930149b67990a -f 8ba5acd276b45fd0f749ce195dcddcf0e63c3bf2e751e9e273faa0125075c36a11f2ee231e7cf74abed2920be97fc373
  91. EOF
  92. chmod +x go.sh
  93. cat <<'EOF'>> nft.sh
  94. #!/bin/bash
  95. ./chia_plot -n 1 -r 4 -u 128 -t /media/Nvme/ -2 /media/Nvme/ -d /media/Partage/Plots-nft/ -c xch18c2jp56msc47yzww25wcnzz5fk9y268zl3zh357kftsp0n7l6m8scyqg4e -f 8ba5acd276b45fd0f749ce195dcddcf0e63c3bf2e751e9e273faa0125075c36a11f2ee231e7cf74abed2920be97fc373
  96. EOF
  97. chmod +x nft.sh
  98. echo -e "\e[97mDone.\e[0m"
  99. echo -e "$(tput setaf 2)\nBuild Chia-Pos:$(tput sgr0)"
  100. cd /home/wareck/
  101. if [ ! -d /home/wareck/chia-pos ]
  102. then
  103. git clone https://github.com/Chia-Network/chiapos.git chia-pos
  104. cd /home/wareck/chia-pos
  105. else
  106. cd /home/wareck/chia-pos
  107. git pull
  108. fi
  109. if [ ! -d build ]; then mkdir build;fi
  110. cd build
  111. cmake ..
  112. make -j4
  113. echo -e "\e[97mDone.\e[0m"
  114. if [ $Gui = "YES" ]
  115. then
  116. echo -e "$(tput setaf 2)\nBuild Chia-Gui :$(tput sgr0)"
  117. cd /home/wareck
  118. if [ ! -d /home/wareck/chia-pos ]
  119. then
  120. git clone https://github.com/Chia-Network/chia-blockchain.git -b latest --recurse-submodules
  121. cd chia-blockchain
  122. else
  123. cd chia-blockchain
  124. git pull
  125. fi
  126. sh install.sh
  127. source ./activate
  128. sh install-gui.sh
  129. fi
  130. echo -e "\n\e[97mEnd of process...\e[0m"