setup_cpu.sh 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. #!/bin/bash
  2. set -e
  3. script_version="1.50b"
  4. rdate="22/12/2018"
  5. remote_folder="http://wareck.free.fr/openrig"
  6. if [ $UID -ne 0 ]
  7. then
  8. echo -e "\n\e[91mPlease run this script as ROOT : sudo ./setup.sh \e[0m"
  9. echo
  10. sleep 1
  11. exit
  12. fi
  13. echo ""
  14. echo -n -e " \e[97m\u2554"
  15. for i in {1..36}; do echo -e -n "\u2550"; done
  16. echo -e "\u2557\e[0m"
  17. echo -e " \e[97m\u2551 CPU mining Auto-install \e[93m"V$script_version"\e[0m\e[97m \u2551\e[0m"
  18. echo -e " \e[97m\u2551 Release date: \e[93m"$rdate"\e[0m\e[97m \u2551\e[0m"
  19. echo -e " \e[97m\u2551 wareck@gmail.com \u2551\e[0m"
  20. echo -n -e " \e[97m\u255A"
  21. for j in {1..36}; do echo -e -n "\u2550";done
  22. echo -e -n "\u255D\e[0m"
  23. echo
  24. echo -e "\n\e[95mSystem Update :\e[0m"
  25. sudo apt-get update
  26. sudo apt-get install automake autoconf libtool libmicrohttpd-dev libjansson-dev cmake pkg-config libcurl4-openssl-dev libjansson-dev libssl-dev libgmp-dev make g++ -y
  27. echo -e "\e[97mDone !\e[0m"
  28. echo -e "\n\e[95mDownload sources :\e[0m"
  29. cd ~
  30. if ! [ -d cpuminer-multi ]
  31. then
  32. git clone https://github.com/tpruvot/cpuminer-multi.git && echo
  33. fi
  34. if ! [ -d cpuminer-opt ]
  35. then
  36. git clone https://github.com/JayDDee/cpuminer-opt.git && echo
  37. fi
  38. if ! [ -d cpuminer-xzc ]
  39. then
  40. git clone https://github.com/aizensou/cpuminer-xzc.git && echo
  41. fi
  42. if ! [ -d xmrig_cpu ]
  43. then
  44. git clone https://github.com/xmrig/xmrig.git xmrig_cpu
  45. fi
  46. echo -e "\n\e[95mBuild cpuminer-multi:\e[0m"
  47. cd ~/cpuminer-multi
  48. ./build.sh
  49. echo -e "\e[97mDone !\e[0m"
  50. echo -e "\n\e[95mBuild cpuminer-opt:\e[0m"
  51. cd ~/cpuminer-opt
  52. ./build.sh
  53. echo -e "\e[97mDone !\e[0m"
  54. echo -e "\n\e[95mBuild cpuminer-xzc:\e[0m"
  55. cd ~/cpuminer-xzc
  56. ./build.sh
  57. echo -e "\e[97mDone !\e[0m"
  58. echo -e "\n\e[95mInstall xmrig-cpu:\e[0m"
  59. cd ~
  60. cd /tmp/
  61. if ! [ -d libuv ]; then git clone https://github.com/libuv/libuv.git ;fi
  62. cd libuv
  63. ./autogen.sh
  64. ./configure
  65. make -j $(nproc)
  66. sudo make install
  67. sudo ldconfig
  68. cd ~
  69. cd xmrig_cpu
  70. if ! [ -f patch_donate.patch ]
  71. then
  72. cat <<'EOF'>> patch_donate.patch
  73. diff --git a/src/donate.h b/src/donate.h
  74. index 46f26b7..67a9cb0 100644
  75. --- a/src/donate.h
  76. +++ b/src/donate.h
  77. @@ -43,8 +43,8 @@
  78. * XMR: 48edfHu7V9Z84YzzMa6fUueoELZ9ZRXq9VetWzYGzKt52XU5xvqgzYnDK9URnRoJMk1j8n$
  79. * BTC: 1P7ujsXeX7GxQwHNnJsRMgAdNkFZmNVqJT
  80. */
  81. -constexpr const int kDefaultDonateLevel = 5;
  82. -constexpr const int kMinimumDonateLevel = 1;
  83. +constexpr const int kDefaultDonateLevel = 0;
  84. +constexpr const int kMinimumDonateLevel = 0;
  85. #endif /* __DONATE_H__ */
  86. EOF
  87. patch -p1 <patch_donate.patch
  88. fi
  89. if ! [ -d build ];then mkdir build; fi
  90. cd build
  91. cmake ..
  92. make -j $(nproc)
  93. cd ~
  94. if ! [ -f xmrig-cpu ]
  95. then ln -s xmrig_cpu/build/xmrig xmrig-cpu
  96. fi
  97. echo "Done."
  98. echo -e "\n\e[95mAdd autostart miner_cpu.sh :\e[0m"
  99. if ! grep --quiet "su work -c '/home/work/miner_cpu.sh'" /etc/rc.local
  100. then
  101. sed -i "s/exit 0//g" /etc/rc.local
  102. RC_LOCAL_CMD0="su work -c '/home/work/miner_cpu.sh'"
  103. echo $RC_LOCAL_CMD0 >>/etc/rc.local
  104. echo "exit 0" >>/etc/rc.local
  105. fi
  106. echo -e "\e[97mDone !\e[0m"
  107. echo -e "\n\e[95mbuild miner_cpu.sh:\e[0m"
  108. cd ~
  109. if [ -f miner_cpu.sh ]; then rm miner_cpu.sh; fi
  110. cat <<'EOF'>> miner_cpu.sh
  111. #!/bin/bash
  112. # version 1.0 12/07/2018
  113. screen -S cpu -X quit
  114. ##-------MINER-----
  115. echo "start cpuminer."
  116. ## Lyra2z
  117. #screen -dmS cpu ~/cpuminer-xzc/cpuminer -a Lyra2z -o stratum+tcp://lyra2z.in.nicehash.com:3365 -u 16F8V2EnHCNPVQwTGLifGHCE12XTnWPG8G -p password
  118. #screen -dmS cpu ~/cpuminer-opt/cpuminer -a Lyra2z -o stratum+tcp://lyra2z.eu.nicehash.com:3365 -u 16F8V2EnHCNPVQwTGLifGHCE12XTnWPG8G -p password
  119. ## cryptonightv7
  120. screen -dmS cpu ~/xmrig-cpu -o cryptonightv7.eu.nicehash.com:3363 -u 16F8V2EnHCNPVQwTGLifGHCE12XTnWPG8G.OpenRig -p x &
  121. # cryptonightheavy
  122. #screen -dmS cpu ~/xmrig-cpu -o cryptonightheavy.eu.nicehash.com:3364 -u 16F8V2EnHCNPVQwTGLifGHCE12XTnWPG8G.OpenRig -p x -a cryptonight-heavy
  123. # cryptonightv8
  124. #screen -dmS cpu ~/xmrig-cpu -o stratum+tcp://cryptonightv8.eu.nicehash.com:3367 -u 16F8V2EnHCNPVQwTGLifGHCE12XTnWPG8G.OpenRig -p x -a cryptonight --variant 2 &
  125. echo "use 'screen -x cpu' to see miner activity"
  126. EOF
  127. chown work miner_cpu.sh
  128. chmod +x miner_cpu.sh
  129. echo -e "\e[97mDone !\e[0m"
  130. echo