setup_amd.sh 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626
  1. #!/bin/bash
  2. set -e
  3. script_version="1.54"
  4. rdate="20/02/2019"
  5. remote_folder="http://wareck.free.fr/openrig"
  6. lsb_v="`lsb_release -r | awk '{print$2; exit}'`"
  7. lsb_r="`lsb_release -d | awk '{print$2" "$3}'`"
  8. curdir=$PWD
  9. #### OPTIONS ####
  10. host_name="OpenRig"
  11. #Drivers="16.40"
  12. Drivers="16.60"
  13. #Drivers="17.50"
  14. #Drivers="18.20"
  15. #Drivers="18.40"
  16. #Drivers="18.50" #ubuntu 18.04
  17. #Drivers="19.30" #ubuntu 18.04
  18. ROCM_="NO" #rcom compute
  19. ETHMine="YES"
  20. XMRIG_AMD="YES"
  21. XMR_STAK="YES"
  22. SGMINER="YES"
  23. SGMINER_TT="YES"
  24. SGMINER_x16r="YES"
  25. Lyra2z="NO"
  26. Phoenix="YES"
  27. lolMiner="YES"
  28. Gminer="YES"
  29. swap_size="16" # 0/4/8/16 Go
  30. NewNiceHash="YES"
  31. Pro="YES"
  32. #script_version=`grep version version.txt | awk '{ print $2 }'`
  33. #rdate=`grep release version.txt | awk '{ print $2 }'`
  34. #if [[ $lsb_v = "18.04" || $lsb_v = "18.10" ]]; then Drivers="18.50" && Lyra2z="NO" && ROCM_="NO" ;fi
  35. if [ $Drivers = "16.40" ]; then amd_driver_v="16.40-348864" && ROCM_="NO" ;fi
  36. if [ $Drivers = "16.60" ]; then amd_driver_v="16.60-379184" && ROCM_="NO" ;fi
  37. if [ $Drivers = "17.50" ]; then amd_driver_v="17.50-511655" && ROCM_="NO" ;fi
  38. if [ $Drivers = "18.20" ]; then amd_driver_v="18.20-606296" && Lyra2z="NO" && ROCM_="NO" ;fi
  39. if [ $Drivers = "18.40" ]; then amd_driver_v="18.40-673869" && Lyra2z="NO" && ROCM_="NO" ;fi
  40. if [ $Drivers = "18.50" ]; then amd_driver_v="18.50-708488" && Lyra2z="NO" && ROCM_="NO" ;fi
  41. if [ $Drivers = "19.30" ]; then amd_driver_v="19.30-855429" && Lyra2z="NO" && ROCM_="NO" ;fi
  42. if [ $UID -ne 0 ]
  43. then
  44. echo -e "\n\e[91mPlease run this script as ROOT : sudo ./setup.sh \e[0m"
  45. echo
  46. sleep 1
  47. exit
  48. fi
  49. claymore_dual_v="`curl -s $remote_folder/version.txt | awk 'NR==1 {print$3; exit}'`"
  50. claymore_zcash_v="`curl -s $remote_folder/version.txt | awk 'NR==2 {print$3; exit}'`"
  51. claymore_xmr_v="`curl -s $remote_folder/version.txt | awk 'NR==3 {print$3; exit}'`"
  52. lolminer_v="`curl -s $remote_folder/version.txt | awk 'NR==6 {print$3; exit}'`"
  53. Phoenix_v="`curl -s $remote_folder/version.txt | awk 'NR==7 {print$3; exit}'`"
  54. Gminer_v="`curl -s $remote_folder/version.txt | awk 'NR==8 {print$3; exit}'`"
  55. echo ""
  56. echo -n -e " \e[97m\u2554"
  57. for i in {1..36}; do echo -e -n "\u2550"; done
  58. echo -e "\u2557\e[0m"
  59. echo -e " \e[97m\u2551 Mining Rig Auto-install \e[93m"V$script_version"\e[0m\e[97m \u2551\e[0m"
  60. echo -e " \e[97m\u2551 Release date: \e[93m"$rdate"\e[0m\e[97m \u2551\e[0m"
  61. echo -e " \e[97m\u2551 wareck@gmail.com \u2551\e[0m"
  62. echo -n -e " \e[97m\u255A"
  63. for j in {1..36}; do echo -e -n "\u2550";done
  64. echo -e -n "\u255D\e[0m"
  65. echo
  66. echo
  67. if [ $lsb_v = "18.04" ]; then echo -e "\e[97m Ubuntu 18.04 \e[0m\e[97m";fi
  68. if [ $lsb_v = "18.10" ]; then echo -e "\e[97m Ubuntu 18.10 \e[0m\e[97m";fi
  69. if [ $ROCM_ = "YES" ]; then echo -e "\e[94m AMD DRIVER + ROCm Compute firmware \e[0m\e[97m";fi
  70. if [ $ROCM_ = "NO" ]; then echo -e "\e[94m AMD GPU PRO Drivers $amd_driver_v\e[0m\e[97m";fi
  71. echo -e ""
  72. if [ $NewNiceHash = "YES" ]; then echo -e "\e[97m +\e[92m New NicheHash\e[0m\e[93m";fi
  73. if [ $ETHMine = "YES" ]; then echo -e "\e[97m +\e[91m Etherminer \e[0m\e[97m";fi
  74. if [ $XMRIG_AMD = "YES" ]; then echo -e "\e[97m +\e[91m XMRig-amd \e[0m\e[97m";fi
  75. if [ $XMR_STAK = "YES" ]; then echo -e "\e[97m +\e[91m XMR-Stak \e[0m\e[97m";fi
  76. if [ $lolMiner = "YES" ]; then echo -e "\e[97m +\e[91m lolMiner v$lolminer_v\e[0m\e[97m";fi
  77. if [ $SGMINER = "YES" ]; then echo -e "\e[97m +\e[91m Sgminer-nicehash\e[0m\e[97m";fi
  78. if [ $SGMINER_TT = "YES" ]; then echo -e "\e[97m +\e[91m Sgminer-timetravel\e[0m\e[97m";fi
  79. if [ $SGMINER_x16r = "YES" ]; then echo -e "\e[97m +\e[91m Sgminer-x16r\e[0m\e[97m";fi
  80. echo -e "\e[97m +\e[91m Claymore dualminer $claymore_dual_v\e[0m\e[97m"
  81. echo -e "\e[97m +\e[91m Claymore zcash $claymore_zcash_v\e[0m\e[97m"
  82. echo -e "\e[97m +\e[91m Claymore xmr $claymore_xmr_v\e[0m\e[97m"
  83. if [ $Lyra2z = "YES" ]; then echo -e "\e[97m +\e[91m Lyra2z GPU Mining (experimental)\e[0m\e[97m";fi
  84. if [ $Phoenix = "YES" ]; then echo -e "\e[97m +\e[91m Phoenix ETH v$Phoenix_v \e[0m\e[97m";fi
  85. if [ $Gminer = "YES" ]; then echo -e "\e[97m +\e[91m Gminer v$Gminer_v \e[0m\e[97m";fi
  86. echo
  87. sleep 4
  88. sed -i -e "s/# set const/set const/g" /etc/nanorc
  89. echo -e "\n\e[95mExpand Disk :\e[0m"
  90. sudo growpart `df -h | grep /dev/sd | awk ' { print $1 }'| cut -c -8` 1 |true
  91. sudo resize2fs `df -h | grep /dev/sd | awk ' { print $1 }'` |true
  92. echo -e "\e[97mDone !\e[0m"
  93. echo -e "\n\e[95mSystem Update :\e[0m"
  94. sudo apt-get update && echo ""
  95. sudo add-apt-repository -y ppa:ethereum/ethereum -y && echo ""
  96. sudo apt-get update && echo ""
  97. cd ~
  98. sudo sed -i -e "s/quiet splash/text/g" /etc/default/grub
  99. sudo sed -i -e 's#GRUB_CMDLINE_LINUX=""#GRUB_CMDLINE_LINUX="amddgpu.vm_fragment_size=9"#g' /etc/default/grub
  100. sudo update-grub2 && echo ""
  101. sudo apt dist-upgrade -y && echo ""
  102. if ! [[ $lsb_v = "18.04" || $lsb_v = "18.10" ]];then sudo apt-get remove linux-image-4.4.0-116* linux-headers-4.4.0-116* -y ;fi
  103. sudo apt install ethereum git screen htop curl ntp pv git cmake libleveldb-dev libjsoncpp-dev \
  104. build-essential libcurl4-gnutls-dev libboost-all-dev libgmp-dev \
  105. libreadline-dev libmicrohttpd-dev libjansson-dev libgmp-dev libssl-dev unzip python-nfqueue python-scapy mesa-common-dev -y && echo ""
  106. if ! [[ $lsb_v = "18.04" || $lsb_v = "18.10" ]];then sudo apt install libcryptopp-dev -y ;fi && echo""
  107. if ! [[ $lsb_v = "18.04" || $lsb_v = "18.10" ]];then sudo apt-get install --install-recommends xserver-xorg-hwe-16.04 -y; fi && echo ""
  108. if [ $ROCM_ = "YES" ]
  109. then
  110. sudo apt-get install libnuma-dev -y
  111. echo -e "\n\e[95mInstall ROCm Compute:\e[0m"
  112. #update ROCM
  113. sudo apt-get install libnuma-dev -y
  114. wget -qO - http://repo.radeon.com/rocm/apt/debian/rocm.gpg.key | sudo apt-key add -
  115. sudo sh -c 'echo deb [arch=amd64] http://repo.radeon.com/rocm/apt/debian/ xenial main > /etc/apt/sources.list.d/rocm.list'
  116. sudo apt-get update
  117. sudo apt-get install rocm-opencl-dev -y
  118. sudo usermod -a -G video work
  119. cd ..
  120. echo -e "\e[97mDone !\e[0m"
  121. fi
  122. echo -e "\n\e[95mInstall AMD Drivers :\e[0m"
  123. if ! [ -d /home/work/tempo ];then mkdir /home/work/tempo ; fi
  124. cd /home/work/tempo
  125. if [ $Drivers = "16.40" ]
  126. then
  127. wget -c http://wareck.free.fr/grinder/drivers/amdgpu-pro-16.40-348864.tar.xz
  128. tar xvfJ amdgpu-pro-16.40-348864.tar.xz
  129. rm amdgpu-pro-16.40-348864.tar.xz
  130. cd amdgpu-pro-16.40-348864
  131. if [ $ROCM_ = "YES" ]
  132. then
  133. sed -i -e "s/amdgpu-pro-dkms libdrm2-amdgpu-pro/libdrm2-amdgpu-pro/g" amdgpu-pro-install
  134. ./amdgpu-pro-install --px -y
  135. else
  136. ./amdgpu-pro-install --px -y
  137. fi
  138. fi
  139. if [ $Drivers = "16.60" ]
  140. then
  141. wget -c http://wareck.free.fr/grinder/drivers/amdgpu-pro-16.60-379184.tar.xz
  142. tar xvfJ amdgpu-pro-16.60-379184.tar.xz
  143. rm amdgpu-pro-16.60-379184.tar.xz
  144. cd amdgpu-pro-16.60-379184
  145. chmod +x amdgpu-pro-install
  146. ./amdgpu-pro-install --px -y
  147. fi
  148. if [ $Drivers = "17.50" ]
  149. then
  150. wget -c http://wareck.free.fr/grinder/drivers/amdgpu-pro-17.50-511655.tar.xz
  151. tar xvfJ amdgpu-pro-17.50-511655.tar.xz
  152. rm amdgpu-pro-17.50-511655.tar.xz
  153. cd amdgpu-pro-17.50-511655
  154. if [ $ROCM_ = "YES" ]
  155. then
  156. sed -i -e "s/amdgpu-pro-dkms libdrm2-amdgpu-pro/libdrm2-amdgpu-pro/g" amdgpu-pro-install
  157. ./amdgpu-pro-install --pro --opencl=legacy,rocm -y
  158. else
  159. if [ $Pro = "YES" ]
  160. then
  161. ./amdgpu-pro-install --pro --opencl=legacy -y
  162. else
  163. ./amdgpu-install --opencl=legacy -y
  164. fi
  165. fi
  166. fi
  167. if [ $Drivers = "18.20" ]
  168. then
  169. echo "Download amdgpu-pro-18.20-606296.tar.xz"
  170. wget -c http://wareck.free.fr/grinder/drivers/amdgpu-pro-18.20-606296.tar.xz
  171. tar xvfJ amdgpu-pro-18.20-606296.tar.xz
  172. rm amdgpu-pro-18.20-606296.tar.xz
  173. cd amdgpu-pro-18.20-606296
  174. if [ $ROCM_ = "YES" ]
  175. then
  176. sed -i -e "s/amdgpu-pro-dkms libdrm2-amdgpu-pro/libdrm2-amdgpu-pro/g" amdgpu-pro-install
  177. ./amdgpu-pro-install --pro --opencl=legacy,rocm -y
  178. else
  179. if [ $Pro = "YES" ]
  180. then
  181. ./amdgpu-pro-install --pro --opencl=legacy -y
  182. else
  183. ./amdgpu-install --opencl=legacy -y
  184. fi
  185. fi
  186. fi
  187. if [ $Drivers = "18.40" ]
  188. then
  189. echo "Download amdgpu-pro-18.40-673869-ubuntu-16.04.tar.xz"
  190. wget -c http://wareck.free.fr/grinder/drivers/amdgpu-pro-18.40-673869-ubuntu-16.04.tar.xz
  191. tar xvfJ amdgpu-pro-18.40-673869-ubuntu-16.04.tar.xz
  192. rm amdgpu-pro-18.40-673869-ubuntu-16.04.tar.xz
  193. cd amdgpu-pro-18.40-673869-ubuntu-16.04
  194. ./amdgpu-pro-install --pro --opencl=legacy -y
  195. fi
  196. if [ $Drivers = "18.50" ]
  197. then
  198. echo "Download amdgpu-pro-18.40-673869-ubuntu-16.04.tar.xz"
  199. wget -c http://wareck.free.fr/grinder/drivers/amdgpu-pro-18.50-708488-ubuntu-18.04.tar.xz
  200. tar xvfJ amdgpu-pro-18.50-708488-ubuntu-18.04.tar.xz
  201. rm amdgpu-pro-18.50-708488-ubuntu-18.04.tar.xz
  202. cd amdgpu-pro-18.50-708488-ubuntu-18.04
  203. ./amdgpu-pro-install --pro --opencl=legacy -y
  204. fi
  205. if [ $Drivers = "19.30" ]
  206. then
  207. echo "Download amdgpu-pro-19.30-855429-ubuntu-18.04.tar.xz"
  208. wget -c http://wareck.free.fr/grinder/drivers/amdgpu-pro-19.30-855429-ubuntu-18.04.tar.xz
  209. tar xvfJ amdgpu-pro-19.30-855429-ubuntu-18.04.tar.xz
  210. rm amdgpu-pro-19.30-855429-ubuntu-18.04.tar.xz
  211. cd amdgpu-pro-19.30-855429-ubuntu-18.04
  212. ./amdgpu-pro-install --pro --opencl=legacy -y
  213. fi
  214. echo -e "\n\e[95mInstall AMD SDK :\e[0m"
  215. cd /home/work/tempo/
  216. curl -f http://wareck.free.fr/grinder/drivers/AMD-APP-SDKInstaller-v3.0.130.136-GA-linux64.tar.bz2 | tar xvj
  217. ./AMD-APP-SDK-v3.0.130.136-GA-linux64.sh
  218. cd /opt/
  219. if [ -d ADL_SDK ]; then rm -r /opt/ADL_SDK; fi
  220. mkdir ADL_SDK
  221. cd ADL_SDK
  222. wget -c http://wareck.free.fr/grinder/drivers/ADL_SDK102.zip -O ADL_SDK.zip
  223. unzip -q ADL_SDK.zip
  224. cd ~
  225. echo -e "\e[97mDone !\e[0m"
  226. sleep 2
  227. echo -e "\n\e[95mInstall Claymore Dualminer :\e[0m"
  228. cd /home/work/
  229. sudo -u work curl -sf $remote_folder/miners/claymore_dual_$claymore_dual_v.tar.xz | tar xvJ
  230. echo -e "\n\e[95mInstall Claymore Zcash miner:\e[0m"
  231. sudo -u work curl -sf $remote_folder/miners/claymore_zcash_$claymore_zcash_v.tar.xz | tar xvJ
  232. echo -e "\n\e[95mInstall Claymore Xmr miner:\e[0m"
  233. sudo -u work curl -sf $remote_folder/miners/claymore_xmr_$claymore_xmr_v.tar.xz | tar xvJ
  234. echo ""
  235. if [ $NewNiceHash = "YES" ]
  236. then
  237. echo -e "\n\e[95mInstall miner.sh (NewNiceHash) :\e[0m"
  238. cp -v $curdir/miner_new.sh /home/work/miner.sh
  239. else
  240. echo -e "\n\e[95mInstall miner.sh :\e[0m"
  241. cp -v $curdir/miner.sh /home/work/miner.sh
  242. fi
  243. sudo chown work claymore
  244. sudo chown work claymore_xmr
  245. sudo chown work claymore_zcash
  246. sudo chown work /home/work/miner.sh
  247. if [ $Phoenix = "YES" ]
  248. then
  249. echo -e "\n\e[95mInstall Phoenix v$Phoenix_v :\e[0m"
  250. sudo -u work curl -sf $remote_folder/miners/PhoenixMiner_v$Phoenix_v.tar.xz | tar xvJ
  251. sudo chown -R work /home/work/PhoenixMiner
  252. fi
  253. if [ $lolMiner = "YES" ]
  254. then
  255. echo -e "\n\e[95mInstall lolMiner v$lolminer_v :\e[0m"
  256. sudo -u work curl -sf $remote_folder/miners/lolMiner_v$lolminer_v.tar.xz | tar xvJ
  257. sudo chown -R work /home/work/lolMiner
  258. fi
  259. if [ $Gminer = "YES" ]
  260. then
  261. echo -e "\n\e[95mInstall Gminer v$Gminer_v :\e[0m"
  262. sudo -u work curl -sf $remote_folder/miners/gminer_v$Gminer_v.tar.xz | tar xvJ
  263. sudo chown -R work /home/work/gminer
  264. fi
  265. if [ $ETHMine = "YES" ]
  266. then
  267. echo -e "\n\e[95mInstall Ethminer :\e[0m"
  268. cd ~
  269. if [ -d cpp_ethminer ] ; then rm -r cpp_ethminer ;fi
  270. git clone -n https://github.com/ethereum-mining/ethminer.git cpp_ethminer
  271. cd cpp_ethminer
  272. #git checkout 2200dca33d35273fb2a7843a7d313a9a31bcd246
  273. git checkout 80fbba158850c3a5ec83ff4849023bb256333a3a #last stable
  274. cd ~/cpp_ethminer
  275. git submodule update --init --recursive
  276. mkdir build |true
  277. cd build
  278. cmake .. -DETHASHCUDA=OFF -DETHASHCL=ON
  279. make
  280. cd ~
  281. if [ -f ~/ethminer ]; then rm ~/ethminer ;fi
  282. ln -s cpp_ethminer/build/ethminer/ethminer ethminer
  283. cd /tmp
  284. wget http://wareck.free.fr/grinder/cpp_ethminer_kernel.tar.xz
  285. tar xvfJ cpp_ethminer_kernel.tar.xz
  286. sudo mv kernels ~/cpp_ethminer/build/ethminer/
  287. cd ~
  288. echo -e "\e[97mDone !\e[0m"
  289. fi
  290. if [ $SGMINER = "YES" ]
  291. then
  292. echo -e "\n\e[95mInstall Sgminer-Nicehash:\e[0m"
  293. cd ~
  294. if [ ! -d sgminer ]
  295. then
  296. git clone https://github.com/nicehash/sgminer.git
  297. cd sgminer
  298. else
  299. cd sgminer
  300. git pull
  301. fi
  302. sudo apt install git autoconf automake libtool build-essential libncurses5-dev libcurl4-gnutls-dev -y
  303. git submodule init
  304. git submodule update
  305. autoreconf -fi
  306. CFLAGS="-Os -Wall -march=native -I/opt/AMDAPPSDK-3.0/include" LDFLAGS="-L/opt/amdgpu-pro/lib/x86_64-linux-gnu" ./configure --disable-git-version --disable-adl
  307. make -j $(nproc)
  308. cd ~
  309. echo -e "\e[97mDone !\e[0m"
  310. fi
  311. if [ $SGMINER_TT = "YES" ]
  312. then
  313. echo -e "\n\e[95mInstall Sgminer-Timetravel:\e[0m"
  314. cd ~
  315. if [ ! -d sgminer-timetravel ]
  316. then
  317. sudo -u work curl -sf http://wareck.free.fr/openrig/miners/sgminer-timetravel.tar.xz | tar xvJ
  318. cd ~
  319. fi
  320. echo -e "\e[97mDone !\e[0m"
  321. fi
  322. if [ $Lyra2z = "YES" ]
  323. then
  324. echo -e "\n\e[95mInstall Lyra2Z GPU Miner (experimental):\e[0m"
  325. cd ~
  326. if [ -d sgminer-lyra2z ]; then rm -r sgminer-lyra2z ;fi
  327. git clone https://github.com/wareck/sgminer-lyra2z.git
  328. cd ~/sgminer-lyra2z
  329. git pull
  330. git submodule init
  331. git submodule update
  332. ./autogen.sh
  333. CFLAGS="-Os -Wall -march=native -I/opt/AMDAPPSDK-3.0/include" LDFLAGS="-L/opt/amdgpu-pro/lib/x86_64-linux-gnu" ./configure --disable-git-version --disable-adl
  334. make -j $(nproc)
  335. cd ~
  336. echo "Done."
  337. fi
  338. if [ $SGMINER_x16r = "YES" ]
  339. then
  340. echo -e "\n\e[95mInstall Sgminer-x16r :\e[0m"
  341. cd ~
  342. if [ -d sgminer-x16r ]; then rm -r sgminer-x16r;fi
  343. git clone https://github.com/wareck/sgminer-x16r.git
  344. cd ~/sgminer-x16r
  345. git pull
  346. git submodule init
  347. git submodule update
  348. ./autogen.sh
  349. CFLAGS="-Os -Wall -march=native -I/opt/AMDAPPSDK-3.0/include" LDFLAGS="-L/opt/amdgpu-pro/lib/x86_64-linux-gnu" ./configure --disable-git-version --disable-adl
  350. make -j $(nproc)
  351. cd ~
  352. echo "Done."
  353. fi
  354. if [ $XMRIG_AMD = "YES" ]
  355. then
  356. echo -e "\n\e[95mInstall xmrig-amd:\e[0m"
  357. cd ~
  358. if [ -d xmrig_amd ]; then rm -r xmrig_amd ; fi
  359. git clone https://github.com/xmrig/xmrig-amd.git xmrig_amd
  360. cd /tmp/
  361. if ! [ -d libuv ]; then git clone https://github.com/libuv/libuv.git ;fi
  362. cd libuv
  363. ./autogen.sh
  364. ./configure
  365. make -j $(nproc)
  366. sudo make install
  367. sudo ldconfig
  368. cd ~
  369. cd xmrig_amd
  370. if ! [ -f patch_donate.patch ]
  371. then
  372. cat <<'EOF'>> patch_donate.patch
  373. diff --git a/src/donate.h b/src/donate.h
  374. index 46f26b7..67a9cb0 100644
  375. --- a/src/donate.h
  376. +++ b/src/donate.h
  377. @@ -43,8 +43,8 @@
  378. * XMR: 48edfHu7V9Z84YzzMa6fUueoELZ9ZRXq9VetWzYGzKt52XU5xvqgzYnDK9URnRoJMk1j8n$
  379. * BTC: 1P7ujsXeX7GxQwHNnJsRMgAdNkFZmNVqJT
  380. */
  381. -constexpr const int kDefaultDonateLevel = 5;
  382. -constexpr const int kMinimumDonateLevel = 1;
  383. +constexpr const int kDefaultDonateLevel = 0;
  384. +constexpr const int kMinimumDonateLevel = 0;
  385. #endif /* __DONATE_H__ */
  386. EOF
  387. patch -p1 <patch_donate.patch
  388. fi
  389. if ! [ -d build ];then mkdir build; fi
  390. cd build
  391. cmake ..
  392. make -j $(nproc)
  393. cd ~
  394. if ! [ -f xmrig-amd ]; then ln -s xmrig_amd/build/xmrig-amd xmrig-amd ;fi
  395. echo "Done."
  396. fi
  397. if [ $XMR_STAK = "YES" ]
  398. then
  399. echo -e "\n\e[95mInstall xmr-stak:\e[0m"
  400. cd /tmp/
  401. wget http://wareck.free.fr/grinder/hwloc-1.11.8.tar.xz
  402. tar xvfJ hwloc-1.11.8.tar.xz
  403. cd hwloc-1.11.8
  404. ./autogen.sh
  405. ./configure --prefix=/usr/local
  406. make -j $(nproc)
  407. sudo make install
  408. cd ~
  409. if [ -d xmr_stak ]; then rm -r xmr_stak ;fi
  410. git clone https://github.com/fireice-uk/xmr-stak.git xmr_stak
  411. cd xmr_stak
  412. sudo ln -s /opt/amdgpu-pro/lib/x86_64-linux-gnu/libOpenCL.so /usr/lib/libOpenCL.so.1 | true
  413. mkdir build
  414. sed -i -e "s/= 2.0/= 0.0/g" xmrstak/donate-level.hpp
  415. cd build
  416. cmake .. -DCPU_ENABLE=OFF -DHWLOC_ENABLE=OFF -DMICROHTTPD_ENABLE=OFF -DCMAKE_LINK_STATIC=ON -DCMAKE_BUILD_TYPE=Release -DCUDA_ENABLE=OFF \
  417. -DOpenCL_LIBRARY=/opt/AMDAPPSDK-3.0/lib/x86_64/libOpenCL.so -DOpenCL_INCLUDE_DIR=/opt/AMDAPPSDK-3.0/include/ -DXMR-STAK_COMPILE=generic
  418. make -j $(nproc)
  419. cd ~
  420. if ! [ -f ~/xmr-stak ];then ln -s xmr_stak/build/bin/xmr-stak xmr-stak; fi
  421. sudo cp xmr_stak/build/bin/libxmrstak_opencl_backend.so /lib/
  422. cd ~
  423. if ! [ -f /etc/sysctl.d/60-hugepages.conf ]
  424. then
  425. sudo echo "vm.nr_hugepages=128" > /etc/sysctl.d/60-hugepages.conf
  426. sudo sysctl --system
  427. fi
  428. if ! [ -f /etc/security/limits.d/60-memlock.conf ]
  429. then
  430. sudo echo "* - memlock 262144" >/etc/security/limits.d/60-memlock.conf
  431. sudo echo "root - memlock 262144" >>/etc/security/limits.d/60-memlock.conf
  432. fi
  433. echo "Done"
  434. fi
  435. echo -e "\n\e[95mDownloading NoFees Patch:\e[0m"
  436. cd ~
  437. if [ -d remove_miner_fees ]
  438. then
  439. cd remove_miner_fees
  440. git pull
  441. else
  442. git clone https://github.com/wareck/remove_miner_fees.git
  443. chown -R work remove_miner_fees
  444. fi
  445. if ! [ -f /etc/rc.local ]
  446. then
  447. printf '%s\n' '#!/bin/bash' 'exit 0' | sudo tee -a /etc/rc.local
  448. sudo chmod +x /etc/rc.local
  449. fi
  450. chmod 777 /etc/rc.local
  451. if ! grep --quiet "/home/work/remove_miner_fees" /etc/rc.local
  452. then
  453. sed -i "s/exit 0//g" /etc/rc.local
  454. RC_LOCAL_CMD0="#python /home/work/remove_miner_fees/remove_mining_fees.py &"
  455. RC_LOCAL_CMD1="#python /home/work/remove_miner_fees/zcach.py &"
  456. RC_LOCAL_CMD2="#python /home/work/remove_miner_fees/hush.py &"
  457. RC_LOCAL_CMD3="#python /home/work/remove_miner_fees/ubiq.py &"
  458. RC_LOCAL_CMD4="#python /home/work/remove_miner_fees/soilcoin.py &"
  459. echo $RC_LOCAL_CMD0 >>/etc/rc.local
  460. echo $RC_LOCAL_CMD1 >>/etc/rc.local
  461. echo $RC_LOCAL_CMD2 >>/etc/rc.local
  462. echo $RC_LOCAL_CMD3 >>/etc/rc.local
  463. echo $RC_LOCAL_CMD4 >>/etc/rc.local
  464. echo "exit 0" >>/etc/rc.local
  465. fi
  466. echo -e "\e[97mDone !\e[0m"
  467. echo -e "\n\e[95mInstall AutoStart:\e[0m"
  468. if [ -f /home/work/.config/autostart/miner.sh.desktop ];then rm /home/work/.config/autostart/miner.sh.desktop |true ; fi
  469. if ! [ -d /home/work/.config ]; then mkdir /home/work/.config ;fi
  470. if ! [ -d /home/work/.config/autostart ]; then mkdir /home/work/.config/autostart;fi
  471. cat <<EOF>> /home/work/.config/autostart/miner.sh.desktop
  472. [Desktop Entry]
  473. Type=Application
  474. Exec=/home/work/miner.sh
  475. Hidden=false
  476. NoDisplay=false
  477. X-GNOME-Autostart-enabled=true
  478. Name[fr_FR]=miner
  479. Name=miner
  480. Comment[fr_FR]=miner
  481. Comment=miner
  482. EOF
  483. sleep 5
  484. chmod 777 /etc/rc.local
  485. if ! grep --quiet "su work -c '/home/work/miner.sh'" /etc/rc.local
  486. then
  487. sed -i "s/exit 0//g" /etc/rc.local
  488. RC_LOCAL_CMD0="su work -c '/home/work/miner.sh'"
  489. echo $RC_LOCAL_CMD0 >>/etc/rc.local
  490. echo "exit 0" >>/etc/rc.local
  491. fi
  492. echo -e "\e[97mDone !\e[0m"
  493. cd /home/work/
  494. sudo rm -r tempo
  495. echo -e "\n\e[95mMessage of the day mod :\e[0m"
  496. rm /etc/update-motd.d/00-header | true
  497. rm /etc/update-motd.d/10-help-text |true
  498. rm /etc/update-motd.d/90-updates-available |true
  499. rm /etc/update-motd.d/91-release-upgrade |true
  500. rm /etc/update-motd.d/98-fsck-at-reboot |true
  501. rm /etc/update-motd.d/98-reboot-required |true
  502. echo " - 00-header "
  503. cat <<EOF >> /etc/update-motd.d/00-header
  504. #!/bin/sh
  505. [ -r /etc/lsb-release ] && . /etc/lsb-release
  506. if [ -z "$DISTRIB_DESCRIPTION" ] && [ -x /usr/bin/lsb_release ]; then
  507. # Fall back to using the very slow lsb_release utility
  508. DISTRIB_DESCRIPTION=$(lsb_release -s -d)
  509. fi
  510. printf "Welcome to %s (%s %s %s)\n" "$DISTRIB_DESCRIPTION" " $(uname -o)" "$(uname -p)"
  511. EOF
  512. cd /etc/update-motd.d
  513. sudo -u work curl -sf http://folivier.homelinux.org/genethos/files/motd.tar.xz | tar xJ
  514. cd ~
  515. sed -i -e "s/#force_color_prompt=yes/force_color_prompt=yes/g" /home/work/.bashrc
  516. if ! grep --quiet "export DISPLAY=:0" /home/work/.bashrc
  517. then
  518. cat <<EOF>> /home/work/.bashrc
  519. export DISPLAY=:0
  520. echo -e "\e[97m
  521. Open Mining Platform \e[96mv$script_version\e[0m
  522. wareck@gmail.com
  523. "
  524. EOF
  525. fi
  526. echo -e "\e[97mDone !\e[0m"
  527. echo -e "\n\e[95mBuilding Swapfile :\e[0m"
  528. if ! grep -q "swapfile" /etc/fstab ; then
  529. case $swap_size in
  530. 0) fst="0";;
  531. 4) sudo dd if=/dev/zero | pv -s 4G | dd of=/swapfile iflag=fullblock bs=1024 count=4194304;;
  532. 8) sudo dd if=/dev/zero | pv -s 8G | dd of=/swapfile iflag=fullblock bs=1024 count=8388608;;
  533. 16) sudo dd if=/dev/zero | pv -s 16G | dd of=/swapfile iflag=fullblock bs=1024 count=16777216 ;;
  534. *) echo -e "\e[91mError in configuration !\e[0m" && exit ;;
  535. esac
  536. if ! [ $swap_size = "0" ]
  537. then
  538. sudo mkswap /swapfile
  539. sudo swapon /swapfile
  540. sudo cat <<'EOF'>> /etc/fstab
  541. /swapfile none swap sw 0 0
  542. EOF
  543. sudo chmod 600 /swapfile
  544. sudo touch /forcefsck
  545. fi
  546. else
  547. echo -e "\e[93mSwapfile already enabled... \e[0m"
  548. echo -e "\e[93mCheck /etc/fsatb file.\e[0m\n"
  549. fi
  550. echo -e "\e[97mDone !\e[0m"
  551. sudo usermod -a -G video work
  552. echo -e "\n\e[95mConfigure Hostname and Rig name:\e[0m"
  553. touch /tmp/hostname
  554. echo $host_name >/tmp/hostname
  555. sudo bash -c 'cp /tmp/hostname /etc/hostname'
  556. sed -i -e "s/digger/$host_name/g" /etc/hosts
  557. # rename rig in miner.sh
  558. sed -i -e "s/OpenRig/$host_name/g" miner.sh
  559. # nano count lines
  560. sed -i -e "s/# set const/set const/g" /etc/nanorc
  561. # reset ssh keys
  562. rm /etc/ssh/ssh_host_*
  563. dpkg-reconfigure openssh-server
  564. sudo apt-get autoremove -y
  565. echo "Done"
  566. echo -e "\n\e[92mEverything was done...\e[0m"
  567. echo -e -n "Reboot in 15 seconds (CRTL+C to abord): "
  568. for i in {15..1}
  569. do
  570. echo -e -n "$i "
  571. sleep 1
  572. done
  573. sudo reboot