123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182 |
- #!/bin/bash
- set -e
- Gui=Yes #can be Yes No or Only
- Version=2.3
- function print_centered {
- [[ $# == 0 ]] && return 1
- declare -i TERM_COLS="$(tput cols)"
- declare -i str_len="${#1}"
- [[ $str_len -ge $TERM_COLS ]] && {
- echo "$1";
- return 0;
- }
- declare -i filler_len="$(( (TERM_COLS - str_len) / 2 ))"
- [[ $# -ge 2 ]] && ch="${2:0:1}" || ch=" "
- filler=""
- for (( i = 0; i < filler_len; i++ )); do
- filler="${filler}${ch}"
- done
- printf "%s%s%s" "$filler" "$1" "$filler"
- [[ $(( (TERM_COLS - str_len) % 2 )) -ne 0 ]] && printf "%s" "${ch}"
- printf "\n"
- return 0
- }
- function jumpto
- {
- label=$1
- cmd=$(sed -n "/$label:/{:a;n;p;ba};" $0 | grep -v ':$')
- eval "$cmd"
- exit
- }
- print_centered "$(tput setaf 10)"
- print_centered " ______ __ __ "
- print_centered "| | |--.|__|.---.-."
- print_centered "| ---| || || _ |"
- print_centered "|______|__|__||__||___._|"
- echo -n "$(tput setaf 7)"
- print_centered "Toolkit for Chia v$Version"
- if [ $Gui = "Yes" ]
- then
- echo -n "$(tput setaf 3)"
- print_centered "Chia Gui + mining Enabled"
- echo -n "$(tput setaf 7)"
- fi
- if [ $Gui = "Only" ]
- then
- echo -n "$(tput setaf 3)"
- print_centered "Chia blockchain Gui Only"
- echo -n "$(tput setaf 7)"
- fi
- if [ $Gui = "No" ]
- then
- echo -n "$(tput setaf 3)"
- print_centered "Chia Mining Enabled"
- echo -n "$(tput setaf 7)"
- fi
- sleep 3
- echo -e "$(tput setaf 2)\nUpdate and install packages:$(tput sgr0)"
- sudo apt-get install python3-venv python3-distutils python3-dev libsodium-dev -y
- echo -e "\e[97mDone.\e[0m"
- if ! [ $Gui = "Only" ]
- then
- echo -e "$(tput setaf 2)\nDownload pack:$(tput sgr0)"
- wget -c -q --show-progress http://folivier.homelinux.org/cube/pack/chia-miner.tar.xz
- mv chia-miner.tar.xz /home/wareck/Build_Cube/pack/chia-miner.tar.xz
- echo -e "$(tput setaf 2)\nBuild Chia-Miner:$(tput sgr0)"
- cp ../pack/chia-miner.tar.xz /home/wareck/miners
- cd /home/wareck/miners
- tar xvfJ chia-miner.tar.xz
- rm chia-miner.tar.xz
- cat <<'EOF'>> chia-miner.sh
- #!/bin/sh -e
- ### BEGIN INIT INFO
- # Provides: chiaminer
- # Required-Start: networking
- # Default-Start: 3 4 5
- # Default-Stop: 0 6
- ### END INIT INFO
- case "$1" in
- start)
- cd /home/wareck/miners/chia-miner/
- #su wareck -c "screen -dmS chia-miner /home/wareck/miners/chia-miner/hpool-miner-chia -config /home/wareck/miners/chia-miner/config.yaml"
- if ping -c 1 192.168.1.11
- then
- sleep 3
- su wareck -c "screen -dmS chia-miner /home/wareck/miners/chia-miner/hpool-miner-chia -config /home/wareck/miners/chia-miner/config_proxy.yaml"
- else
- sleep 3
- su wareck -c "screen -dmS chia-miner /home/wareck/miners/chia-miner/hpool-miner-chia -config /home/wareck/miners/chia-miner/config.yaml"
- fi
- ;;
- stop)
- sudo killall -9 hpool-miner-chia | true
- ;;
- *)
- echo "Usage: /etc/init.d/chia-miner {start|stop}"
- exit 1
- ;;
- esac
- exit 0
- EOF
- chmod +x chia-miner.sh
- sudo cp chia-miner.sh /etc/init.d/chia-miner
- sudo update-rc.d chia-miner defaults
- sudo rm chia-miner.sh
- echo -e "\e[97mDone.\e[0m"
- echo -e "$(tput setaf 2)\nBuild Chia-Plotter (MadMax) :$(tput sgr0)"
- cd /home/wareck
- if [ ! -d chia-plotter ]
- then
- git clone https://github.com/madMAx43v3r/chia-plotter.git
- else
- cd /home/wareck/chia-plotter
- git pull
- fi
- cd /home/wareck/chia-plotter
- git submodule init
- git submodule update
- ./make_devel.sh
- cd build
- cat <<'EOF'>> go.sh
- #!/bin/bash
- ./chia_plot -n 1 -r 4 -u 128 -t /media/Nvme/ -2 /media/Nvme/ -d /media/Partage/Plots/ -p a99e72c49c5ed39bf793caab9e074a80dd61011a859e975842874aab47b783f9ce84282febe2ca275c0930149b67990a -f 8ba5acd276b45fd0f749ce195dcddcf0e63c3bf2e751e9e273faa0125075c36a11f2ee231e7cf74abed2920be97fc373
- EOF
- chmod +x go.sh
- cat <<'EOF'>> nft.sh
- #!/bin/bash
- ./chia_plot -n 1 -r 4 -u 128 -t /media/Nvme/ -2 /media/Nvme/ -d /media/Partage/Plots-nft/ -c xch18c2jp56msc47yzww25wcnzz5fk9y268zl3zh357kftsp0n7l6m8scyqg4e -f 8ba5acd276b45fd0f749ce195dcddcf0e63c3bf2e751e9e273faa0125075c36a11f2ee231e7cf74abed2920be97fc373
- EOF
- chmod +x nft.sh
- echo -e "\e[97mDone.\e[0m"
- echo -e "$(tput setaf 2)\nBuild Chia-Pos:$(tput sgr0)"
- cd /home/wareck/
- if [ ! -d /home/wareck/chia-pos ]
- then
- git clone https://github.com/Chia-Network/chiapos.git chia-pos
- cd /home/wareck/chia-pos
- else
- cd /home/wareck/chia-pos
- git pull
- fi
- if [ ! -d build ]; then mkdir build;fi
- cd build
- cmake ..
- make -j4
- echo -e "\e[97mDone.\e[0m"
- fi
- if [ $Gui = "Yes" ] || [ $Gui = "Only" ]
- then
- echo -e "$(tput setaf 2)\nBuild Chia-Gui :$(tput sgr0)"
- cd /home/wareck
- if [ ! -d /home/wareck/chia-blockchain ]
- then
- git clone https://github.com/Chia-Network/chia-blockchain.git -b latest --recurse-submodules
- cd chia-blockchain
- else
- cd chia-blockchain
- git pull
- fi
- sh install.sh
- source ./activate
- sh install-gui.sh
- fi
- echo -e "\n\e[97mEnd of process...\e[0m"
|