-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·170 lines (156 loc) · 4.77 KB
/
install.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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
#!/bin/bash
wget -q https://raw.githubusercontent.com/wareck/cgminer-gekko/master/configure.ac -O /tmp/configure.ac
v1="`cat /tmp/configure.ac | grep m4_define | awk 'NR==1 {print$2}' | sed 's/[^0-9]//g'`"
v2="`cat /tmp/configure.ac | grep m4_define | awk 'NR==2 {print$2}' | sed 's/[^0-9]//g'`"
v3="`cat /tmp/configure.ac | grep m4_define | awk 'NR==3 {print$2}' | sed 's/[[]//g' | awk '{ print substr( $0, 1, length($0)-2 ) }'`"
function outro {
echo -e "Donate:"
echo -e "Bitcoin : 1Pu12Wimuy6n7csyHkEjZXGXnAQzKBwSBp"
echo -e "Okcash : PH3JcR9inEeNZD6gNoLDYwaPAFpgjmrbue"
echo -e "Litecoin : M84U8YggaJ7T5E3TcqgcoF2BCTaxBMbCvN"
echo -e ""
}
echo -e "\e[97mRaspberri Pi CGminer-Gekko install v1.0 (github.com/wareck)\e[0m\n"
if ! dpkg --get-selections | grep -m1 lxde >/dev/null
then
echo -e "\e[95mThis script need a desktop like LXDE"
echo -e "It seems to not be present..."
echo -e "You need to use a full raspberry O.S with desktop..."
echo -e "aborted. \n\e[0m"
outro
exit 0
fi
echo -e "\e[92mThis script will configure and install :\e[0m"
echo "- Cgminer-gekko v$v1.$v2.$v3"
echo "- Cgminer autostart mining at boot"
echo "- Vncserver & service start at boot"
echo ""
sleep 5
echo -e "\e[95mUpdate Raspberry O.S:\e[0m"
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install git tightvncserver -y
echo -e "Done"
sleep 1
echo -e "\n\e[95mBuild cgminer-gekko v$v1.$v2.$v3\e[0m":
if [ ! -d ~/cgminer-gekko ]
then
git clone https://github.com/wareck/cgminer-gekko ~/cgminer-gekko
fi
if [ ! -f ~/cgminer-gekko/cgminer ]
then
cd ~/cgminer-gekko/
sudo apt-get install build-essential autoconf automake libtool pkg-config libcurl4-openssl-dev libudev-dev \
libjansson-dev libncurses5-dev libusb-1.0-0-dev zlib1g-dev screen -y
sudo usermod -a -G dialout,plugdev $USER
sudo cp 01-cgminer.rules /etc/udev/rules.d/
CFLAGS="-O2 -march=native" ./autogen.sh
./configure --enable-gekko
make
sudo make install
sudo ldconfig
fi
echo "Done"
sleep 1
echo -e "\n\e[95mGenerate cgminer autostart\e[0m"
if ! grep "#cgminer autostart:" /etc/rc.local >/dev/null
then
echo $USER >/tmp/user
sudo bash -c 'sed -i -e "s/exit 0//g" /etc/rc.local'
sudo bash -c 'echo "#cgminer autostart:" >>/etc/rc.local'
sudo bash -c 'form=$(cat "/tmp/user") && echo -e "su - $form -c \x27screen -dmS miner cgminer\x27" >>/etc/rc.local'
sudo bash -c 'echo "exit 0" >>/etc/rc.local'
fi
echo "Done"
sleep 1
echo -e "\n\e[95mGenerate VNC autostart service:\e[0m"
if [ ! -d ~/.vnc ];then mkdir ~/.vnc;fi
if [ ! -f ~/.vnc/xstartup ]
then
cat <<'EOF'>> ~/.vnc/xstartup
#!/bin/sh
xrdb "$HOME/.Xresources"
xsetroot -solid grey
#x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#x-window-manager &
# Fix to make GNOME work
export XKL_XMODMAP_DISABLE=1
/etc/X11/Xsession
EOF
fi
if [ ! -f /etc/systemd/system/vncserver.service ]
then
cat <<'EOF'>> /tmp/vncboot
[Unit]
Description=TightVNC Server
After=network.target
[Service]
Type=forking
User=pi
ExecStart=/usr/bin/vncserver :1
ExecStop=/usr/bin/vncserver -kill :1
[Install]
WantedBy=multi-user.target
EOF
sudo cp /tmp/vncboot /etc/systemd/system/vncserver.service
sudo systemctl enable vncserver.service
fi
echo -e "Done"
sleep 1
echo -e "\n\e[95mGenrate cgminer.conf\e[0m"
if [ ! -d ~/.cgminer ]; then mkdir ~/.cgminer ;fi
cat <<'EOF'>> ~/.cgminer/cgminer.conf
{
"pools" : [
{
"url" : "stratum+tcp://eu.stratum.slushpool.com:3333",
"user" : "wareck.gekko",
"pass" : "x"
},
{
"url" : "stratum+tcp://sha256.eu.mine.zergpool.com:3333",
"user" : "14KnPuvX1xNBQ4qWmcqUZwYbsbtDx9tTXB",
"pass" : "c=BTC,mc=BCA/BCH/CHTA/DANE/DGB/DVT/FCH/LCC/PPC/PYRK/SHND/TIT/XEC/XRG"
}
]
,
"api-description" : "cgminer 4.12.0-wrk",
"api-mcast-addr" : "224.0.0.75",
"api-mcast-code" : "FTW",
"api-mcast-des" : "",
"api-mcast-port" : "4028",
"api-port" : "4028",
"api-host" : "0.0.0.0",
"gekko-terminus-freq" : "150.0",
"gekko-2pac-freq" : "150.0",
"gekko-compac-freq" : "100.0",
"gekko-compacf-freq" : "200",
"gekko-newpac-freq" : "150",
"gekko-r606-freq" : "550",
"gekko-tune-down" : "95.0",
"gekko-tune-up" : "97.0",
"gekko-wait-factor" : "0.5",
"gekko-bauddiv" : "0",
"gekko-start-freq" : "100",
"gekko-step-freq" : "2.5",
"gekko-step-delay" : "15",
"gekko-tune2" : "0",
"fallback-time" : "120",
"hotplug" : "5",
"log" : "5",
"shares" : "0",
"suggest-diff" : "0"
}
EOF
echo -e "Done"
sleep 1
echo -e "\n\e[95mConfig tightvncserver:\e[0m"
tightvncserver
sleep 5
clear
echo -e "\e[97mRaspberri Pi CGminer-Gekko install v1.0 (github.com/wareck)\e[0m\n"
echo -e "\e[97mInstall ended.\e[0m"
echo -e "\e[97mYou need to reboot Raspberry PI to enable mining and VNCserver\e[0m"
echo -e "\e[97mDon't forget to edit ./cgminer/cgminer.conf file\e[0m"
echo -e ""
outro