chia.sh 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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 2)"
  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. ./download_pack.sh
  43. echo -e "$(tput setaf 2)\nBuild Chia-Miner:$(tput sgr0)"
  44. cp ../pack/chia-miner.tar.xz /home/wareck/
  45. cd /home/wareck
  46. tar xvfJ chia-miner.tar.xz
  47. rm chia-miner.tar.xz
  48. cat <<'EOF'>> chia-miner.sh
  49. #!/bin/sh -e
  50. ### BEGIN INIT INFO
  51. # Provides: chiaminer
  52. # Required-Start: networking
  53. # Default-Start: 3 4 5
  54. # Default-Stop: 0 6
  55. ### END INIT INFO
  56. cd /home/wareck/chia-miner/
  57. su wareck -c "screen -dmS chia-miner /home/wareck/chia-miner/hpool-miner-chia -config /home/wareck/chia-miner/config.yaml"
  58. exit 0
  59. EOF
  60. chmod +x chia-miner.sh
  61. sudo cp chia-miner.sh /etc/init.d/chia-miner
  62. sudo update-rc.d chia-miner defaults
  63. sudo rm chia-miner.sh
  64. echo -e "\e[97mDone.\e[0m"
  65. echo -e "$(tput setaf 2)\nBuild Chia-Plotter (MadMax) :$(tput sgr0)"
  66. cd /home/wareck
  67. if [ ! -d chia-plotter ]
  68. then
  69. git clone https://github.com/madMAx43v3r/chia-plotter.git
  70. else
  71. cd /home/wareck/chia-plotter
  72. git pull
  73. fi
  74. cd /home/wareck/chia-plotter
  75. git submodule init
  76. git submodule update
  77. ./make_devel.sh
  78. cd build
  79. cat <<'EOF'>> go.sh
  80. #!/bin/bash
  81. ./chia_plot -n 1 -r 4 -u 128 -t /media/Nvme/ -2 /media/Nvme/ -d /media/Partage/Plots/ -p a99e72c49c5ed39bf793caab9e074a80dd61011a859e975842874aab47b783f9ce84282febe2ca275c0930149b67990a -f 8ba5acd276b45fd0f749ce195dcddcf0e63c3bf2e751e9e273faa0125075c36a11f2ee231e7cf74abed2920be97fc373
  82. EOF
  83. chmod +x go.sh
  84. cat <<'EOF'>> nft.sh
  85. #!/bin/bash
  86. ./chia_plot -n 1 -r 4 -u 128 -t /media/Nvme/ -2 /media/Nvme/ -d /media/Partage/Plots-nft/ -c xch18c2jp56msc47yzww25wcnzz5fk9y268zl3zh357kftsp0n7l6m8scyqg4e -f 8ba5acd276b45fd0f749ce195dcddcf0e63c3bf2e751e9e273faa0125075c36a11f2ee231e7cf74abed2920be97fc373
  87. EOF
  88. chmod +x nft.sh
  89. echo -e "\e[97mDone.\e[0m"
  90. echo -e "$(tput setaf 2)\nBuild Chia-Pos:$(tput sgr0)"
  91. cd /home/wareck/
  92. if [ ! -d /home/wareck/chia-pos ]
  93. then
  94. git clone https://github.com/Chia-Network/chiapos.git chia-pos
  95. cd /home/wareck/chia-pos
  96. else
  97. cd /home/wareck/chia-pos
  98. git pull
  99. fi
  100. if [ ! -d build ]; then mkdir build;fi
  101. cd build
  102. cmake ..
  103. make -j4
  104. echo -e "\e[97mDone.\e[0m"
  105. if [ $Gui = "YES" ]
  106. then
  107. echo -e "$(tput setaf 2)\nBuild Chia-Gui :$(tput sgr0)"
  108. cd /home/wareck
  109. if [ ! -d /home/wareck/chia-pos ]
  110. then
  111. git clone https://github.com/Chia-Network/chia-blockchain.git -b latest --recurse-submodules
  112. cd chia-blockchain
  113. else
  114. cd chia-blockchain
  115. git pull
  116. fi
  117. sh install.sh
  118. source ./activate
  119. sh install-gui.sh
  120. fi
  121. echo -e "\n\e[97mEnd of process...\e[0m"