chia.sh 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600
  1. #!/bin/bash
  2. #set -e
  3. Version=6.0.1
  4. Gui=Yes #can be Yes No or Only
  5. GigaHorse_farmer=Yes
  6. MadMax=Yes
  7. GigaHorse=Yes
  8. BladeBit=No
  9. ChiaPos=Yes
  10. H9_ChiaService=No
  11. H9_Miner=No
  12. H9_ChiaProxy=No
  13. FoxyPool=Yes
  14. FoxyPool_service=No
  15. function print_centered {
  16. [[ $# == 0 ]] && return 1
  17. declare -i TERM_COLS="$(tput cols)"
  18. declare -i str_len="${#1}"
  19. [[ $str_len -ge $TERM_COLS ]] && {
  20. echo "$1";
  21. return 0;
  22. }
  23. declare -i filler_len="$(( (TERM_COLS - str_len) / 2 ))"
  24. [[ $# -ge 2 ]] && ch="${2:0:1}" || ch=" "
  25. filler=""
  26. for (( i = 0; i < filler_len; i++ )); do
  27. filler="${filler}${ch}"
  28. done
  29. printf "%s%s%s" "$filler" "$1" "$filler"
  30. [[ $(( (TERM_COLS - str_len) % 2 )) -ne 0 ]] && printf "%s" "${ch}"
  31. printf "\n"
  32. return 0
  33. }
  34. #function jumpto
  35. #{
  36. # label=$1
  37. # cmd=$(sed -n "/$label:/{:a;n;p;ba};" $0 | grep -v ':$')
  38. # eval "$cmd"
  39. # exit
  40. #}
  41. function simplify_config {
  42. error_flag=0
  43. Gui=${Gui^^}
  44. H9_ChiaService=${H9_ChiaService^^}
  45. MadMax=${MadMax^^}
  46. GigaHorse=${GigaHorse^^}
  47. GigaHorse_farmer=${GigaHorse_farmer^^}
  48. BladeBit=${BladeBit^^}
  49. ChiaPos=${ChiaPos^^}
  50. H9_Miner=${H9_Miner^^}
  51. H9_ChiaProxy=${H9_ChiaProxy^^}
  52. FoxyPool=${FoxyPool^^}
  53. FoxyPool_service=${FoxyPool_service^^}
  54. if [[ "$Gui" == "YES" ]] || [[ "$Gui" == "NO" ]] || [[ "$Gui" == "ONLY" ]];then error_flag=$((error_flag+0));else error_flag=$((error_flag+1)) ;fi
  55. if [[ "$MadMax" == "YES" ]] || [[ "$MadMax" = "NO" ]];then error_flag=$((error_flag+0));else error_flag=$((error_flag+1)) ;fi
  56. if [[ "$GigaHorse" == "YES" ]] || [[ "$GigaHorse" == "NO" ]];then error_flag=$((error_flag+0));else error_flag=$((error_flag+1));fi
  57. if [[ "$GigaHorse_farmer" == "YES" ]] || [[ "$GigaHorse_farmer" == "NO" ]];then error_flag=$((error_flag+0));else error_flag=$((error_flag+1));fi
  58. if [[ "$BladeBit" == "YES" ]] || [[ "$BladeBit" == "NO" ]];then error_flag=$((error_flag+0));else error_flag=$((error_flag+1));fi
  59. if [[ "$ChiaPos" == "YES" ]] || [[ "$ChiaPos" == "NO" ]];then error_flag=$((error_flag+0));else error_flag=$((error_flag+1));fi
  60. if [[ "$H9_ChiaService" == "YES" ]] || [[ "$H9_ChiaService" == "NO" ]];then error_flag=$((error_flag+0));else error_flag=$((error_flag+1));fi
  61. if [[ "$H9_Miner" == "YES" ]] || [[ "$H9_Miner" == "NO" ]];then error_flag=$((error_flag+0));else error_flag=$((error_flag+1));fi
  62. if [[ "$H9_ChiaProxy" == "YES" ]] || [[ "$H9_ChiaProxy" == "NO" ]];then error_flag=$((error_flag+0));else error_flag=$((error_flag+1));fi
  63. if [[ "$FoxyPool" == "YES" ]] || [[ "$FoxyPool" == "NO" ]];then error_flag=$((error_flag+0));else error_flag=$((error_flag+1));fi
  64. if [[ "$FoxyPool_service" == "YES" ]] || [[ "$FoxyPool_service" == "NO" ]];then error_flag=$((error_flag+0));else error_flag=$((error_flag+1));fi
  65. }
  66. function intro_ {
  67. export TERM=xterm-256color
  68. print_centered "$(tput setaf 10)"
  69. print_centered " ______ __ __ "
  70. print_centered "| | |--.|__|.---.-."
  71. print_centered "| ---| || || _ |"
  72. print_centered "|______|__|__||__||___._|"
  73. echo -n "$(tput sgr0)"
  74. print_centered "Toolkit for Chia v$Version"
  75. echo ""
  76. if [ $error_flag -ne 0 ]
  77. then
  78. echo -n "$(tput setaf 1 ;tput blink;tput bold)"
  79. print_centered "Config Error !!! $error_flag"
  80. echo -n "$(tput sgr0)"
  81. exit 0
  82. fi
  83. case $Gui in
  84. YES)
  85. echo -n "$(tput setaf 40)"
  86. print_centered "Blockchain wallet + Gui"
  87. echo -n "$(tput sgr0)"
  88. echo -n "$(tput setaf 11)"
  89. print_centered "Chia Plotting Tools"
  90. echo -n "$(tput sgr0)"
  91. ;;
  92. NO)
  93. echo -n "$(tput setaf 11)"
  94. print_centered "Chia Plotting Tools"
  95. echo -n "$(tput sgr0)"
  96. ;;
  97. ONLY)
  98. echo -n "$(tput setaf 41)"
  99. print_centered "Blockchain + GUI wallet Only"
  100. echo -n "$(tput sgr0)"
  101. ;;
  102. *)
  103. echo -n "$(tput setaf 1 ;tput blink;tput bold)"
  104. print_centered "Config Error !!!"
  105. echo -n "$(tput sgr0)"
  106. exit 0
  107. ;;
  108. esac
  109. if [ $Gui = "NO" ] || [ $Gui = "YES" ]
  110. then
  111. case $GigaHorse_farmer in
  112. YES)
  113. echo -n "$(tput setaf 42)"
  114. print_centered "GigaHorse Farmer"
  115. echo -n "$(tput sgr0)"
  116. ;;
  117. esac
  118. case $H9_ChiaService in
  119. YES)
  120. echo -n "$(tput setaf 43)"
  121. print_centered "Mining service Enabled"
  122. echo -n "$(tput sgr0)"
  123. ;;
  124. esac
  125. case $H9_ChiaProxy in
  126. YES)
  127. echo -n "$(tput setaf 43)"
  128. print_centered "Hpool x-Proxy Enabled"
  129. echo -n "$(tput sgr0)"
  130. ;;
  131. esac
  132. case $FoxyPool in
  133. YES)
  134. echo -n "$(tput setaf 44)"
  135. print_centered "FoxyPool"
  136. echo -n "$(tput sgr0)"
  137. ;;
  138. esac
  139. fi
  140. sleep 2
  141. if ! [ -d /home/wareck/chia ];then mkdir /home/wareck/chia;fi
  142. }
  143. function GigaHorse_farmer_ {
  144. echo -e "$(tput setaf 10)\nInstall GigaHorse Farmer$(tput sgr0)"
  145. if ! [ -d /home/wareck/blockchain ];then mkdir /home/wareck/blockchain;fi
  146. cd /home/wareck/blockchain/
  147. GigaHorse_link=https://github.com/madMAx43v3r/chia-gigahorse/releases/download/v2.1.1.giga25/chia-gigahorse-farmer-2.1.1.giga25-x86_64.tar.gz
  148. wget -c -q --show-progress $GigaHorse_link -O chia-gigahorse-farmer.tar.gz
  149. tar xfz chia-gigahorse-farmer.tar.gz --checkpoint=.1000
  150. rm chia-gigahorse-farmer.tar.gz
  151. echo -e "\n\e[97mDone.\e[0m"
  152. }
  153. function update_ {
  154. echo -e "$(tput setaf 10)\nUpdate and install packages:$(tput sgr0)"
  155. extend="libgomp1 ocl-icd-opencl-dev libgmp-dev libnuma-dev"
  156. sudo apt-get install python3-venv python3-distutils python3-dev libsodium-dev $extend -y
  157. echo -e "\e[97mDone.\e[0m"
  158. }
  159. function chia_plotter {
  160. echo -e "$(tput setaf 10)\nBuild Chia-Plotter (MadMax4ever) :$(tput sgr0)"
  161. sleep 1
  162. cd /home/wareck/chia/
  163. if [ ! -d chia-plotter ]
  164. then
  165. git clone https://github.com/madMAx43v3r/chia-plotter.git
  166. else
  167. cd /home/wareck/chia/chia-plotter
  168. git pull
  169. fi
  170. cd /home/wareck/chia/chia-plotter
  171. git submodule init
  172. git submodule update
  173. ./make_devel.sh
  174. cd build
  175. if [ -f go.sh ];then rm go.sh ;fi
  176. cat <<'EOF'>> go.sh
  177. #!/bin/bash
  178. POOL=a99e72c49c5ed39bf793caab9e074a80dd61011a859e975842874aab47b783f9ce84282febe2ca275c0930149b67990a
  179. FARM=8ba5acd276b45fd0f749ce195dcddcf0e63c3bf2e751e9e273faa0125075c36a11f2ee231e7cf74abed2920be97fc373
  180. OUT=/media/Partage/Plots/
  181. ./chia_plot -p $POOL -f $FARM -n 1 -r 6 -u 128 -t /nvme0/plotting/ -2 /nvme0/plotting/ -d $OUT
  182. EOF
  183. chmod +x go.sh
  184. if [ -f nft.sh ];then rm nft.sh; fi
  185. cat <<'EOF'>> nft.sh
  186. #!/bin/bash
  187. POOL=a99e72c49c5ed39bf793caab9e074a80dd61011a859e975842874aab47b783f9ce84282febe2ca275c0930149b67990a
  188. FARM=8ba5acd276b45fd0f749ce195dcddcf0e63c3bf2e751e9e273faa0125075c36a11f2ee231e7cf74abed2920be97fc373
  189. OUT=/media/Partage/Plots-nft/
  190. ./chia_plot -p $POOL -f $FARM -n 1 -r 4 -u 128 -t /nvme0/plotting/ -2 /nvme1/plotting/ -d $OUT
  191. EOF
  192. chmod +x nft.sh
  193. if [ -f foxy.sh ];then rm foxy.sh; fi
  194. cat <<'EOF'>> foxy.sh
  195. #!/bin/bash
  196. POOL=a99e72c49c5ed39bf793caab9e074a80dd61011a859e975842874aab47b783f9ce84282febe2ca275c0930149b67990a
  197. FARM=8ba5acd276b45fd0f749ce195dcddcf0e63c3bf2e751e9e273faa0125075c36a11f2ee231e7cf74abed2920be97fc373
  198. OUT=/media/Partage/Plots-nft/
  199. ./chia_plot -p $POOL -f $FARM -n 1 -r 4 -u 128 -t /nvme0/plotting/ -2 /nvme1/plotting/ -d $OUT
  200. EOF
  201. chmod +x foxy.sh
  202. echo -e "\e[97mDone.\e[0m"
  203. }
  204. function bladebit {
  205. echo -e "$(tput setaf 10)\nBuild Bladebit v2 :$(tput sgr0)"
  206. sleep 1
  207. cd /home/wareck/chia
  208. if [ ! -d bladebit ]
  209. then
  210. git clone https://github.com/Chia-Network/bladebit.git
  211. fi
  212. cd /home/wareck/chia/bladebit/
  213. if [ ! -d build ];then mkdir build;fi
  214. cd build
  215. sed -i "s/FatalIf( cfg.compressionLevel >/\/\/FatalIf( cfg.compressionLevel/g" /home/wareck/chia/bladebit/src/main.cpp
  216. cmake ..
  217. make -j 6
  218. if [ -f cuda.sh ]; then rm cuda.sh ;fi
  219. cat <<'EOF'>> cuda.sh
  220. #!/bin/bash
  221. POOL=a99e72c49c5ed39bf793caab9e074a80dd61011a859e975842874aab47b783f9ce84282febe2ca275c0930149b67990a
  222. FARM=8ba5acd276b45fd0f749ce195dcddcf0e63c3bf2e751e9e273faa0125075c36a11f2ee231e7cf74abed2920be97fc373
  223. OUT=/farm/farm0/Plots
  224. for i in {1..5}
  225. do
  226. ./bladebit_cuda --no-direct-io -p $POOL -f $FARM -z 7 cudaplot -d 0 --disk-16 -t1 /raid/plotting $OUT
  227. done
  228. #sudo reboot
  229. #/home/wareck/miners/chia-miner/hpool-miner-chia -config /home/wareck/miners/chia-miner/config.yaml
  230. EOF
  231. if [ -f flex.sh ]; then rm flex.sh ;fi
  232. cat <<'EOF'>> flex.sh
  233. #!/bin/bash
  234. CRT=xch10yjksfwm8s66z32qy35x950608hk8l67vmsur4rwpaanpkd6ks3qhfw5nk
  235. FRM=8ba5acd276b45fd0f749ce195dcddcf0e63c3bf2e751e9e273faa0125075c36a11f2ee231e7cf74abed2920be97fc373
  236. OUT=/media/Partage/Plots-nft/
  237. ./bladebit -f $FRM -c $CRT diskplot --cache 100G -t1 /nvme1/plotting/ -t2 /nvme1/plotting/ $OUT
  238. EOF
  239. if [ -f foxy.sh ]; then rm foxy.sh ;fi
  240. cat <<'EOF'>> foxy.sh
  241. #!/bin/bash
  242. CRT=xch10yjksfwm8s66z32qy35x950608hk8l67vmsur4rwpaanpkd6ks3qhfw5nk
  243. FRM=8ba5acd276b45fd0f749ce195dcddcf0e63c3bf2e751e9e273faa0125075c36a11f2ee231e7cf74abed2920be97fc373
  244. OUT=/media/Partage/Plots-nft/
  245. ./bladebit -f $FRM -c $CRT diskplot --cache 100G -t1 /nvme1/plotting/ -t2 /nvme1/plotting/ $OUT
  246. EOF
  247. chmod +x cuda.sh
  248. chmod +x flex.sh
  249. chmod +x foxy.sh
  250. echo -e "\e[97mDone.\e[0m"
  251. }
  252. function gigahorse {
  253. echo -e "$(tput setaf 10)\nMadMax4ever GigaHorse:$(tput sgr0)"
  254. sleep 1
  255. if [ -d /home/wareck/chia/chia-gigahorse ]
  256. then
  257. cd /home/wareck/chia/chia-gigahorse
  258. git pull
  259. else
  260. cd /home/wareck/chia/
  261. git clone https://github.com/madMAx43v3r/chia-gigahorse.git
  262. fi
  263. echo "generate bash files..."
  264. sudo cp ~/chia/chia-gigahorse/plot-sink/linux/x86_64/* /usr/local/bin/
  265. sudo cp ~/chia/chia-gigahorse/cpu-plotter/linux/x86_64/* /usr/local/bin/
  266. sudo cp ~/chia/chia-gigahorse/chiapos/linux/x86_64/ProofOfSpace /usr/local/bin/
  267. cd ~
  268. if [ -f distrib_chia.sh ];then sudo rm distrib_chia.sh;fi
  269. if [ -f /usr/local/bin/distrib_chia.sh ];then sudo rm /usr/local/bin/distrib_chia.sh;fi
  270. cat <<'EOF'>> distrib_chia.sh
  271. #!/bin/bash
  272. echo "IP : $(hostname -I)"
  273. chia_plot_sink /farm/farm0/Plots/ /farm/farm1/Plots/ /farm/farm2/Plots/ /farm/farm3/Plots/ /farm/farm4/Plots/ /Partage/Plots/
  274. EOF
  275. chmod +x distrib_chia.sh
  276. sudo mv distrib_chia.sh /usr/local/bin/
  277. if [ -f go.sh ];then rm go.sh;fi
  278. cat <<'EOF'>> ~/go.sh
  279. #!/bin/bash
  280. CRT=xch10yjksfwm8s66z32qy35x950608hk8l67vmsur4rwpaanpkd6ks3qhfw5nk
  281. FRM=8ba5acd276b45fd0f749ce195dcddcf0e63c3bf2e751e9e273faa0125075c36a11f2ee231e7cf74abed2920be97fc373
  282. OUT=@192.168.1.100
  283. ./chia_plot -c $CRT -f $FRM -G -r 6 -z 1447 -C 8 -n -1 -t /nvme0/plotting/ -2 /nvme1/plotting/ -d $OUT
  284. EOF
  285. chmod +x ~/go.sh
  286. cp ~/go.sh ~/chia/chia-gigahorse/cpu-plotter/linux/x86_64/
  287. rm ~/go.sh
  288. cat <<'EOF'>> ~/foxy.sh
  289. #!/bin/bash
  290. CRT=xch10yjksfwm8s66z32qy35x950608hk8l67vmsur4rwpaanpkd6ks3qhfw5nk
  291. FRM=8ba5acd276b45fd0f749ce195dcddcf0e63c3bf2e751e9e273faa0125075c36a11f2ee231e7cf74abed2920be97fc373
  292. OUT=@192.168.1.100
  293. ./chia_plot -c $CRT -f $FRM -G -r 6 -z 1447 -C 8 -n -1 -t /nvme0/plotting/ -2 /nvme1/plotting/ -d $OUT
  294. EOF
  295. chmod +x ~/foxy.sh
  296. cp ~/foxy.sh ~/chia/chia-gigahorse/cpu-plotter/linux/x86_64/
  297. rm ~/foxy.sh
  298. echo -e "\e[97mDone.\e[0m"
  299. }
  300. function chiapos {
  301. echo -e "$(tput setaf 10)\nBuild Chia-Pos:$(tput sgr0)"
  302. sleep 1
  303. cd /home/wareck/chia
  304. if [ ! -d /home/wareck/chia/chia-pos ]
  305. then
  306. git clone https://github.com/Chia-Network/chiapos.git chia-pos
  307. cd /home/wareck/chia/chia-pos
  308. else
  309. cd /home/wareck/chia/chia-pos
  310. git pull
  311. fi
  312. if [ ! -d build ]; then mkdir build;fi
  313. cd build
  314. cmake ..
  315. cmake --build . -- -j 6
  316. echo -e "\e[97mDone.\e[0m"
  317. }
  318. function miner_ {
  319. echo -e "$(tput setaf 10)\nChia-Miner (hpool):$(tput sgr0)"
  320. sleep 1
  321. 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
  322. cp /home/wareck/Build_Cube/pack/chia-miner.tar.xz /home/wareck/miners
  323. cd /home/wareck/miners
  324. tar xvfJ chia-miner.tar.xz
  325. rm chia-miner.tar.xz
  326. echo -e "\e[97mDone.\e[0m"
  327. }
  328. function chia_blockchain {
  329. echo -e "$(tput setaf 10)\nBuild Chia-blockchain & Gui :$(tput sgr0)"
  330. sleep 1
  331. if ! [ -d /home/wareck/blockchain ];then mkdir /home/wareck/blockchain;fi
  332. cd /home/wareck/blockchain
  333. if [ ! -d /home/wareck/blockchain/chia-blockchain ]
  334. then
  335. git clone https://github.com/Chia-Network/chia-blockchain.git -b latest --recurse-submodules
  336. cd chia-blockchain
  337. else
  338. cd chia-blockchain
  339. git pull
  340. fi
  341. sh install.sh
  342. source ./activate
  343. sh install-gui.sh
  344. if [ -f /Store/.chia ]
  345. then
  346. ln -s /Store/.chia /home/wareck/.chia
  347. ln -s /Store/.chia_keys /home/wareck/.chia_keys
  348. fi
  349. echo -e "\e[97mDone.\e[0m"
  350. }
  351. function chia_proxy {
  352. echo -e "$(tput setaf 10)\nChia-X-Proxy (Cuda):$(tput sgr0)"
  353. wget -c -q --show-progress http://folivier.homelinux.org/cube/pack/chia-x-proxy.tar.xz -O /home/wareck/Build_Cube/pack/chia-x-proxy.tar.xz
  354. cp /home/wareck/Build_Cube/pack/chia-x-proxy.tar.xz /home/wareck/
  355. cd /home/wareck/chia/
  356. tar xvfJ /home/wareck/chia-x-proxy.tar.xz
  357. rm /home/wareck/chia-x-proxy.tar.xz
  358. sleep 1
  359. cat <<'EOF'>> x-proxy.service
  360. [Unit]
  361. Description=x-proxy
  362. After=network.target
  363. StartLimitIntervalSec=500
  364. StartLimitBurst=5
  365. [Service]
  366. #Restart=on-failure
  367. #RestartSec=5s
  368. WorkingDirectory=/home/wareck/chia/x-proxy/
  369. User=wareck
  370. Group=adm
  371. ExecStart=/usr/bin/screen -DmS x-proxy /home/wareck/chia/x-proxy/x-proxy-v1.9.1 -config /home/wareck/chia/x-proxy/config.yaml
  372. ExecStop=/usr/bin/screen -S x-proxy -X quit
  373. LimitNOFILE=999999
  374. [Install]
  375. WantedBy=multi-user.target
  376. EOF
  377. sudo mv x-proxy.service /etc/systemd/system/x-proxy.service
  378. sudo systemctl daemon-reload
  379. sudo systemctl start x-proxy.service
  380. sudo systemctl enable x-proxy.service
  381. echo -e "\e[97mDone.\e[0m"
  382. }
  383. function service_old {
  384. echo -e "$(tput setaf 10)\nInstall chia-miner service (hpool) :$(tput sgr0)"
  385. sleep 1
  386. echo "Generation du fichier /etc/init.d/chia-miner"
  387. cat <<'EOF'>> chia-miner.sh
  388. #!/bin/sh
  389. ### BEGIN INIT INFO
  390. # Provides: chiaminer
  391. # Required-Start: networking
  392. # Default-Start: 3 4 5
  393. # Default-Stop: 0 6
  394. ### END INIT INFO
  395. case "$1" in
  396. start)
  397. if pgrep -x "hpool-miner-chia" > /dev/null
  398. then
  399. sudo killall -9 hpool-miner-chia | true
  400. fi
  401. su wareck -c "screen -dmS chia-miner /home/wareck/miners/chia-miner/hpool-miner-chia -config /home/wareck/miners/chia-miner/config.yaml"
  402. ;;
  403. stop)
  404. if pgrep -x "hpool-miner-chia" > /dev/null
  405. then
  406. sudo killall -9 hpool-miner-chia | true
  407. fi
  408. ;;
  409. restart)
  410. $0 stop
  411. $0 start
  412. ;;
  413. *)
  414. echo "Usage: /etc/init.d/chia-miner {start|restart|stop}"
  415. exit 1
  416. ;;
  417. esac
  418. exit 0
  419. EOF
  420. chmod +x chia-miner.sh
  421. sudo cp chia-miner.sh /etc/init.d/chia-miner
  422. sudo update-rc.d chia-miner defaults
  423. sleep 1
  424. sudo /etc/init.d/chia-miner start
  425. sudo rm chia-miner.sh
  426. echo -e "\e[97mDone.\e[0m"
  427. }
  428. function service_ {
  429. echo -e "$(tput setaf 10)\nInstall chia-miner service (hpool) :$(tput sgr0)"
  430. sleep 1
  431. cat <<'EOF'>> chia-miner.service
  432. [Unit]
  433. Description=HPool miner
  434. After=network.target
  435. StartLimitIntervalSec=500
  436. StartLimitBurst=5
  437. [Service]
  438. #Restart=on-failure
  439. #RestartSec=5s
  440. WorkingDirectory=/home/wareck/miners/chia-miner/
  441. User=wareck
  442. Group=adm
  443. ExecStart=/usr/bin/screen -DmS hpool-miner /home/wareck/miners/chia-miner/hpool-miner-chia -config /home/wareck/miners/chia-miner/config.yaml
  444. ExecStop=/usr/bin/screen -S hpool-miner -X quit
  445. LimitNOFILE=999999
  446. [Install]
  447. WantedBy=multi-user.target
  448. EOF
  449. sudo mv chia-miner.service /etc/systemd/system/hpool-miner.service
  450. sudo systemctl daemon-reload
  451. sudo systemctl start hpool-miner.service
  452. sudo systemctl enable hpool-miner.service
  453. echo -e "\e[97mDone.\e[0m"
  454. }
  455. function foxypool_ {
  456. echo -e "$(tput setaf 10)\nInstall FoxyPool miner :$(tput sgr0)"
  457. cd /home/wareck/miners
  458. wget -c -q --show-progress http://folivier.homelinux.org/cube/pack/foxypool.tar.xz
  459. tar xfJ foxypool.tar.xz --checkpoint=.100
  460. echo ""
  461. rm foxypool.tar.xz
  462. if [ -f /home/wareck/chia/chia-gigahorse/cuda-plotter/linux/x86_64/foxypool.sh ];then rm /home/wareck/chia/chia-gigahorse/cuda-plotter/linux/x86_64/foxypool.sh;fi
  463. cat <<'EOF'>> foxypool.sh
  464. CTR=xch1f5y47t9jhkthq4fktq5md2d7wz3ruwdsnqah9ym8k3dd0ll2gheqh7l785
  465. FPK=8ba5acd276b45fd0f749ce195dcddcf0e63c3bf2e751e9e273faa0125075c36a11f2ee231e7cf74abed2920be97fc373
  466. OUT=@192.168.1.100
  467. ./cuda_plot_k32 -g 0 -c $CTR -f $FPK -C 17 -n 1 -t /raid/plotting/ -3 /raid/plotting/ -d $OUT
  468. ProofOfSpace farm -t 8 -d 100 -f $OUT
  469. EOF
  470. chmod +x foxypool.sh
  471. mv foxypool.sh /home/wareck/chia/chia-gigahorse/cuda-plotter/linux/x86_64/foxypool.sh
  472. }
  473. function foxypool_service_ {
  474. echo -e "$(tput setaf 10)\nInstall FoxyPool service :$(tput sgr0)"
  475. cat > $HOME/foxypool.service << EOF
  476. # The foxypool service (part of systemd)
  477. # file: /etc/systemd/system/foxypool.service
  478. [Unit]
  479. Description = Foxypool Service
  480. After=network.target
  481. [Service]
  482. Type=simple
  483. User = $USER
  484. WorkingDirectory= $HOME/miners/foxypool
  485. ExecStart = $HOME/miners/foxypool/foxy-gh-farmer -c $HOME/miners/foxypool/foxy-gh-farmer.yaml
  486. Restart = on-failure
  487. RestartSec=30
  488. LimitNOFILE=99999
  489. StandardOutput=syslog
  490. StandardError=syslog
  491. SyslogIdentifier=foxypool
  492. [Install]
  493. WantedBy = multi-user.target
  494. EOF
  495. sudo mv $HOME/foxypool.service /etc/systemd/system/foxypool.service >/dev/null
  496. sudo chmod 644 /etc/systemd/system/foxypool.service
  497. cat <<'EOF'>> foxypool.conf
  498. if $programname == 'flexfarmer' then /var/log/foxypool.log
  499. & stop
  500. EOF
  501. sudo cp foxypool.conf /etc/rsyslog.d/foxypool.conf
  502. sudo rm foxypool.conf
  503. if [ ! -f /var/log/foxypool.log ]
  504. then
  505. sudo touch /var/log/foxypool.log
  506. sudo chown syslog:adm /var/log/foxypool.log
  507. fi
  508. cat <<'EOF'>> logrot
  509. /var/log/foxypool.log {
  510. daily
  511. rotate 7
  512. copytruncate
  513. notifempty
  514. missingok
  515. su root syslog
  516. }
  517. EOF
  518. sudo cp logrot /etc/logrotate.d/foxypool
  519. sudo rm logrot
  520. sudo systemctl restart rsyslog >/dev/null 2>&1
  521. sudo systemctl daemon-reload >/dev/null 2>&1
  522. sudo systemctl enable foxypool >/dev/null 2>&1
  523. sudo systemctl start foxypool >/dev/null 2>&1
  524. echo -e "\e[97mDone.\e[0m"
  525. }
  526. function cmake_ {
  527. if [ $BladeBit = "YES" ]
  528. then
  529. pids=""
  530. /home/wareck/Build_Cube/options/tools/_cmake.sh & pids="$pids $!"
  531. wait $pids
  532. fi
  533. }
  534. simplify_config
  535. intro_
  536. update_
  537. cmake_
  538. case $Gui in
  539. ONLY)
  540. chia_blockchain
  541. ;;
  542. *)
  543. if [ $GigaHorse = "YES" ];then gigahorse;fi
  544. if [ $MadMax = "YES" ];then chia_plotter;fi
  545. if [ $BladeBit = "YES" ];then bladebit;fi
  546. if [ $ChiaPos = "YES" ];then chiapos;fi
  547. if [ $H9_Miner = "YES" ];then miner_;fi
  548. if [ $H9_ChiaService = "YES" ];then service_;fi
  549. if [ $H9_ChiaProxy = "YES" ]; then chia_proxy;fi
  550. if [ $FoxyPool = "YES" ]; then foxypool_;fi
  551. if [ $FoxyPool_service = "YES" ]; then foxypool_service_;fi
  552. if [ $GigaHorse_farmer = "YES" ];then GigaHorse_farmer_;fi
  553. if [ $Gui = "YES" ]; then chia_blockchain;fi
  554. ;;
  555. esac
  556. echo -e "\n\e[97mEnd of process...\e[0m"