-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathinstall1.sh
executable file
·124 lines (109 loc) · 3.14 KB
/
install1.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#!/bin/bash
# created by Nikolai
# Ubuntu server 20.04.2 LTS
# DEFINING ALL THE VARIABLES
#define colors for colored text
red=`tput setaf 1`
green=`tput setaf 2`
reset=`tput sgr0`
#define the installation variable, and set it to one
var=1
# define variables for the manufacturer and model of the GPU(s), and hide the command line output
{
vendor=$(lshw -class display | grep 'vendor' | uniq)
model=$(lshw -class display | grep 'product')
} &> /dev/null
# DEFINING THE INSTALLATION FUNCTIONS
# define the confirm install function
confirm_install() {
local REPLY
while true; do
read -r -n 1 -p "${1:-Continue?} [y/n]: " REPLY
case $REPLY in
[yY])
echo
((var*=2))
return 0 ;;
[nN])
echo
((var-=1))
return 1 ;;
*)
echo " ${red}invalid input${reset}"
esac
done
}
# define Nvidia installation
nvidia_install() {
# add the nvidia drivers ppa
add-apt-repository ppa:graphics-drivers/ppa -y
apt upgrade -y
# install all the necessary libraries, will ask config during install
apt install nvidia-driver-460 nvidia-cuda-toolkit -y
}
# Phoenix Miner installation
phoenixminer_install() {
# Download latest Phoenix Miner (5.5c at the time of editing this) - https://phoenixminer.org/download/latest/
wget https://github.com/PhoenixMinerDevTeam/PhoenixMiner/releases/download/5.5c/PhoenixMiner_5.5c_Linux.tar.gz
# Extract the file, delete the installer tar.gz file, and rename it
tar -zxvf PhoenixMiner_*
rm *tar.gz
mv PhoenixMiner_* PhoenixMiner
# Make Phoenix Miner itself executable
cd PhoenixMiner && chmod +x PhoenixMiner && cd ..
}
# ETHlargementPill installation for GTX 1080, 1080TI and Titan XP
pill_install() {
# Download
wget https://github.com/admin-ipfs/OhGodAnETHlargementPill/raw/master/OhGodAnETHlargementPill-r2
# Make the file executable, and rename it
chmod +x OhGodAnETHlargementPill-r2
mv OhGodAnETHlargementPill-r2 ETHPill
}
# THE CONDITIONAL INSTALLATON CODE
clear
if [[ $vendor =~ "NVIDIA" ]]; then
echo -e "${green}NVIDIA GPUs detected${reset}" "\U2714"
elif [[ $vendor =~ "AMD" ]]; then
echo "${red}AMD GPUs are not yet supported${reset}"
echo "exiting in 5 seconds"
sleep 5
exit 0
else
echo "${red}No GPUs detected${reset}"
echo "exiting in 5 seconds"
sleep 5
exit 0
fi
echo "$model"
# setup questions
confirm_install "Is this the correct hardware?" || exit 0
clear
printf "\U1F48A" && confirm_install "The pill? (GTX 1080, 1080Ti & Titan XP)"
clear
# update and upgrade packages to the latest version
apt update && apt upgrade -y
# just such a useful tool, should be installed regardless of option
apt install screen -y
# allow ssh through firewall, and enable firewall for security purposes
ufw allow ssh
yes | ufw enable
# installation
if [[ $vendor =~ "NVIDIA" ]]; then
nvidia_install
phoenixminer_install
if [[ $var = 4 ]]; then
pill_install
fi
else
exit 0
fi
# REBOOT SYSTEM AND GET READY TO MINE
# make the next install script executable, while removing permissions for the current one
chmod 0 install1.sh
chmod +x install2.sh
clear
# display a message, then reboot
echo "${red}Rebooting ...${reset}"
sleep 2
reboot