|
@@ -0,0 +1,357 @@
|
|
|
+#!/bin/bash
|
|
|
+set -e
|
|
|
+script_version="1.43"
|
|
|
+rdate="01/07/2018"
|
|
|
+remote_folder="http://wareck.free.fr/openrig"
|
|
|
+amd_driver_v="18.20-606296"
|
|
|
+
|
|
|
+#### OPTIONS ####
|
|
|
+ROCM_="NO" #rcom compute
|
|
|
+ETHMine="YES"
|
|
|
+GRIDV2="YES"
|
|
|
+SGMINER="YES"
|
|
|
+SGMINER_TT="YES"
|
|
|
+Lyra2z="YES"
|
|
|
+
|
|
|
+swap_size="0" # 0/4/8/16 Go
|
|
|
+
|
|
|
+#script_version=`grep version version.txt | awk '{ print $2 }'`
|
|
|
+#rdate=`grep release version.txt | awk '{ print $2 }'`
|
|
|
+
|
|
|
+
|
|
|
+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}'`"
|
|
|
+
|
|
|
+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
|
|
|
+if [ $ROCM_ = "YES" ]; then echo -e "\e[91m AMD DRIVER + ROCm Compute firmware \e[0m\e[97m";fi
|
|
|
+if [ $ROCM_ = "NO" ]; then echo -e "\e[91m AMD GPU PRO Drivers $amd_driver_v\e[0m\e[97m";fi
|
|
|
+if [ $GRIDV2 = "YES" ]; then echo -e "\e[97m +\e[91m NXZT Gridv2 support\e[0m\e[97m";fi
|
|
|
+if [ $ETHMine = "YES" ]; then echo -e "\e[97m +\e[91m Etherminer \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
|
|
|
+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
|
|
|
+
|
|
|
+sleep 4
|
|
|
+sed -i -e "s/# set const/set const/g" /etc/nanorc
|
|
|
+
|
|
|
+echo -e "\n\e[95mExpand Disk :\e[0m"
|
|
|
+sudo growpart /dev/sda 1 |true
|
|
|
+sudo resize2fs /dev/sda1 |true
|
|
|
+echo -e "\e[97mDone !\e[0m"
|
|
|
+
|
|
|
+echo -e "\n\e[95mSystem Update :\e[0m"
|
|
|
+sudo apt-get update
|
|
|
+sudo add-apt-repository -y ppa:ethereum/ethereum -y
|
|
|
+sudo apt-get update
|
|
|
+sudo apt install ethereum git screen htop curl ntp pv git cmake libcryptopp-dev 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 -y
|
|
|
+cd ~
|
|
|
+sleep 5
|
|
|
+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
|
|
|
+sudo apt dist-upgrade -y
|
|
|
+
|
|
|
+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-dkms 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"
|
|
|
+mkdir /home/work/tempo |true
|
|
|
+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
|
|
|
+#curl -sf http://wareck.free.fr/grinder/drivers/amdgpu-pro-17.50-511655.tar.xz | tar xvJ
|
|
|
+curl -sf http://wareck.free.fr/grinder/drivers/amdgpu-pro-18.20-606296.tar.xz | tar xvJ
|
|
|
+#cd amdgpu-pro-17.50-511655
|
|
|
+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
|
|
|
+./amdgpu-pro-install --pro --opencl=legacy -y
|
|
|
+fi
|
|
|
+
|
|
|
+echo -e "\n\e[95mInstall AMD SDK :\e[0m"
|
|
|
+cd /home/work/tempo
|
|
|
+./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_SDK10.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 Miners :\e[0m"
|
|
|
+cd /home/work/
|
|
|
+sudo -u work curl -sf $remote_folder/miners/claymore_dual_$claymore_dual_v.tar.xz | tar xvJ
|
|
|
+echo ""
|
|
|
+sudo -u work curl -sf $remote_folder/miners/claymore_zcash_$claymore_zcash_v.tar.xz | tar xvJ
|
|
|
+echo ""
|
|
|
+sudo -u work curl -sf $remote_folder/miners/claymore_xmr_$claymore_xmr_v.tar.xz | tar xvJ
|
|
|
+echo ""
|
|
|
+sudo -u work curl -sf http://wareck.free.fr/grinder/miner.sh.tar.xz | tar xvJ
|
|
|
+sudo chown work claymore
|
|
|
+sudo chown work claymore_xmr
|
|
|
+sudo chown work claymore_zcash
|
|
|
+sudo chown work /home/work/miner.sh
|
|
|
+
|
|
|
+if [ $ETHMine = "YES" ]
|
|
|
+then
|
|
|
+echo -e "\n\e[95mInstall ETHMiner :\e[0m"
|
|
|
+cd ~
|
|
|
+if [ ! -d cpp_ethminer ]
|
|
|
+then
|
|
|
+git clone https://github.com/ethereum-mining/ethminer.git cpp_ethminer
|
|
|
+else
|
|
|
+cd cpp_ethminer
|
|
|
+git pull
|
|
|
+cd ~
|
|
|
+fi
|
|
|
+cd cpp_ethminer
|
|
|
+git submodule update --init --recursive
|
|
|
+mkdir build |true
|
|
|
+cd build
|
|
|
+cmake .. -DETHASHCUDA=OFF -DETHASHCL=ON
|
|
|
+make
|
|
|
+cd ~
|
|
|
+ln -s cpp_ethminer/build/ethminer/ethminer ethminer | true
|
|
|
+fi
|
|
|
+echo -e "\e[97mDone !\e[0m"
|
|
|
+
|
|
|
+if [ $SGMINER = "YES" ]
|
|
|
+then
|
|
|
+echo -e "\n\e[95mInstall SGMINER:\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 $(if $(THREADS="-j$(($(tail -c 2 /sys/devices/system/node/node0/cpulist 2>/dev/null)+2))"); then echo $THREADS; fi)
|
|
|
+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 ~
|
|
|
+echo -e "\e[97mDone !\e[0m"
|
|
|
+fi
|
|
|
+fi
|
|
|
+
|
|
|
+if [ $Lyra2z = "YES" ]
|
|
|
+then
|
|
|
+echo -e "\n\e[95mInstall Lyra2Z GPU Miner (experimental):\e[0m"
|
|
|
+cd ~
|
|
|
+sudo -u work curl -sf http://wareck.free.fr/grinder/lyra2z.tar.xz | tar xvJ
|
|
|
+fi
|
|
|
+cd ~/sgminer-msvc2015
|
|
|
+git pull
|
|
|
+./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 $(if $(THREADS="-j$(($(tail -c 2 /sys/devices/system/node/node0/cpulist 2>/dev/null)+2))"); then echo $THREADS; fi)
|
|
|
+cd ~
|
|
|
+echo "Done."
|
|
|
+
|
|
|
+if [ $GRIDV2 = "YES" ]
|
|
|
+then
|
|
|
+echo -e "\n\e[95mInstall Grid+v2 :\e[0m"
|
|
|
+cd ~
|
|
|
+if ! [ -d /home/work/gridfan ]
|
|
|
+then git clone https://github.com/CapitalF/gridfan.git
|
|
|
+sudo cp ~/gridfan/gridfan /usr/local/bin/
|
|
|
+fi
|
|
|
+gridfan ping | true
|
|
|
+gridfan set fans all speed 40 |true
|
|
|
+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
|
|
|
+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 | true
|
|
|
+
|
|
|
+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/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[93m
|
|
|
+ _ _
|
|
|
+ _| |_|___ ___ ___ ___
|
|
|
+| . | | . | . | -_| _|
|
|
|
+|___|_|_ |_ |___|_|
|
|
|
+ |___|___| v$script_version
|
|
|
+
|
|
|
+\e[0m"
|
|
|
+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[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
|
|
|
+reboot
|