-
Notifications
You must be signed in to change notification settings - Fork 41
/
ubuntu-install-continue.sh
462 lines (414 loc) · 21.6 KB
/
ubuntu-install-continue.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
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
#!/bin/bash
##Open Sources:
# Monero github https://github.com/moneroexamples/monero-compilation/blob/master/README.md
# Monero Blockchain Explorer https://github.com/moneroexamples/onion-monero-blockchain-explorer
# PiNode-XMR scripts and custom files at my repo https://github.com/shermand100/PiNodeXMR
# PiVPN - OpenVPN server setup https://github.com/pivpn/pivpn
# Atomic Swaps - https://github.com/AthanorLabs/atomic-swap
# P2Pool - https://github.com/SChernykh/p2pool
# ATS Fan controller - https://github.com/tuxd3v/ats#credits
###Begin2
#Create debug file for handling install errors:
touch /home/pinodexmr/debug.log
echo "
####################
" 2>&1 | tee -a /home/pinodexmr/debug.log
echo "Start ubuntu-install-continue.sh script $(date)" 2>&1 | tee -a /home/pinodexmr/debug.log
echo "
####################
" 2>&1 | tee -a /home/pinodexmr/debug.log
#Establish OS 32 or 64 bit
CPU_ARCH=`getconf LONG_BIT`
echo "OS getconf LONG_BIT $CPU_ARCH" >> /home/pinodexmr/debug.log
if [[ $CPU_ARCH -eq 64 ]]
then
echo "ARCH: 64-bit"
elif [[ $CPU_ARCH -eq 32 ]]
then
echo "ARCH: 32-bit"
else
echo "OS Unknown"
fi
sleep 3
whiptail --title "PiNode-XMR Continue Ubuntu LTS Installer" --msgbox "Your PiNode-XMR is taking shape...\n\nThis next part will take ~80 minutes installing Monero and PiNodeXMR \n\nSelect ok to continue setup" 16 60
###Continue as 'pinodexmr'
##Configure temporary Swap file if needed (swap created is not persistant and only for compiling monero. It will unmount on reboot)
if (whiptail --title "PiNode-XMR Ubuntu Installer" --yesno "For Monero to compile successfully 2GB of RAM is required.\n\nIf your device does not have 2GB RAM it can be artificially created with a swap file\n\nDo you have 2GB RAM on this device?\n\n* YES\n* NO - I do not have 2GB RAM (create a swap file)" 18 60); then
echo -e "\e[32mSwap file unchanged\e[0m"
sleep 3
else
sudo fallocate -l 2G /swapfile 2>&1 | tee -a /home/pinodexmr/debug.log
sudo chmod 600 /swapfile 2>&1 | tee -a /home/pinodexmr/debug.log
sudo mkswap /swapfile 2>&1 | tee -a /home/pinodexmr/debug.log
sudo swapon /swapfile 2>&1 | tee -a /home/pinodexmr/debug.log
echo -e "\e[32mSwap file of 2GB Configured and enabled\e[0m"
free -h
sleep 3
fi
##Hardware configure: Many features and builds only work with 64bit OS/Hardware, but we dont want to exclude older 32bit devices. Configure vaiable $LIGHTMODE for core node functions.
if [[ $CPU_ARCH -eq 64 ]]
then
if (whiptail --title "PiNode-XMR Ubuntu Installer" --yesno "This installer has detected you are running a 64bit OS. This means you can run PiNodeXMR with all features. If however you would prefer to run PiNodeXMR in 'light mode' with only core node functions you may select that option here" --no-button "PiNodeXMR Light" --yes-button "PiNodeXMR Full" 18 60); then
LIGHTMODE=FALSE
else
LIGHTMODE=TRUE
fi
elif [[ $CPU_ARCH -eq 32 ]]
then
if (whiptail --title "PiNode-XMR Ubuntu Installer" --yesno "This installer has detected you are running a 32bit OS. This means you can run PiNodeXMR in 'light mode' with only core node functions. If you believe this is incorrect you can select the Full installer below but it is not recommended. Note: P2Pool is not available for 32bit devices" --no-button "PiNodeXMR Full" --yes-button "PiNodeXMR Light" 18 60); then
LIGHTMODE=TRUE
else
LIGHTMODE=FALSE
fi
else
if (whiptail --title "PiNode-XMR Ubuntu Installer" --yesno "This installer cannot detect if you are using 32/64bit Hardware/OS. You may select below to either use PiNodeXMR Full with all features for 64bit devices or PiNodeXMR Light with only core node functions" --no-button "PiNodeXMR Light" --yes-button "PiNodeXMR Full" 18 60); then
LIGHTMODE=FALSE
else
LIGHTMODE=TRUE
fi
fi
sleep 3
###Continue as 'pinodexmr'
cd
echo -e "\e[32mLock old user 'pi'\e[0m"
sleep 2
sudo passwd --lock pi
echo -e "\e[32mUser 'pi' Locked\e[0m"
sleep 3
echo -e "\e[32mLock old user 'ubuntu'\e[0m"
sleep 2
sudo passwd --lock ubuntu
echo -e "\e[32mUser 'ubuntu' Locked\e[0m"
sleep 3
##Update and Upgrade system (This step repeated due to importance and maybe someone using this installer sript out-of-sequence)
echo -e "\e[32mReceiving and applying Ubuntu updates to latest versions\e[0m"
sleep 3
sudo apt-get update 2>&1 | tee -a /home/pinodexmr/debug.log
sudo apt-get --yes -o Dpkg::Options::="--force-confnew" upgrade 2>&1 | tee -a /home/pinodexmr/debug.log
sudo apt-get --yes -o Dpkg::Options::="--force-confnew" dist-upgrade 2>&1 | tee -a /home/pinodexmr/debug.log
sudo apt-get upgrade -y 2>&1 | tee -a /home/pinodexmr/debug.log
##Installing dependencies for --- Web Interface
echo "Installing dependencies for --- Web Interface" 2>&1 | tee -a /home/pinodexmr/debug.log
echo -e "\e[32mInstalling dependencies for --- Web Interface\e[0m"
sleep 3
sudo apt-get install apache2 shellinabox php php-common avahi-daemon -y 2>&1 | tee -a /home/pinodexmr/debug.log
sudo usermod -a -G pinodexmr www-data
sleep 3
if [[ $LIGHTMODE = FALSE ]]
then
echo "ARCH: 64-bit"
##Installing dependencies for --- Monero
echo "Installing dependencies for --- Monero" 2>&1 | tee -a /home/pinodexmr/debug.log
echo -e "\e[32mInstalling dependencies for --- Monero\e[0m"
sleep 3
sudo apt-get update
sudo apt-get install build-essential cmake pkg-config libssl-dev libzmq3-dev libunbound-dev libsodium-dev libunwind8-dev liblzma-dev libreadline6-dev libldns-dev libexpat1-dev libpgm-dev qttools5-dev-tools libhidapi-dev libusb-1.0-0-dev libprotobuf-dev protobuf-compiler libudev-dev libboost-chrono-dev libboost-date-time-dev libboost-filesystem-dev libboost-locale-dev libboost-program-options-dev libboost-regex-dev libboost-all-dev libboost-serialization-dev libboost-system-dev libboost-thread-dev ccache doxygen graphviz -y 2>&1 | tee -a /home/pinodexmr/debug.log
sleep 2
echo "manual build of gtest for --- Monero" 2>&1 | tee -a /home/pinodexmr/debug.log
sudo apt-get install libgtest-dev -y 2>&1 | tee -a /home/pinodexmr/debug.log
cd /usr/src/gtest
sudo cmake . 2>&1 | tee -a /home/pinodexmr/debug.log
sudo make
sudo mv lib/libg* /usr/lib/
cd
##Installing dependencies for --- P2Pool
echo "Installing dependencies for --- P2Pool" 2>&1 | tee -a /home/pinodexmr/debug.log
sudo apt-get install git build-essential cmake libuv1-dev libzmq3-dev libsodium-dev libpgm-dev libnorm-dev libgss-dev -y
sleep 2
fi
##Checking all dependencies are installed for --- miscellaneous (security tools-fail2ban-ufw, menu tool-dialog, screen, mariadb)
echo "Installing dependencies for --- miscellaneous" 2>&1 | tee -a /home/pinodexmr/debug.log
echo -e "\e[32mChecking all dependencies are installed for --- Miscellaneous\e[0m"
sleep 3
sudo apt-get install git mariadb-client mariadb-server screen fail2ban ufw dialog jq libcurl4-openssl-dev libpthread-stubs0-dev cron -y 2>&1 | tee -a /home/pinodexmr/debug.log
sudo apt-get install exfat-fuse exfat-utils -y 2>&1 | tee -a /home/pinodexmr/debug.log
#libcurl4-openssl-dev & libpthread-stubs0-dev for block-explorer
sleep 3
##Clone PiNode-XMR to device from git
echo "Clone PiNode-XMR to device from git" 2>&1 | tee -a /home/pinodexmr/debug.log
echo -e "\e[32mDownloading PiNode-XMR files\e[0m"
sleep 3
git clone --single-branch https://github.com/shermand100/PiNodeXMR.git 2>&1 | tee -a /home/pinodexmr/debug.log
##Configure ssh security. Allows only user 'pinodexmr'. Also 'root' login disabled via ssh, restarts config to make changes
echo "Configure ssh security" 2>&1 | tee -a /home/pinodexmr/debug.log
echo -e "\e[32mConfiguring SSH security\e[0m"
sleep 3
sudo mv /home/pinodexmr/PiNodeXMR/etc/ssh/sshd_config /etc/ssh/sshd_config 2>&1 | tee -a /home/pinodexmr/debug.log
sudo chmod 644 /etc/ssh/sshd_config 2>&1 | tee -a /home/pinodexmr/debug.log
sudo chown root /etc/ssh/sshd_config 2>&1 | tee -a /home/pinodexmr/debug.log
sudo /etc/init.d/ssh restart 2>&1 | tee -a /home/pinodexmr/debug.log
echo -e "\e[32mSSH security config complete\e[0m"
sleep 3
##Copy PiNode-XMR scripts to home folder
echo -e "\e[32mMoving PiNode-XMR scripts into position\e[0m"
sleep 3
mv /home/pinodexmr/PiNodeXMR/home/pinodexmr/* /home/pinodexmr/ 2>&1 | tee -a /home/pinodexmr/debug.log
mv /home/pinodexmr/PiNodeXMR/home/pinodexmr/.profile /home/pinodexmr/ 2>&1 | tee -a /home/pinodexmr/debug.log
sudo chmod 777 -R /home/pinodexmr/* 2>&1 | tee -a /home/pinodexmr/debug.log #Read/write access needed by www-data to action php port, address customisation
echo -e "\e[32mSuccess\e[0m"
sleep 3
##Add PiNode-XMR systemd services
echo "Add PiNode-XMR systemd services" 2>&1 | tee -a /home/pinodexmr/debug.log
echo -e "\e[32mAdd PiNode-XMR systemd services\e[0m"
sleep 3
sudo mv /home/pinodexmr/PiNodeXMR/etc/systemd/system/*.service /etc/systemd/system/ 2>&1 | tee -a /home/pinodexmr/debug.log
sudo chmod 644 /etc/systemd/system/*.service 2>&1 | tee -a /home/pinodexmr/debug.log
sudo chown root /etc/systemd/system/*.service 2>&1 | tee -a /home/pinodexmr/debug.log
sudo systemctl daemon-reload 2>&1 | tee -a /home/pinodexmr/debug.log
sudo systemctl start moneroStatus.service 2>&1 | tee -a /home/pinodexmr/debug.log
sudo systemctl enable moneroStatus.service 2>&1 | tee -a /home/pinodexmr/debug.log
echo -e "\e[32mSuccess\e[0m"
sleep 3
#Configure apache server for access to monero log file
sudo mv /home/pinodexmr/PiNodeXMR/etc/apache2/sites-enabled/000-default.conf /etc/apache2/sites-enabled/000-default.conf 2>&1 | tee -a /home/pinodexmr/debug.log
sudo chmod 777 /etc/apache2/sites-enabled/000-default.conf 2>&1 | tee -a /home/pinodexmr/debug.log
sudo chown root /etc/apache2/sites-enabled/000-default.conf 2>&1 | tee -a /home/pinodexmr/debug.log
sudo /etc/init.d/apache2 restart 2>&1 | tee -a /home/pinodexmr/debug.log
echo -e "\e[32mSuccess\e[0m"
sleep 3
##Setup local hostname
echo "Setup local hostname" 2>&1 | tee -a /home/pinodexmr/debug.log
sudo mv /home/pinodexmr/PiNodeXMR/etc/avahi/avahi-daemon.conf /etc/avahi/avahi-daemon.conf 2>&1 | tee -a /home/pinodexmr/debug.log
sudo /etc/init.d/avahi-daemon restart 2>&1 | tee -a /home/pinodexmr/debug.log
##Configure Web-UI
echo "Configure Web-UI" 2>&1 | tee -a /home/pinodexmr/debug.log
sleep 3
if [[ $LIGHTMODE = TRUE ]]
then
#First move hidden file specifically .htaccess file then entire directory
sudo mv /home/pinodexmr/PiNodeXMR/HTML/.htaccess /var/www/html/ 2>&1 | tee -a /home/pinodexmr/debug.log
sudo rsync -a /home/pinodexmr/PiNodeXMR/HTML/* /var/www/html/ 2>&1 | tee -a /home/pinodexmr/debug.log
sudo rsync -a /home/pinodexmr/PiNodeXMR/HTML-LIGHT/*.html /var/www/html/ 2>&1 | tee -a /home/pinodexmr/debug.log
sudo chown www-data -R /var/www/html/ 2>&1 | tee -a /home/pinodexmr/debug.log
sudo chmod 777 -R /var/www/html/ 2>&1 | tee -a /home/pinodexmr/debug.log
else
#First move hidden file specifically .htaccess file then entire directory
sudo mv /home/pinodexmr/PiNodeXMR/HTML/.htaccess /var/www/html/ 2>&1 | tee -a /home/pinodexmr/debug.log
sudo rsync -a /home/pinodexmr/PiNodeXMR/HTML/* /var/www/html/ 2>&1 | tee -a /home/pinodexmr/debug.log
sudo chown www-data -R /var/www/html/ 2>&1 | tee -a /home/pinodexmr/debug.log
sudo chmod 777 -R /var/www/html/ 2>&1 | tee -a /home/pinodexmr/debug.log
fi
echo -e "\e[32mSuccess\e[0m"
if [[ $LIGHTMODE = FALSE ]]
then
# ********************************************
# ******START OF MONERO SOURCE BULD******
# ********************************************
##Build Monero and Onion Blockchain Explorer (the simple but time comsuming bit)
#Download latest Monero release number
#ubuntu /dev/null odd requiremnt to set permissions
sudo chmod 666 /dev/null
sleep 3
wget -q https://raw.githubusercontent.com/shermand100/PiNodeXMR/master/release.sh -O /home/pinodexmr/release.sh
chmod 755 /home/pinodexmr/release.sh
. /home/pinodexmr/release.sh
echo -e "\e[32mDownloading Monero \e[0m"
sleep 3
git clone --recursive https://github.com/monero-project/monero
echo -e "\e[32mBuilding Monero \e[0m"
echo -e "\e[32m****************************************************\e[0m"
echo -e "\e[32m****************************************************\e[0m"
echo -e "\e[32m***This will take a while - Hardware Dependent***\e[0m"
echo -e "\e[32m****************************************************\e[0m"
echo -e "\e[32m****************************************************\e[0m"
sleep 10
cd monero && git submodule init && git submodule update
git checkout $RELEASE
git submodule sync && git submodule update
USE_SINGLE_BUILDDIR=1 make 2>&1 | tee -a /home/pinodexmr/debug.log
cd
#Make dir .bitmonero to hold lmdb. Needs to be added before drive mounted to give mount point. Waiting for monerod to start fails mount.
mkdir .bitmonero 2>&1 | tee -a /home/pinodexmr/debug.log
echo -e "\e[32mBuilding Monero Blockchain Explorer[0m"
echo -e "\e[32m*******************************************************\e[0m"
echo -e "\e[32m***This will take a few minutes - Hardware Dependent***\e[0m"
echo -e "\e[32m*******************************************************\e[0m"
sleep 10
echo "Build Monero Onion Block Explorer" 2>&1 | tee -a /home/pinodexmr/debug.log
git clone https://github.com/moneroexamples/onion-monero-blockchain-explorer.git 2>&1 | tee -a /home/pinodexmr/debug.log
cd onion-monero-blockchain-explorer
mkdir build
cd build
cmake .. 2>&1 | tee -a /home/pinodexmr/debug.log
make 2>&1 | tee -a /home/pinodexmr/debug.log
cd
rm ~/release.sh
# ********************************************
# ********END OF MONERO SOURCE BULD **********
# ********************************************
fi
if [[ $LIGHTMODE = TRUE ]]
then
# #********************************************
# #**********START OF Monero BINARY USE********
# #********************************************
#Define Install Monero function to reduce repeat script
function f_installMonero {
echo "Downloading pre-built Monero from get.monero" 2>&1 | tee -a /home/pinodexmr/debug.log
#Make standard location for Monero
mkdir -p ~/monero/build/release/bin
if [[ $CPU_ARCH -eq 64 ]]
then
#Download 64-bit Monero
wget https://downloads.getmonero.org/cli/linuxarm8
#Make temp folder to extract binaries
mkdir temp && tar -xvf linuxarm8 -C ~/temp
#Move Monerod files to standard location
mv /home/pinodexmr/temp/monero-aarch64-linux-gnu-v0.18*/monero* /home/pinodexmr/monero/build/release/bin/
rm linuxarm8
rm -R /home/pinodexmr/temp/
else
#Download 32-bit Monero
wget https://downloads.getmonero.org/cli/linuxarm7
#Make temp folder to extract binaries
mkdir temp && tar -xvf linuxarm7 -C ~/temp
#Move Monerod files to standard location
mv /home/pinodexmr/temp/monero-arm-linux-gnueabihf-v0.18*/monero* /home/pinodexmr/monero/build/release/bin/
rm linuxarm7
rm -R /home/pinodexmr/temp/
fi
#Make dir .bitmonero to hold lmdb. Needs to be added before drive mounted to give mount point. Waiting for monerod to start fails mount.
mkdir .bitmonero 2>&1 | tee -a /home/pinodexmr/debug.log
#Clean-up used downloaded files
rm -R ~/temp
}
if [[ $CPU_ARCH -ne 64 ]] && [[ $CPU_ARCH -ne 32 ]]
then
if (whiptail --title "OS version" --yesno "I've tried to auto-detect what version of Monero you need based on your OS but I've not been successful.\n\nPlease select your OS architecture..." 8 78 --no-button "32-bit" --yes-button "64-bit"); then
CPU_ARCH=64
f_installMonero
else
CPU_ARCH=32
f_installMonero
fi
else
f_installMonero
fi
# #********************************************
# #*******END OF Monero BINARY USE*******
# #********************************************
fi
if [ $LIGHTMODE = FALSE ]
then
##Install P2Pool (Not available on 32 bit systems)
if [ $CPU_ARCH -eq 32 ]
then
echo -e "\e[33m*********************************************\e[0m" 2>&1 | tee -a /home/pinodexmr/debug.log
echo -e "\e[33m*********** ARCH: 32-bit detected ***********\e[0m" 2>&1 | tee -a /home/pinodexmr/debug.log
echo -e "\e[33m********** P2Pool Cannot be built ***********\e[0m" 2>&1 | tee -a /home/pinodexmr/debug.log
echo -e "\e[33m*********** ARCH: 64-bit required ***********\e[0m" 2>&1 | tee -a /home/pinodexmr/debug.log
echo -e "\e[33m*********** SKIPPING P2Pool build ***********\e[0m" 2>&1 | tee -a /home/pinodexmr/debug.log
echo -e "\e[33m*********************************************\e[0m" 2>&1 | tee -a /home/pinodexmr/debug.log
echo "Install resuming in 20 seconds" 2>&1 | tee -a /home/pinodexmr/debug.log
sleep "10"
echo "Install resuming in 10 seconds" 2>&1 | tee -a /home/pinodexmr/debug.log
sleep "5"
echo "Install resuming in 5 seconds" 2>&1 | tee -a /home/pinodexmr/debug.log
sleep "5"
else
echo -e "\e[32mInstalling P2Pool\e[0m" 2>&1 | tee -a /home/pinodexmr/debug.log
git clone --recursive https://github.com/SChernykh/p2pool 2>&1 | tee -a /home/pinodexmr/debug.log
cd p2pool
git checkout tags/v3.10
mkdir build && cd build
cmake .. 2>&1 | tee -a /home/pinodexmr/debug.log
make -j2 2>&1 | tee -a /home/pinodexmr/debug.log
echo -e "\e[32mSuccess\e[0m" 2>&1 | tee -a /home/pinodexmr/debug.log
sleep 3
#Manage P2pool log file ia log rotate
sudo mv /home/pinodexmr/PiNodeXMR/etc/logrotate.d/p2pool /etc/logrotate.d/p2pool 2>&1 | tee -a /home/pinodexmr/debug.log
sudo chmod 644 /etc/logrotate.d/p2pool 2>&1 | tee -a /home/pinodexmr/debug.log
sudo chown root /etc/logrotate.d/p2pool 2>&1 | tee -a /home/pinodexmr/debug.log
fi
fi
if [ $LIGHTMODE = FALSE ]
then
##Install Atomic Swap (Not available on 32 bit systems)
if [ $CPU_ARCH -eq 32 ]
then
echo -e "\e[33m*********************************************\e[0m" 2>&1 | tee -a /home/pinodexmr/debug.log
echo -e "\e[33m*********** ARCH: 32-bit detected ***********\e[0m" 2>&1 | tee -a /home/pinodexmr/debug.log
echo -e "\e[33m******* Atomic Swap Cannot be built *********\e[0m" 2>&1 | tee -a /home/pinodexmr/debug.log
echo -e "\e[33m*********** ARCH: 64-bit required ***********\e[0m" 2>&1 | tee -a /home/pinodexmr/debug.log
echo -e "\e[33m******** SKIPPING Atomic Swap build *********\e[0m" 2>&1 | tee -a /home/pinodexmr/debug.log
echo -e "\e[33m*********************************************\e[0m" 2>&1 | tee -a /home/pinodexmr/debug.log
echo "Install resuming in 20 seconds" 2>&1 | tee -a /home/pinodexmr/debug.log
sleep "10"
echo "Install resuming in 10 seconds" 2>&1 | tee -a /home/pinodexmr/debug.log
sleep "5"
echo "Install resuming in 5 seconds" 2>&1 | tee -a /home/pinodexmr/debug.log
sleep "5"
else
echo -e "\e[32mInstalling Atomic Swap\e[0m" 2>&1 | tee -a /home/pinodexmr/debug.log
#Install Go 1.20 for compatability
sudo apt install snapd -y
sudo snap install --classic --channel=1.20/stable go
#clone Atomic Swap
git clone https://github.com/athanorlabs/atomic-swap.git 2>&1 | tee -a /home/pinodexmr/debug.log
cd atomic-swap
#make Atomic Swap
make build-release 2>&1 | tee -a /home/pinodexmr/debug.log
cd
mkdir .atomicswap
sudo chmod 777 -R /home/pinodexmr/.atomicswap/
echo -e "\e[32mSuccess\e[0m" 2>&1 | tee -a /home/pinodexmr/debug.log
sleep 3
fi
fi
##Install log.io (Real-time service monitoring)
#Establish Device IP
. ~/variables/deviceIp.sh
echo -e "\e[32mInstalling log.io\e[0m" 2>&1 | tee -a /home/pinodexmr/debug.log
sudo apt-get install nodejs npm -y 2>&1 | tee -a /home/pinodexmr/debug.log
sudo npm install -g log.io 2>&1 | tee -a /home/pinodexmr/debug.log
sudo npm install -g log.io-file-input 2>&1 | tee -a /home/pinodexmr/debug.log
mkdir -p ~/.log.io/inputs/ 2>&1 | tee -a /home/pinodexmr/debug.log
mv /home/pinodexmr/PiNodeXMR/.log.io/inputs/file.json ~/.log.io/inputs/file.json 2>&1 | tee -a /home/pinodexmr/debug.log
mv /home/pinodexmr/PiNodeXMR/.log.io/server.json ~/.log.io/server.json 2>&1 | tee -a /home/pinodexmr/debug.log
sed -i "s/127.0.0.1/$DEVICE_IP/g" ~/.log.io/server.json 2>&1 | tee -a /home/pinodexmr/debug.log
sed -i "s/127.0.0.1/$DEVICE_IP/g" ~/.log.io/inputs/file.json 2>&1 | tee -a /home/pinodexmr/debug.log
sudo systemctl start log-io-server.service 2>&1 | tee -a /home/pinodexmr/debug.log
sudo systemctl start log-io-file.service 2>&1 | tee -a /home/pinodexmr/debug.log
sudo systemctl enable log-io-server.service 2>&1 | tee -a /home/pinodexmr/debug.log
sudo systemctl enable log-io-file.service 2>&1 | tee -a /home/pinodexmr/debug.log
##Install crontab
echo "Install crontab" 2>&1 | tee -a /home/pinodexmr/debug.log
echo -e "\e[32mSetup crontab\e[0m"
sleep 3
crontab /home/pinodexmr/PiNodeXMR/var/spool/cron/crontabs/pinodexmr 2>&1 | tee -a /home/pinodexmr/debug.log
echo -e "\e[32mSuccess\e[0m"
sleep 3
##Set Swappiness lower
echo "Set RAM Swappiness lower" 2>&1 | tee -a /home/pinodexmr/debug.log
sudo sysctl vm.swappiness=10 2>&1 | tee -a /home/pinodexmr/debug.log
## Remove left over files from git clone actions
echo "Remove left over files from git clone actions" 2>&1 | tee -a /home/pinodexmr/debug.log
echo -e "\e[32mCleanup leftover directories\e[0m"
sleep 3
sudo rm -r /home/pinodexmr/PiNodeXMR/ 2>&1 | tee -a /home/pinodexmr/debug.log
##Change log in menu to 'main'
wget -O ~/.profile https://raw.githubusercontent.com/shermand100/PiNodeXMR/master/home/pinodexmr/.profile 2>&1 | tee -a /home/pinodexmr/debug.log
#Write value of LIGHTMODE variable
echo "#!/bin/sh
LIGHTMODE=${LIGHTMODE}" > /home/pinodexmr/variables/light-mode.sh
##End debug log
echo "
####################
" 2>&1 | tee -a /home/pinodexmr/debug.log
echo "End ubuntu-install-continue.sh script $(date)" 2>&1 | tee -a /home/pinodexmr/debug.log
echo "
####################
" 2>&1 | tee -a /home/pinodexmr/debug.log
## Install complete
echo -e "\e[32mAll Installs complete\e[0m"
whiptail --title "PiNode-XMR Continue Install" --msgbox "Your PiNode-XMR is ready\n\nInstall complete. When you log in after the reboot use the menu to change your passwords and other features.\n\nEnjoy your Private Node\n\nSelect ok to reboot" 16 60
echo -e "\e[32m****************************************\e[0m"
echo -e "\e[32m****************************************\e[0m"
echo -e "\e[32m**********PiNode-XMR rebooting**********\e[0m"
echo -e "\e[32m**********Reminder:*********************\e[0m"
echo -e "\e[32m**********User: 'pinodexmr'*************\e[0m"
echo -e "\e[32m**********Password: 'PiNodeXMR**********\e[0m"
echo -e "\e[32m****************************************\e[0m"
echo -e "\e[32m****************************************\e[0m"
sleep 10
sudo reboot