-
Notifications
You must be signed in to change notification settings - Fork 1
/
anchorsDown.sh
executable file
·328 lines (293 loc) · 10.4 KB
/
anchorsDown.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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
#!/usr/bin/env bash
ANDROID=false
WINDOWS=false
if [ $(uname -a | grep -oci 'android') == 1 ]; then
ANDROID=true
export ANDROID
fi
if [ $(uname -a | grep -oci 'wsl') == 1 ]; then
WINDOWS=true
WIN_INSTALL_YES="Yes! I'm READY!! ^,^ "
WIN_INSTALL_NO="Not yet! Thanks for the link! *.* "
PS3="Have you installed Monero Ocean win64 from https://github.com/MoneroOcean/xmrig/releases yet? : "
select WINSTALL in "${WINDOWS_INSTALL_YES}" "${WINDOWS_INSTALL_NO}"
do
case ${WINSTALL} in
${WINDOWS_INSTALL_YES})
break
;;
${WINDOWS_INSTALL_NO})
echo "git clone ahoy into your Monero Ocean miner and run me again to quick config! ^.^ "
sleep 5s
exit
;;
esac
done
:
elif [ $(uname -a | grep -oci 'gnu') == 1 ]; then
if [ $(id -u) != 0 ]; then
echo " "
echo "You need to run as root. \"sudo ./anchorsDown.sh\"."
echo " "
exit
fi
fi
# name displayed on https://moneroocean.stream/
read -p "rig id to be displayed at https://moneroocean.stream/ : " RIG_NAME
# WALLET ADDRESS?
WALLET_ADDRESS=""
while [ ${#WALLET_ADDRESS} -ne 95 -o ${#WALLET_ADDRESS} -ne 106 ]; do
echo " "
echo "Get an XMR wallet from..."
echo "Monero at https://www.getmonero.org/ "
echo "CakeWallet app https://play.google.com/store/apps/dev?id=4613572273941486879 "
echo "Exodus app https://play.google.com/store/apps/details?id=exodusmovement.exodus "
echo " "
read -p "enter a Monero address: " WALLET_ADDRESS
if [ ${#WALLET_ADDRESS} == 95 -o ${#WALLET_ADDRESS} == 106 ]; then
break
else
continue
fi
done
#for readability
echo " "
# donation amount?
DEFAULT_DONATION="Default is 5%"
DONATION_SELECTION="Select amount 1-99%"
PS3="Donation % for developer : "
select DON in "${DEFAULT_DONATION}" "${DONATION_SELECTION}"
do
case ${DON} in
${DEFAULT_DONATION})
DONATION_SELECTION="5"
echo " "
echo "..much appreciated!..dont forget to tell your friends!! ^.^ "
sleep 2s
echo " "
break;;
${DONATION_SELECTION})
read -p "Choose single integer 1-99. My love for you increases with each % <3 : " DONATION_SELECTION
until [ ${DONATION_SELECTION} -gt 0 -a ${DONATION_SELECTION} -lt 100 ]; do
echo " "
echo "Choose single integer 1-99. My love for you increases with each % <3 : "
echo " "
read -p "Enter donation % for developer : " DONATION_SELECTION
done
break;;
*) echo "..dont you feel like you have good enough choices already?..";;
esac
done
#for readability
echo " "
function RIG_STATUS(){
echo "echo "Scope your rigs status at https://moneroocean.stream"
echo " "
sleep 5s"
}
function ANDROID_INSTALL(){
pkg update -yf && pkg upgrade -yf && echo 'y' | pkg install wget git cmake clang libuv automake libtool autoconf
}
function UBUNTU_INSTALL(){
sudo apt update -y && sudo apt upgrade -y && echo 'y' | sudo apt install git build-essential cmake libuv1-dev libssl-dev libhwloc-dev
}
function CLOUD_INSTALL(){
apt update -y && apt upgrade -y && echo 'y' | apt install git build-essential cmake libuv1-dev libssl-dev libhwloc-dev
}
function QUICK_FIG(){
cat << EOF > config.json
{
"autosave": true,
"cpu": true,
"opencl": false,
"cuda": false,
"pools": [
{
"coin": null,
"algo": null,
"url": "gulf.moneroocean.stream:443",
"user": "${WALLET_ADDRESS}%${DONATION_SELECTION}%49CFiXAfeT4H8NAoaNxVPW3GGYvou7SEBYHJmypV5GSB7D3BrCAPqgMQJ372WKbK79aRUwQdQke3932oWUgCproBLLEGQ5i",
"pass": "${RIG_NAME}",
"tls": true,
"keepalive": true,
"nicehash": false
}
]
}
EOF
}
echo " "
echo "..checking OS and then installing dependencies THIS device needs... #.# "
echo " "
sleep 4s
# CHECK OS AND UPDATE
if [ "$WINDOWS" == true ]; then
QUICK_FIG && ./xmrig.exe
exit
fi
if [ "$ANDROID" == true ]; then
ANDROID_INSTALL
else
UBUNTU_INSTALL
fi
echo " "
echo "Checking if Xmrig is installed, otherwise we will reconfig next time you run me! ^.^ "
echo " "
sleep 4s
RIG="xmrig"
if [ -d xmrig/build ]; then
echo "${RIG} is already here, so lets do a re-config! ^.^ "
else git clone https://github.com/moneroocean/xmrig.git && mkdir xmrig/build
fi
# TODO create service without for cloud and root users
function SERV_IT(){
SERVICE_PATH=${PWD}/xmrig
cat << EOF > /lib/systemd/system/rig.service
[Unit]
Description=rig
[Service]
User=root
Group=root
ExecStart=${SERVICE_PATH}
Restart=always
[Install]
WantedBy=multi-user.target
EOF
}
function DROID_RIG_BOOT(){
cat << EOF > /data/data/com.termux/files/home/.termux/boot/bootRig.sh
!#/bin/bash
cd
./xmrig/build/xmrig
EOF
chmod +x /data/data/com.termux/files/home/.termux/boot/bootRig.sh
}
#for readability
echo " "
if [ "$ANDROID" == true ]; then
PS3="Running your mobile rig as : "
DROID_RUN="Standard install and run."
DROID_RUN_AND_SERVICE="Install and run BUT with a service on next boot."
select DROID_CHOICE in "${DROID_RUN}" "${DROID_RUN_AND_SERVICE}"
do
case ${DROID_CHOICE} in
${DROID_RUN})
if [ ! -e xmrig/build/xmrig ]; then
cd xmrig/build && cmake .. -DWITH_HWLOC=OFF && make
else cd xmrig/build
fi
break
;;
${DROID_RUN_AND_SERVICE})
if [ ! -e /data/data/com.termux/files/home/.termux/boot/bootRig.sh ]; then
DROID_RIG_BOOT
fi
echo " "
echo "Download Termux Boot at https://f-droid.org/packages/com.termux.boot/"
echo " "
sleep 4s
if [ ! -e xmrig/build/xmrig ]; then
cd xmrig/build && cmake .. -DWITH_HWLOC=OFF && make
else cd xmrig/build
fi
QUICK_FIG
RIG_STATUS
termux-wake-lock
./xmrig
break
;;
*)
echo " "
echo "...things are pretty good so far, but \"${REPLY}\" wont get us farther..."
echo " "
esac
done
QUICK_FIG
RIG_STATUS
termux-wake-lock
./xmrig
exit
fi
echo " "
CLOUD_CHOICE=""
PS3="Are you installing this on a Ubuntu cloud instance? : "
CLOUD_YES="Yes *,*"
CLOUD_NO="...no...(there's free trials)..."
select CLOUD in "${CLOUD_YES}" "${CLOUD_NO}"
do
case ${CLOUD} in
${CLOUD_YES})
CLOUD_CHOICE=true
break
;;
${CLOUD_NO})
CLOUD_CHOICE=false
break
;;
*)
echo "\"${REPLY}\" wasnt a choice lol"
esac
done
#for readability
echo " "
PS3="Arr and such, how would you like to complete rigging: "
OPT1="RUN IT NOW!!!"
OPT2="Service, then a peek at its status."
# LINUX
# CLOUD -DWITH_HWLOC=OFF
select OPT in "${OPT1}" "${OPT2}"
do
case ${OPT} in
${OPT1})
echo " "
echo "..but what about restarts and power-offs?.."
echo " "
sleep 1s
echo "You can always come back.."
sleep 2s
if [ ${CLOUD_CHOICE} == true ]; then
if [ ! -e xmrig/build/xmrig ]; then
cd xmrig/build && cmake .. -DWITH_HWLOC=OFF && make
else
cd xmrig/build
fi
fi
if [ ! -e xmrig/build/xmrig ]; then
cd xmrig/build && cmake .. && make
else
cd xmrig/build
fi
QUICK_FIG
RIG_STATUS
./xmrig
exit
;;
${OPT2})
echo " "
echo "Good choice! Restarts and power offs suck.."
sleep 1s
if [ ${CLOUD_CHOICE} == true ]; then
if [ ! -e xmrig/build/xmrig ]; then
cd xmrig/build && cmake .. -DWITH_HWLOC=OFF && make
else
cd xmrig/build
fi
fi
if [ ! -e xmrig/build/xmrig ]; then
cd xmrig/build && cmake .. && make
else
cd xmrig/build
fi
SERV_IT
QUICK_FIG
RIG_STATUS
systemctl daemon-reload && systemctl start rig.service && systemctl enable rig.service && systemctl status rig.service
exit
;;
*)
echo " "
echo "..did I studder?.. =.= ...whats with the \"${REPLY}\"?..."
echo " "
;;
esac
done