123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626 |
- #!/bin/bash
- set -e
- script_version="1.54"
- rdate="20/02/2019"
- remote_folder="http://wareck.free.fr/openrig"
- lsb_v="`lsb_release -r | awk '{print$2; exit}'`"
- lsb_r="`lsb_release -d | awk '{print$2" "$3}'`"
- curdir=$PWD
- #### OPTIONS ####
- host_name="OpenRig"
- #Drivers="16.40"
- Drivers="16.60"
- #Drivers="17.50"
- #Drivers="18.20"
- #Drivers="18.40"
- #Drivers="18.50" #ubuntu 18.04
- #Drivers="19.30" #ubuntu 18.04
- ROCM_="NO" #rcom compute
- ETHMine="YES"
- XMRIG_AMD="YES"
- XMR_STAK="YES"
- SGMINER="YES"
- SGMINER_TT="YES"
- SGMINER_x16r="YES"
- Lyra2z="NO"
- Phoenix="YES"
- lolMiner="YES"
- Gminer="YES"
- swap_size="16" # 0/4/8/16 Go
- NewNiceHash="YES"
- Pro="YES"
- #script_version=`grep version version.txt | awk '{ print $2 }'`
- #rdate=`grep release version.txt | awk '{ print $2 }'`
- #if [[ $lsb_v = "18.04" || $lsb_v = "18.10" ]]; then Drivers="18.50" && Lyra2z="NO" && ROCM_="NO" ;fi
- if [ $Drivers = "16.40" ]; then amd_driver_v="16.40-348864" && ROCM_="NO" ;fi
- if [ $Drivers = "16.60" ]; then amd_driver_v="16.60-379184" && ROCM_="NO" ;fi
- if [ $Drivers = "17.50" ]; then amd_driver_v="17.50-511655" && ROCM_="NO" ;fi
- if [ $Drivers = "18.20" ]; then amd_driver_v="18.20-606296" && Lyra2z="NO" && ROCM_="NO" ;fi
- if [ $Drivers = "18.40" ]; then amd_driver_v="18.40-673869" && Lyra2z="NO" && ROCM_="NO" ;fi
- if [ $Drivers = "18.50" ]; then amd_driver_v="18.50-708488" && Lyra2z="NO" && ROCM_="NO" ;fi
- if [ $Drivers = "19.30" ]; then amd_driver_v="19.30-855429" && Lyra2z="NO" && ROCM_="NO" ;fi
- if [ $UID -ne 0 ]
- then
- echo -e "\n\e[91mPlease run this script as ROOT : sudo ./setup.sh \e[0m"
- echo
- sleep 1
- exit
- fi
- claymore_dual_v="`curl -s $remote_folder/version.txt | awk 'NR==1 {print$3; exit}'`"
- claymore_zcash_v="`curl -s $remote_folder/version.txt | awk 'NR==2 {print$3; exit}'`"
- claymore_xmr_v="`curl -s $remote_folder/version.txt | awk 'NR==3 {print$3; exit}'`"
- lolminer_v="`curl -s $remote_folder/version.txt | awk 'NR==6 {print$3; exit}'`"
- Phoenix_v="`curl -s $remote_folder/version.txt | awk 'NR==7 {print$3; exit}'`"
- Gminer_v="`curl -s $remote_folder/version.txt | awk 'NR==8 {print$3; exit}'`"
- echo ""
- echo -n -e " \e[97m\u2554"
- for i in {1..36}; do echo -e -n "\u2550"; done
- echo -e "\u2557\e[0m"
- echo -e " \e[97m\u2551 Mining Rig Auto-install \e[93m"V$script_version"\e[0m\e[97m \u2551\e[0m"
- echo -e " \e[97m\u2551 Release date: \e[93m"$rdate"\e[0m\e[97m \u2551\e[0m"
- echo -e " \e[97m\u2551 wareck@gmail.com \u2551\e[0m"
- echo -n -e " \e[97m\u255A"
- for j in {1..36}; do echo -e -n "\u2550";done
- echo -e -n "\u255D\e[0m"
- echo
- echo
- if [ $lsb_v = "18.04" ]; then echo -e "\e[97m Ubuntu 18.04 \e[0m\e[97m";fi
- if [ $lsb_v = "18.10" ]; then echo -e "\e[97m Ubuntu 18.10 \e[0m\e[97m";fi
- if [ $ROCM_ = "YES" ]; then echo -e "\e[94m AMD DRIVER + ROCm Compute firmware \e[0m\e[97m";fi
- if [ $ROCM_ = "NO" ]; then echo -e "\e[94m AMD GPU PRO Drivers $amd_driver_v\e[0m\e[97m";fi
- echo -e ""
- if [ $NewNiceHash = "YES" ]; then echo -e "\e[97m +\e[92m New NicheHash\e[0m\e[93m";fi
- if [ $ETHMine = "YES" ]; then echo -e "\e[97m +\e[91m Etherminer \e[0m\e[97m";fi
- if [ $XMRIG_AMD = "YES" ]; then echo -e "\e[97m +\e[91m XMRig-amd \e[0m\e[97m";fi
- if [ $XMR_STAK = "YES" ]; then echo -e "\e[97m +\e[91m XMR-Stak \e[0m\e[97m";fi
- if [ $lolMiner = "YES" ]; then echo -e "\e[97m +\e[91m lolMiner v$lolminer_v\e[0m\e[97m";fi
- if [ $SGMINER = "YES" ]; then echo -e "\e[97m +\e[91m Sgminer-nicehash\e[0m\e[97m";fi
- if [ $SGMINER_TT = "YES" ]; then echo -e "\e[97m +\e[91m Sgminer-timetravel\e[0m\e[97m";fi
- if [ $SGMINER_x16r = "YES" ]; then echo -e "\e[97m +\e[91m Sgminer-x16r\e[0m\e[97m";fi
- echo -e "\e[97m +\e[91m Claymore dualminer $claymore_dual_v\e[0m\e[97m"
- echo -e "\e[97m +\e[91m Claymore zcash $claymore_zcash_v\e[0m\e[97m"
- echo -e "\e[97m +\e[91m Claymore xmr $claymore_xmr_v\e[0m\e[97m"
- if [ $Lyra2z = "YES" ]; then echo -e "\e[97m +\e[91m Lyra2z GPU Mining (experimental)\e[0m\e[97m";fi
- if [ $Phoenix = "YES" ]; then echo -e "\e[97m +\e[91m Phoenix ETH v$Phoenix_v \e[0m\e[97m";fi
- if [ $Gminer = "YES" ]; then echo -e "\e[97m +\e[91m Gminer v$Gminer_v \e[0m\e[97m";fi
- echo
- sleep 4
- sed -i -e "s/# set const/set const/g" /etc/nanorc
- echo -e "\n\e[95mExpand Disk :\e[0m"
- sudo growpart `df -h | grep /dev/sd | awk ' { print $1 }'| cut -c -8` 1 |true
- sudo resize2fs `df -h | grep /dev/sd | awk ' { print $1 }'` |true
- echo -e "\e[97mDone !\e[0m"
- echo -e "\n\e[95mSystem Update :\e[0m"
- sudo apt-get update && echo ""
- sudo add-apt-repository -y ppa:ethereum/ethereum -y && echo ""
- sudo apt-get update && echo ""
- cd ~
- sudo sed -i -e "s/quiet splash/text/g" /etc/default/grub
- sudo sed -i -e 's#GRUB_CMDLINE_LINUX=""#GRUB_CMDLINE_LINUX="amddgpu.vm_fragment_size=9"#g' /etc/default/grub
- sudo update-grub2 && echo ""
- sudo apt dist-upgrade -y && echo ""
- 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
- sudo apt install ethereum git screen htop curl ntp pv git cmake libleveldb-dev libjsoncpp-dev \
- build-essential libcurl4-gnutls-dev libboost-all-dev libgmp-dev \
- libreadline-dev libmicrohttpd-dev libjansson-dev libgmp-dev libssl-dev unzip python-nfqueue python-scapy mesa-common-dev -y && echo ""
- if ! [[ $lsb_v = "18.04" || $lsb_v = "18.10" ]];then sudo apt install libcryptopp-dev -y ;fi && echo""
- if ! [[ $lsb_v = "18.04" || $lsb_v = "18.10" ]];then sudo apt-get install --install-recommends xserver-xorg-hwe-16.04 -y; fi && echo ""
- if [ $ROCM_ = "YES" ]
- then
- sudo apt-get install libnuma-dev -y
- echo -e "\n\e[95mInstall ROCm Compute:\e[0m"
- #update ROCM
- sudo apt-get install libnuma-dev -y
- wget -qO - http://repo.radeon.com/rocm/apt/debian/rocm.gpg.key | sudo apt-key add -
- sudo sh -c 'echo deb [arch=amd64] http://repo.radeon.com/rocm/apt/debian/ xenial main > /etc/apt/sources.list.d/rocm.list'
- sudo apt-get update
- sudo apt-get install rocm-opencl-dev -y
- sudo usermod -a -G video work
- cd ..
- echo -e "\e[97mDone !\e[0m"
- fi
- echo -e "\n\e[95mInstall AMD Drivers :\e[0m"
- if ! [ -d /home/work/tempo ];then mkdir /home/work/tempo ; fi
- cd /home/work/tempo
- if [ $Drivers = "16.40" ]
- then
- wget -c http://wareck.free.fr/grinder/drivers/amdgpu-pro-16.40-348864.tar.xz
- tar xvfJ amdgpu-pro-16.40-348864.tar.xz
- rm amdgpu-pro-16.40-348864.tar.xz
- cd amdgpu-pro-16.40-348864
- if [ $ROCM_ = "YES" ]
- then
- sed -i -e "s/amdgpu-pro-dkms libdrm2-amdgpu-pro/libdrm2-amdgpu-pro/g" amdgpu-pro-install
- ./amdgpu-pro-install --px -y
- else
- ./amdgpu-pro-install --px -y
- fi
- fi
- if [ $Drivers = "16.60" ]
- then
- wget -c http://wareck.free.fr/grinder/drivers/amdgpu-pro-16.60-379184.tar.xz
- tar xvfJ amdgpu-pro-16.60-379184.tar.xz
- rm amdgpu-pro-16.60-379184.tar.xz
- cd amdgpu-pro-16.60-379184
- chmod +x amdgpu-pro-install
- ./amdgpu-pro-install --px -y
- fi
- if [ $Drivers = "17.50" ]
- then
- wget -c http://wareck.free.fr/grinder/drivers/amdgpu-pro-17.50-511655.tar.xz
- tar xvfJ amdgpu-pro-17.50-511655.tar.xz
- rm amdgpu-pro-17.50-511655.tar.xz
- cd amdgpu-pro-17.50-511655
- if [ $ROCM_ = "YES" ]
- then
- sed -i -e "s/amdgpu-pro-dkms libdrm2-amdgpu-pro/libdrm2-amdgpu-pro/g" amdgpu-pro-install
- ./amdgpu-pro-install --pro --opencl=legacy,rocm -y
- else
- if [ $Pro = "YES" ]
- then
- ./amdgpu-pro-install --pro --opencl=legacy -y
- else
- ./amdgpu-install --opencl=legacy -y
- fi
- fi
- fi
- if [ $Drivers = "18.20" ]
- then
- echo "Download amdgpu-pro-18.20-606296.tar.xz"
- wget -c http://wareck.free.fr/grinder/drivers/amdgpu-pro-18.20-606296.tar.xz
- tar xvfJ amdgpu-pro-18.20-606296.tar.xz
- rm amdgpu-pro-18.20-606296.tar.xz
- cd amdgpu-pro-18.20-606296
- if [ $ROCM_ = "YES" ]
- then
- sed -i -e "s/amdgpu-pro-dkms libdrm2-amdgpu-pro/libdrm2-amdgpu-pro/g" amdgpu-pro-install
- ./amdgpu-pro-install --pro --opencl=legacy,rocm -y
- else
- if [ $Pro = "YES" ]
- then
- ./amdgpu-pro-install --pro --opencl=legacy -y
- else
- ./amdgpu-install --opencl=legacy -y
- fi
- fi
- fi
- if [ $Drivers = "18.40" ]
- then
- echo "Download amdgpu-pro-18.40-673869-ubuntu-16.04.tar.xz"
- wget -c http://wareck.free.fr/grinder/drivers/amdgpu-pro-18.40-673869-ubuntu-16.04.tar.xz
- tar xvfJ amdgpu-pro-18.40-673869-ubuntu-16.04.tar.xz
- rm amdgpu-pro-18.40-673869-ubuntu-16.04.tar.xz
- cd amdgpu-pro-18.40-673869-ubuntu-16.04
- ./amdgpu-pro-install --pro --opencl=legacy -y
- fi
- if [ $Drivers = "18.50" ]
- then
- echo "Download amdgpu-pro-18.40-673869-ubuntu-16.04.tar.xz"
- wget -c http://wareck.free.fr/grinder/drivers/amdgpu-pro-18.50-708488-ubuntu-18.04.tar.xz
- tar xvfJ amdgpu-pro-18.50-708488-ubuntu-18.04.tar.xz
- rm amdgpu-pro-18.50-708488-ubuntu-18.04.tar.xz
- cd amdgpu-pro-18.50-708488-ubuntu-18.04
- ./amdgpu-pro-install --pro --opencl=legacy -y
- fi
- if [ $Drivers = "19.30" ]
- then
- echo "Download amdgpu-pro-19.30-855429-ubuntu-18.04.tar.xz"
- wget -c http://wareck.free.fr/grinder/drivers/amdgpu-pro-19.30-855429-ubuntu-18.04.tar.xz
- tar xvfJ amdgpu-pro-19.30-855429-ubuntu-18.04.tar.xz
- rm amdgpu-pro-19.30-855429-ubuntu-18.04.tar.xz
- cd amdgpu-pro-19.30-855429-ubuntu-18.04
- ./amdgpu-pro-install --pro --opencl=legacy -y
- fi
- echo -e "\n\e[95mInstall AMD SDK :\e[0m"
- cd /home/work/tempo/
- curl -f http://wareck.free.fr/grinder/drivers/AMD-APP-SDKInstaller-v3.0.130.136-GA-linux64.tar.bz2 | tar xvj
- ./AMD-APP-SDK-v3.0.130.136-GA-linux64.sh
- cd /opt/
- if [ -d ADL_SDK ]; then rm -r /opt/ADL_SDK; fi
- mkdir ADL_SDK
- cd ADL_SDK
- wget -c http://wareck.free.fr/grinder/drivers/ADL_SDK102.zip -O ADL_SDK.zip
- unzip -q ADL_SDK.zip
- cd ~
- echo -e "\e[97mDone !\e[0m"
- sleep 2
- echo -e "\n\e[95mInstall Claymore Dualminer :\e[0m"
- cd /home/work/
- sudo -u work curl -sf $remote_folder/miners/claymore_dual_$claymore_dual_v.tar.xz | tar xvJ
- echo -e "\n\e[95mInstall Claymore Zcash miner:\e[0m"
- sudo -u work curl -sf $remote_folder/miners/claymore_zcash_$claymore_zcash_v.tar.xz | tar xvJ
- echo -e "\n\e[95mInstall Claymore Xmr miner:\e[0m"
- sudo -u work curl -sf $remote_folder/miners/claymore_xmr_$claymore_xmr_v.tar.xz | tar xvJ
- echo ""
- if [ $NewNiceHash = "YES" ]
- then
- echo -e "\n\e[95mInstall miner.sh (NewNiceHash) :\e[0m"
- cp -v $curdir/miner_new.sh /home/work/miner.sh
- else
- echo -e "\n\e[95mInstall miner.sh :\e[0m"
- cp -v $curdir/miner.sh /home/work/miner.sh
- fi
- sudo chown work claymore
- sudo chown work claymore_xmr
- sudo chown work claymore_zcash
- sudo chown work /home/work/miner.sh
- if [ $Phoenix = "YES" ]
- then
- echo -e "\n\e[95mInstall Phoenix v$Phoenix_v :\e[0m"
- sudo -u work curl -sf $remote_folder/miners/PhoenixMiner_v$Phoenix_v.tar.xz | tar xvJ
- sudo chown -R work /home/work/PhoenixMiner
- fi
- if [ $lolMiner = "YES" ]
- then
- echo -e "\n\e[95mInstall lolMiner v$lolminer_v :\e[0m"
- sudo -u work curl -sf $remote_folder/miners/lolMiner_v$lolminer_v.tar.xz | tar xvJ
- sudo chown -R work /home/work/lolMiner
- fi
- if [ $Gminer = "YES" ]
- then
- echo -e "\n\e[95mInstall Gminer v$Gminer_v :\e[0m"
- sudo -u work curl -sf $remote_folder/miners/gminer_v$Gminer_v.tar.xz | tar xvJ
- sudo chown -R work /home/work/gminer
- fi
- if [ $ETHMine = "YES" ]
- then
- echo -e "\n\e[95mInstall Ethminer :\e[0m"
- cd ~
- if [ -d cpp_ethminer ] ; then rm -r cpp_ethminer ;fi
- git clone -n https://github.com/ethereum-mining/ethminer.git cpp_ethminer
- cd cpp_ethminer
- #git checkout 2200dca33d35273fb2a7843a7d313a9a31bcd246
- git checkout 80fbba158850c3a5ec83ff4849023bb256333a3a #last stable
- cd ~/cpp_ethminer
- git submodule update --init --recursive
- mkdir build |true
- cd build
- cmake .. -DETHASHCUDA=OFF -DETHASHCL=ON
- make
- cd ~
- if [ -f ~/ethminer ]; then rm ~/ethminer ;fi
- ln -s cpp_ethminer/build/ethminer/ethminer ethminer
- cd /tmp
- wget http://wareck.free.fr/grinder/cpp_ethminer_kernel.tar.xz
- tar xvfJ cpp_ethminer_kernel.tar.xz
- sudo mv kernels ~/cpp_ethminer/build/ethminer/
- cd ~
- echo -e "\e[97mDone !\e[0m"
- fi
- if [ $SGMINER = "YES" ]
- then
- echo -e "\n\e[95mInstall Sgminer-Nicehash:\e[0m"
- cd ~
- if [ ! -d sgminer ]
- then
- git clone https://github.com/nicehash/sgminer.git
- cd sgminer
- else
- cd sgminer
- git pull
- fi
- sudo apt install git autoconf automake libtool build-essential libncurses5-dev libcurl4-gnutls-dev -y
- git submodule init
- git submodule update
- autoreconf -fi
- 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
- make -j $(nproc)
- cd ~
- echo -e "\e[97mDone !\e[0m"
- fi
- if [ $SGMINER_TT = "YES" ]
- then
- echo -e "\n\e[95mInstall Sgminer-Timetravel:\e[0m"
- cd ~
- if [ ! -d sgminer-timetravel ]
- then
- sudo -u work curl -sf http://wareck.free.fr/openrig/miners/sgminer-timetravel.tar.xz | tar xvJ
- cd ~
- fi
- echo -e "\e[97mDone !\e[0m"
- fi
- if [ $Lyra2z = "YES" ]
- then
- echo -e "\n\e[95mInstall Lyra2Z GPU Miner (experimental):\e[0m"
- cd ~
- if [ -d sgminer-lyra2z ]; then rm -r sgminer-lyra2z ;fi
- git clone https://github.com/wareck/sgminer-lyra2z.git
- cd ~/sgminer-lyra2z
- git pull
- git submodule init
- git submodule update
- ./autogen.sh
- 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
- make -j $(nproc)
- cd ~
- echo "Done."
- fi
- if [ $SGMINER_x16r = "YES" ]
- then
- echo -e "\n\e[95mInstall Sgminer-x16r :\e[0m"
- cd ~
- if [ -d sgminer-x16r ]; then rm -r sgminer-x16r;fi
- git clone https://github.com/wareck/sgminer-x16r.git
- cd ~/sgminer-x16r
- git pull
- git submodule init
- git submodule update
- ./autogen.sh
- 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
- make -j $(nproc)
- cd ~
- echo "Done."
- fi
- if [ $XMRIG_AMD = "YES" ]
- then
- echo -e "\n\e[95mInstall xmrig-amd:\e[0m"
- cd ~
- if [ -d xmrig_amd ]; then rm -r xmrig_amd ; fi
- git clone https://github.com/xmrig/xmrig-amd.git xmrig_amd
- 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_amd
- 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-amd ]; then ln -s xmrig_amd/build/xmrig-amd xmrig-amd ;fi
- echo "Done."
- fi
- if [ $XMR_STAK = "YES" ]
- then
- echo -e "\n\e[95mInstall xmr-stak:\e[0m"
- cd /tmp/
- wget http://wareck.free.fr/grinder/hwloc-1.11.8.tar.xz
- tar xvfJ hwloc-1.11.8.tar.xz
- cd hwloc-1.11.8
- ./autogen.sh
- ./configure --prefix=/usr/local
- make -j $(nproc)
- sudo make install
- cd ~
- if [ -d xmr_stak ]; then rm -r xmr_stak ;fi
- git clone https://github.com/fireice-uk/xmr-stak.git xmr_stak
- cd xmr_stak
- sudo ln -s /opt/amdgpu-pro/lib/x86_64-linux-gnu/libOpenCL.so /usr/lib/libOpenCL.so.1 | true
- mkdir build
- sed -i -e "s/= 2.0/= 0.0/g" xmrstak/donate-level.hpp
- cd build
- cmake .. -DCPU_ENABLE=OFF -DHWLOC_ENABLE=OFF -DMICROHTTPD_ENABLE=OFF -DCMAKE_LINK_STATIC=ON -DCMAKE_BUILD_TYPE=Release -DCUDA_ENABLE=OFF \
- -DOpenCL_LIBRARY=/opt/AMDAPPSDK-3.0/lib/x86_64/libOpenCL.so -DOpenCL_INCLUDE_DIR=/opt/AMDAPPSDK-3.0/include/ -DXMR-STAK_COMPILE=generic
- make -j $(nproc)
- cd ~
- if ! [ -f ~/xmr-stak ];then ln -s xmr_stak/build/bin/xmr-stak xmr-stak; fi
- sudo cp xmr_stak/build/bin/libxmrstak_opencl_backend.so /lib/
- cd ~
- if ! [ -f /etc/sysctl.d/60-hugepages.conf ]
- then
- sudo echo "vm.nr_hugepages=128" > /etc/sysctl.d/60-hugepages.conf
- sudo sysctl --system
- fi
- if ! [ -f /etc/security/limits.d/60-memlock.conf ]
- then
- sudo echo "* - memlock 262144" >/etc/security/limits.d/60-memlock.conf
- sudo echo "root - memlock 262144" >>/etc/security/limits.d/60-memlock.conf
- fi
- echo "Done"
- fi
- echo -e "\n\e[95mDownloading NoFees Patch:\e[0m"
- cd ~
- if [ -d remove_miner_fees ]
- then
- cd remove_miner_fees
- git pull
- else
- git clone https://github.com/wareck/remove_miner_fees.git
- chown -R work remove_miner_fees
- fi
- if ! [ -f /etc/rc.local ]
- then
- printf '%s\n' '#!/bin/bash' 'exit 0' | sudo tee -a /etc/rc.local
- sudo chmod +x /etc/rc.local
- fi
- chmod 777 /etc/rc.local
- if ! grep --quiet "/home/work/remove_miner_fees" /etc/rc.local
- then
- sed -i "s/exit 0//g" /etc/rc.local
- RC_LOCAL_CMD0="#python /home/work/remove_miner_fees/remove_mining_fees.py &"
- RC_LOCAL_CMD1="#python /home/work/remove_miner_fees/zcach.py &"
- RC_LOCAL_CMD2="#python /home/work/remove_miner_fees/hush.py &"
- RC_LOCAL_CMD3="#python /home/work/remove_miner_fees/ubiq.py &"
- RC_LOCAL_CMD4="#python /home/work/remove_miner_fees/soilcoin.py &"
- echo $RC_LOCAL_CMD0 >>/etc/rc.local
- echo $RC_LOCAL_CMD1 >>/etc/rc.local
- echo $RC_LOCAL_CMD2 >>/etc/rc.local
- echo $RC_LOCAL_CMD3 >>/etc/rc.local
- echo $RC_LOCAL_CMD4 >>/etc/rc.local
- echo "exit 0" >>/etc/rc.local
- fi
- echo -e "\e[97mDone !\e[0m"
- echo -e "\n\e[95mInstall AutoStart:\e[0m"
- if [ -f /home/work/.config/autostart/miner.sh.desktop ];then rm /home/work/.config/autostart/miner.sh.desktop |true ; fi
- if ! [ -d /home/work/.config ]; then mkdir /home/work/.config ;fi
- if ! [ -d /home/work/.config/autostart ]; then mkdir /home/work/.config/autostart;fi
- cat <<EOF>> /home/work/.config/autostart/miner.sh.desktop
- [Desktop Entry]
- Type=Application
- Exec=/home/work/miner.sh
- Hidden=false
- NoDisplay=false
- X-GNOME-Autostart-enabled=true
- Name[fr_FR]=miner
- Name=miner
- Comment[fr_FR]=miner
- Comment=miner
- EOF
- sleep 5
- chmod 777 /etc/rc.local
- if ! grep --quiet "su work -c '/home/work/miner.sh'" /etc/rc.local
- then
- sed -i "s/exit 0//g" /etc/rc.local
- RC_LOCAL_CMD0="su work -c '/home/work/miner.sh'"
- echo $RC_LOCAL_CMD0 >>/etc/rc.local
- echo "exit 0" >>/etc/rc.local
- fi
- echo -e "\e[97mDone !\e[0m"
- cd /home/work/
- sudo rm -r tempo
- echo -e "\n\e[95mMessage of the day mod :\e[0m"
- rm /etc/update-motd.d/00-header | true
- rm /etc/update-motd.d/10-help-text |true
- rm /etc/update-motd.d/90-updates-available |true
- rm /etc/update-motd.d/91-release-upgrade |true
- rm /etc/update-motd.d/98-fsck-at-reboot |true
- rm /etc/update-motd.d/98-reboot-required |true
- echo " - 00-header "
- cat <<EOF >> /etc/update-motd.d/00-header
- #!/bin/sh
- [ -r /etc/lsb-release ] && . /etc/lsb-release
- if [ -z "$DISTRIB_DESCRIPTION" ] && [ -x /usr/bin/lsb_release ]; then
- # Fall back to using the very slow lsb_release utility
- DISTRIB_DESCRIPTION=$(lsb_release -s -d)
- fi
- printf "Welcome to %s (%s %s %s)\n" "$DISTRIB_DESCRIPTION" " $(uname -o)" "$(uname -p)"
- EOF
- cd /etc/update-motd.d
- sudo -u work curl -sf http://folivier.homelinux.org/genethos/files/motd.tar.xz | tar xJ
- cd ~
- sed -i -e "s/#force_color_prompt=yes/force_color_prompt=yes/g" /home/work/.bashrc
- if ! grep --quiet "export DISPLAY=:0" /home/work/.bashrc
- then
- cat <<EOF>> /home/work/.bashrc
- export DISPLAY=:0
- echo -e "\e[97m
- Open Mining Platform \e[96mv$script_version\e[0m
- wareck@gmail.com
- "
- EOF
- fi
- echo -e "\e[97mDone !\e[0m"
- echo -e "\n\e[95mBuilding Swapfile :\e[0m"
- if ! grep -q "swapfile" /etc/fstab ; then
- case $swap_size in
- 0) fst="0";;
- 4) sudo dd if=/dev/zero | pv -s 4G | dd of=/swapfile iflag=fullblock bs=1024 count=4194304;;
- 8) sudo dd if=/dev/zero | pv -s 8G | dd of=/swapfile iflag=fullblock bs=1024 count=8388608;;
- 16) sudo dd if=/dev/zero | pv -s 16G | dd of=/swapfile iflag=fullblock bs=1024 count=16777216 ;;
- *) echo -e "\e[91mError in configuration !\e[0m" && exit ;;
- esac
- if ! [ $swap_size = "0" ]
- then
- sudo mkswap /swapfile
- sudo swapon /swapfile
- sudo cat <<'EOF'>> /etc/fstab
- /swapfile none swap sw 0 0
- EOF
- sudo chmod 600 /swapfile
- sudo touch /forcefsck
- fi
- else
- echo -e "\e[93mSwapfile already enabled... \e[0m"
- echo -e "\e[93mCheck /etc/fsatb file.\e[0m\n"
- fi
- echo -e "\e[97mDone !\e[0m"
- sudo usermod -a -G video work
- echo -e "\n\e[95mConfigure Hostname and Rig name:\e[0m"
- touch /tmp/hostname
- echo $host_name >/tmp/hostname
- sudo bash -c 'cp /tmp/hostname /etc/hostname'
- sed -i -e "s/digger/$host_name/g" /etc/hosts
- # rename rig in miner.sh
- sed -i -e "s/OpenRig/$host_name/g" miner.sh
- # nano count lines
- sed -i -e "s/# set const/set const/g" /etc/nanorc
- # reset ssh keys
- rm /etc/ssh/ssh_host_*
- dpkg-reconfigure openssh-server
- sudo apt-get autoremove -y
- echo "Done"
- echo -e "\n\e[92mEverything was done...\e[0m"
- echo -e -n "Reboot in 15 seconds (CRTL+C to abord): "
- for i in {15..1}
- do
- echo -e -n "$i "
- sleep 1
- done
- sudo reboot
|