123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181 |
- #!/bin/bash
- set -e
- Version=1.0
- Release=27/Apr/2021
- author=wareck@gmail.com
- function Intro_(){
- echo -e "\e[38;5;154mDietpi Mine and Forget for Scrypt\e[0m"
- echo -e "\e[38;5;154mVersion: $Version Release:$Release\e[0m"
- echo -e "Author: wareck@gmail.com\n"
- if [ -f /boot/dietpi.txt ];then DietPi_="YES";else DietPi_="NO";fi
- if [ $DietPi_ = "YES" ]
- then
- echo -e "\e[97mImage detected : \e[38;5;154mDietpi\e[0m\n"
- #echo -e "This script will enable /etc/rc.local for AutoStart\n"
- else
- echo -e "\e[97mImage detected : \e[38;5;197mRaspberry Os\e[0m\n"
- fi
- sudo sed -i -e "s/# set const/set const/g" /etc/nanorc
- }
- function Update_(){
- echo -e "\e[95mLibraries Update:\e[0m"
- sudo apt-get update
- sudo apt-get upgrade -y
- sudo apt-get install git -y
- sudo apt-get install git build-essential autoconf automake libtool pkg-config \
- libjansson-dev uthash-dev libncursesw5-dev libudev-dev libusb-1.0-0-dev \
- libevent-dev libmicrohttpd-dev libhidapi-dev libgcrypt20-dev screen \
- libcurl4-openssl-dev libssl-dev -y
- }
- function Build_bfgminer(){
- echo -e "\n\e[95mBuild Bfgminer:\e[0m"
- cd /home/$USER
- if ! [ -d bfgminer ]
- then
- git clone https://github.com/wareck/bfgminer.git
- else
- cd /home/$USER/bfgminer
- git pull
- fi
- cd /home/$USER/bfgminer
- sudo usermod -a -G dialout,plugdev $USER
- CFLAGS="-O2 -march=native" ./autogen.sh
- ./configure --enable-scrypt --enable-futurebit
- make
- sudo cp 70-bfgminer.rules /etc/udev/rules.d/
- }
- function Build_cgminer_scrypt(){
- echo -e "\n\e[95mBuild Cgminer:\e[0m"
- cd /home/$USER
- if ! [ -d /home/$USER/cgminer-scrypt ]
- then
- git clone https://github.com/wareck/cgminer-lketc.git cgminer-scrypt
- else
- cd /home/$USER/cgminer-scrypt
- git pull
- fi
- cd /home/$USER/cgminer-scrypt
- sudo usermod -a -G dialout,plugdev $USER
- CFLAGS="-O2 -march=native" ./autogen.sh
- ./configure --enable-scrypt --enable-lketc --enable-zeus
- make
- sudo cp 01-cgminer.rules /etc/udev/rules.d/
- }
- function Build_cgminer_sha(){
- echo -e "\n\e[95mBuild Cgminer:\e[0m"
- cd /home/$USER
- if ! [ -d /home/$USER/cgminer ]
- then
- git clone https://github.com/wareck/cgminer-gekko.git cgminer-sha
- else
- cd /home/$USER/cgminer-sha
- git pull
- fi
- cd /home/$USER/cgminer-sha
- sudo usermod -a -G dialout,plugdev $USER
- CFLAGS="-O2 -march=native" ./autogen.sh
- ./configure --enable-gekko --enable-bflsc --enable-bitforce --enable-bitfury --enable-drillbit --enable-hashfast --enable-icarus --enable-klondike --enable-modminer
- make
- sudo cp 01-cgminer.rules /etc/udev/rules.d/
- }
- function Autostart_dietpi_ (){
- echo -e "\n\e[95mAdding rc.local Autostart:\e[0m"
- if ! [ -f /etc/rc.local ]
- then
- if [ -f /tmp/rc.local ];then rm /tmp/rc.local;fi
- cat <<'EOF'>>/tmp/rc.local
- #!/bin/bash
- exit 0
- EOF
- sudo cp /tmp/rc.local /etc/
- sudo chmod +x /etc/rc.local
- fi
- sudo systemctl disable rc-local
- sudo systemctl disable rc.local
- if ! [ -f /lib/systemd/system/rc-local.service ]
- then
- cat <<'EOF'>> /tmp/rc-local.service
- # This file is part of systemd.
- #
- # systemd is free software; you can redistribute it and/or modify it
- # under the terms of the GNU Lesser General Public License as published by
- # the Free Software Foundation; either version 2.1 of the License, or
- # (at your option) any later version.
- # This unit gets pulled automatically into multi-user.target by
- # systemd-rc-local-generator if /etc/rc.local is executable.
- [Unit]
- Description=/etc/rc.local Compatibility
- ConditionFileIsExecutable=/etc/rc.local
- After=network.target
- [Service]
- Type=forking
- ExecStart=/etc/rc.local start
- TimeoutSec=0
- RemainAfterExit=yes
- GuessMainPID=no
- EOF
- sudo cp /tmp/rc-local.service /lib/systemd/system/rc-local.service
- sudo systemctl daemon-reload
- fi
- echo -e "Done.\n"
- }
- function Minerconf_dietpi_ (){
- echo -e "\n\e[95mAdding Bfgminer to rc.local :\e[0m"
- if ! grep "#Start Mining" /etc/rc.local >/dev/null 2>&1
- then
- sudo bash -c 'sed -i -e "s/exit 0//g" /etc/rc.local'
- sudo bash -c 'echo "#Start Mining" >>/etc/rc.local'
- sudo bash -c 'echo "su - dietpi -c '\''screen -dmS miner /home/dietpi/bfgminer/bfgminer --scrypt -o stratum+tcp://litecoinpool.org:3333 -u wareck.1 -p 1,d=128 -S all --set MLD:clock=756 --set ZUS:clock=328 --set ZUS:chips=6'\''" >>/etc/rc.local'
- sudo bash -c 'echo "#su - dietpi -c '\''screen -dmS miner /home/dietpi/bfgminer/bfgminer --scrypt -o stratum+tcp://scrypt.eu.mine.zergpool.com:3433/#skipcbcheck#xnsub -u MJZqqHgsWeQGnh17e34qpPhJdJHM2afH6Q -p c=LTC,mc=DGB/MOON/XVG -S all --set MLD:clock=700 --set ZUS:clock=328 --set ZUS:chips=6'\''" >>/etc/rc.local'
- sudo bash -c 'echo "#su - dietpi -c '\''screen -dmS miner /home/dietpi/cgminer-sha/cgminer -o stratum+tcp://sha256.eu.mine.zergpool.com:3333#xnsub -u MJZqqHgsWeQGnh17e34qpPhJdJHM2afH6Q -p c=LTC,mc=BCA/BCHA/BSV/DGB/DVT/FCH/LANA/LCC/LCNT/LONG/PPC/PYRK/QBC/SHND/TIT/VLS --gekko-2pac-freq 100'\''" >>/etc/rc.local'
- sudo bash -c 'echo "#su - dietpi -c '\''screen -dmS miner /home/dietpi/cgminer-sha/cgminer -o stratum+tcp://eu.stratum.slushpool.com:3333 -u wareck.gekko -p x --gekko-2pac-freq 100'\''" >>/etc/rc.local'
- sudo bash -c 'echo "" >>/etc/rc.local'
- sudo bash -c 'echo "exit 0" >>/etc/rc.local'
- sudo chmod +x /etc/rc.local
- fi
- echo -e "Done."
- }
- function Minerconf_raspberryos_ (){
- echo -e "\n\e[95mAdding Bfgminer to rc.local :\e[0m"
- if ! grep "#Start Mining" /etc/rc.local >/dev/null 2>&1
- then
- sudo bash -c 'sed -i -e "s/exit 0//g" /etc/rc.local'
- sudo bash -c 'echo "#Start Mining" >>/etc/rc.local'
- sudo bash -c 'echo "su - pi -c '\''screen -dmS miner /home/pi/bfgminer/bfgminer --scrypt -o stratum+tcp://litecoinpool.org:3333 -u wareck.1 -p 1,d=128 -S all --set MLD:clock=756 --set ZUS:clock=328 --set ZUS:chips=6'\''" >>/etc/rc.local'
- sudo bash -c 'echo "#su - pi -c '\''screen -dmS miner /home/pi/bfgminer/bfgminer --scrypt -o stratum+tcp://scrypt.eu.mine.zergpool.com:3433/#skipcbcheck#xnsub -u MJZqqHgsWeQGnh17e34qpPhJdJHM2afH6Q -p c=LTC,mc=DGB/MOON/XVG -S all --set MLD:clock=700 --set ZUS:clock=328 --set ZUS:chips=6'\''" >>/etc/rc.local'
- sudo bash -c 'echo "#su - pi -c '\''screen -dmS miner /home/pi/cgminer-sha/cgminer -o stratum+tcp://sha256.eu.mine.zergpool.com:3333#xnsub -u MJZqqHgsWeQGnh17e34qpPhJdJHM2afH6Q -p c=LTC,mc=BCA/BCHA/BSV/DGB/DVT/FCH/LANA/LCC/LCNT/LONG/PPC/PYRK/QBC/SHND/TIT/VLS --gekko-2pac-freq 100'\''" >>/etc/rc.local'
- sudo bash -c 'echo "#su - pi -c '\''screen -dmS miner /home/pi/cgminer-sha/cgminer -o stratum+tcp://eu.stratum.slushpool.com:3333 -u wareck.gekko -p x --gekko-2pac-freq 100'\''" >>/etc/rc.local'
- sudo bash -c 'echo "" >>/etc/rc.local'
- sudo bash -c 'echo "exit 0" >>/etc/rc.local'
- sudo chmod +x /etc/rc.local
- fi
- echo -e "Done."
- }
- Intro_
- Update_
- Build_bfgminer
- Build_cgminer_sha
- Build_cgminer_scrypt
- if [ $DietPi_ = "YES" ]
- then
- Autostart_dietpi_
- Minerconf_dietpi_
- else
- Minerconf_raspberryos_
- fi
- echo -e "\nVoila ! reboot required"
|