Browse Source

update xmr and xmrig

Your Name 6 years ago
parent
commit
3dcc13337f
1 changed files with 109 additions and 5 deletions
  1. 109 5
      setup_cpu.sh

+ 109 - 5
setup_cpu.sh

@@ -1,7 +1,7 @@
 #!/bin/bash
 set -e
-script_version="0.2b"
-rdate="12/07/2018"
+script_version="0.3b"
+rdate="22/12/2018"
 remote_folder="http://wareck.free.fr/openrig"
 
 
@@ -27,10 +27,10 @@ echo
 
 echo -e "\n\e[95mSystem Update :\e[0m"
 sudo apt-get update
-sudo apt-get install automake autoconf pkg-config libcurl4-openssl-dev libjansson-dev libssl-dev libgmp-dev make g++ -y
+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
 echo -e "\e[97mDone !\e[0m"
 
-echo -e "\n\e[95mDownload/compile source  :\e[0m"
+echo -e "\n\e[95mDownload sources  :\e[0m"
 cd ~
 if ! [ -d cpuminer-multi ]
 then
@@ -42,16 +42,120 @@ git clone https://github.com/JayDDee/cpuminer-opt.git && echo
 fi
 if ! [ -d cpuminer-xzc ]
 then
-git clone https://github.com/aizensou/cpuminer-xzc.git
+git clone https://github.com/aizensou/cpuminer-xzc.git && echo
 fi
+if ! [ -d xmr-stak_cpu ]
+then
+git clone https://github.com/fireice-uk/xmr-stak-cpu.git xmr-stak_cpu && echo
+fi
+if ! [ -d xmrig_cpu ]
+then
+git clone https://github.com/xmrig/xmrig.git xmrig_cpu
+fi
+
+echo -e "\n\e[95mBuild cpuminer-multi:\e[0m"
 cd ~/cpuminer-multi
 ./build.sh
+echo -e "\e[97mDone !\e[0m"
+
+echo -e "\n\e[95mBuild cpuminer-opt:\e[0m"
 cd ~/cpuminer-opt
 ./build.sh
+echo -e "\e[97mDone !\e[0m"
+
+echo -e "\n\e[95mBuild cpuminer-xzc:\e[0m"
 cd ~/cpuminer-xzc
 ./build.sh
 echo -e "\e[97mDone !\e[0m"
 
+echo -e "\n\e[95mBuild xmr-stak-cpu:\e[0m"
+cd /tmp/
+if ! [ -f hwloc-1.11.8.tar.gz ]
+then
+wget https://www.open-mpi.org/software/hwloc/v1.11/downloads/hwloc-1.11.8.tar.gz
+tar xzvf hwloc-1.11.8.tar.gz
+fi
+cd hwloc-1.11.8
+./configure --prefix=/usr/local
+make
+sudo make install
+echo ""
+cd ~
+chown -R work xmr-stak_cpu
+cd xmr-stak_cpu
+git pull
+if [ -d build ]
+then
+rm -r build
+fi
+mkdir build
+sed -i -e "s/= 2.0/= 0.0/g" donate-level.h
+cd build
+cmake ..
+make $(if $(THREADS="-j$(($(tail -c 2 /sys/devices/system/node/node0/cpulist 2>/dev/null)+2))"); then echo $THREADS; fi)
+cd ~
+if [ -f ~/xmr-stak-cpu ];
+then
+sudo rm ~/xmr-stak-cpu;
+fi
+sudo cp xmr-stak_cpu/build/bin/xmr-stak-cpu /usr/local/bin/xmr-stak-cpu
+cd ~
+if ! [ -f xmrstak-cpu ]
+then
+ln -s /usr/local/bin/xmr-stak-cpu ~/xmr-stak-cpu | true
+fi
+echo
+if ! grep -q "vm.nr_hugepages=256" /etc/sysctl.conf
+then
+sudo bash -c 'echo "vm.nr_hugepages=256" >> /etc/sysctl.conf'
+sudo bash -c 'sysctl -p'
+fi
+echo -e "\e[97mDone !\e[0m"
+
+echo -e "\n\e[95mInstall xmrig-cpu:\e[0m"
+cd ~
+cd /tmp/
+if ! [ -d libuv ]; then git clone https://github.com/libuv/libuv.git ;fi
+cd libuv
+./autogen.sh
+./configure
+make -j $(nproc)
+sudo make install
+sudo ldconfig
+cd ~
+cd xmrig_cpu
+if ! [ -f patch_donate.patch ]
+then
+cat <<'EOF'>> patch_donate.patch
+diff --git a/src/donate.h b/src/donate.h
+index 46f26b7..67a9cb0 100644
+--- a/src/donate.h
++++ b/src/donate.h
+@@ -43,8 +43,8 @@
+  * XMR: 48edfHu7V9Z84YzzMa6fUueoELZ9ZRXq9VetWzYGzKt52XU5xvqgzYnDK9URnRoJMk1j8n$
+  * BTC: 1P7ujsXeX7GxQwHNnJsRMgAdNkFZmNVqJT
+  */
+-constexpr const int kDefaultDonateLevel = 5;
+-constexpr const int kMinimumDonateLevel = 1;
++constexpr const int kDefaultDonateLevel = 0;
++constexpr const int kMinimumDonateLevel = 0;
+
+
+ #endif /* __DONATE_H__ */
+EOF
+patch -p1 <patch_donate.patch
+fi
+if ! [ -d build ];then mkdir build; fi
+cd build
+cmake ..
+make -j $(nproc)
+cd ~
+if ! [ -f xmrig-cpu ]
+then ln -s xmrig_cpu/build/xmrig xmrig-cpu
+fi
+echo "Done."
+
+
 echo -e "\n\e[95mAdd autostart miner_cpu.sh :\e[0m"
 if ! grep --quiet "su work -c '/home/work/miner_cpu.sh'" /etc/rc.local
 then