-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall-full-node.sh
More file actions
731 lines (653 loc) · 22.2 KB
/
install-full-node.sh
File metadata and controls
731 lines (653 loc) · 22.2 KB
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
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
# https://coin.mateable.com/install-full-node.sh
# Start a MateableCoin full node on your Linux, Mac, BSD or Windows system to help validate and relay transactions across the MateableCoin network by running this command:
# curl https:///coin.mateable.cominstall-full-node.sh | sh
#!/bin/sh
###############################################################################
#
# install-full-node.sh
#
# This is the install script for MateableCoin full node based on MateableCoin Core.
#
# This script attempts to make your node automatically reachable by other nodes
# in the network. This is done by using uPnP to open port 69693 on your router
# to accept incoming connections to port 6969 and route the connections to your
# node running inside your local network.
#
# For security reason, wallet functionality is not enabled by default.
#
# Supported OS: Linux, Mac OS X, BSD, Windows (Windows Subsystem for Linux)
# Supported platforms: x86, x86_64, ARM
#
# Usage:
# Open your terminal and type:
#
# curl https://coin.mateable.com/install-full-node.sh | sh
#
# MateableCoin Core will be installed using binaries provided by coin.mateable.com
#
# If the binaries for your system are not available, the installer will attempt
# to build and install MateableCoin Core from source.
#
# All files will be installed into $HOME/mateable-core directory. Layout of this
# directory after the installation is shown below:
#
# Source files:
# $HOME/mateable-core/mateablecoin-24.x/
#
# Binaries:
# $HOME/mateable-core/bin/
#
# Configuration file:
# $HOME/mateable-core/.mateable/mateable.conf
#
# Blockchain data files:
# $HOME/mateable-core/.mateable/blocks
# /home/$USER/mateable-core/.mateable/chainstate
#
#
#
###############################################################################
REPO_URL="https://github.com/mateable/mateablecoin-24.x.git"
# See https://github.com/bitcoin/bitcoin/tags for latest version.
VERSION=24.x
TARGET_DIR=/home/$USER/mateable-core
PORT=6969
BUILD=0
UNINSTALL=0
# Define colors using tput
PURPLE=$(tput setaf 5)
BLUE=$(tput setaf 4)
GREEN=$(tput setaf 2)
YELLOW=$(tput setaf 3)
RED=$(tput setaf 1)
RESET=$(tput sgr0)
ARCH=$(uname -m)
SYSTEM=$(uname -s)
MAKE="make"
if [ "$SYSTEM" = "FreeBSD" ]; then
MAKE="gmake"
fi
SUDO=""
usage() {
cat <<EOF
This is the install script for MateableCoin full node based on MateableCoin Core.
Usage: $0 [-h] [-v <version>] [-t <target_directory>] [-p <port>] [-b] [-u]
-h
Print usage.
-v <version>
Version of MateableCoin Core to install.
Default: $VERSION
-t <target_directory>
Target directory for source files and binaries.
Default: /home/$USER/mateable-core
-p <port>
MateableCoin Core listening port.
Default: $PORT
-b
Build and install MateableCoin Core from source.
Default: $BUILD
-u
Uninstall MateableCoin Core.
EOF
}
print_info() {
printf "$BLUE$1$RESET\n"
}
print_downloading() {
printf "$white$1$RESET\n"
}
print_success() {
printf "$GREEN$1$RESET\n"
sleep 1
}
print_warning() {
printf "$YELLOW$1$RESET\n"
}
print_error() {
printf "$RED$1$RESET\n"
sleep 1
}
print_start() {
print_info "Start date: $(date)"
}
print_end() {
print_info "\nEnd date: $(date)"
}
print_readme() {
cat <<EOF
# README
To stop MateableCoin Core:
cd $TARGET_DIR/bin && ./stop.sh
To start MateableCoin Core again:
cd $TARGET_DIR/bin && ./start.sh
To use mateable-cli program:
cd $TARGET_DIR/bin && ./mateable-cli -conf=$TARGET_DIR/.mateable/mateable.conf getnetworkinfo
To view MateableCoin Core log file:
tail -f $TARGET_DIR/.mateable/debug.log
To uninstall MateableCoin Core:
./install-full-node.sh -u
EOF
}
program_exists() {
type "$1" > /dev/null 2>&1
return $?
}
create_target_dir() {
if [ ! -d "$TARGET_DIR" ]; then
print_info "\nCreating target directory: $TARGET_DIR"
mkdir -p $TARGET_DIR
fi
}
init_system_install() {
if [ $(id -u) -ne 0 ]; then
if program_exists "sudo"; then
SUDO="sudo"
print_info "\nInstalling required system packages.."
else
print_error "\nsudo program is required to install system packages. Please install sudo as root and rerun this script as normal user."
exit 1
fi
fi
}
install_miniupnpc() {
print_info "Installing miniupnpc from source.."
rm -rf miniupnpc-2.0 miniupnpc-2.0.tar.gz &&
wget -q http://miniupnp.free.fr/files/download.php?file=miniupnpc-2.0.tar.gz -O miniupnpc-2.0.tar.gz && \
tar xzf miniupnpc-2.0.tar.gz && \
cd miniupnpc-2.0 && \
$SUDO $MAKE install > build.out 2>&1 && \
cd .. && \
rm -rf miniupnpc-2.0 miniupnpc-2.0.tar.gz
}
install_debian_build_dependencies() {
$SUDO apt-get update
$SUDO apt-get install -y \
automake \
autotools-dev \
build-essential \
curl \
bison \
git \
libboost-all-dev \
libevent-dev \
libminiupnpc-dev \
libssl-dev \
libtool \
pkg-config
}
install_fedora_build_dependencies() {
$SUDO dnf install -y \
automake \
boost-devel \
curl \
gcc-c++ \
bison \
git \
libevent-devel \
libtool \
miniupnpc-devel \
openssl-devel
}
install_centos_build_dependencies() {
$SUDO yum install -y \
automake \
boost-devel \
curl \
gcc-c++ \
git \
libevent-devel \
libtool \
openssl-devel
install_miniupnpc
echo '/usr/lib' | $SUDO tee /etc/ld.so.conf.d/miniupnpc-x86.conf > /dev/null && $SUDO ldconfig
}
install_archlinux_build_dependencies() {
$SUDO pacman -S --noconfirm \
automake \
boost \
curl \
bison \
git \
libevent \
libtool \
miniupnpc \
openssl
}
install_alpine_build_dependencies() {
$SUDO apk update
$SUDO apk add \
autoconf \
automake \
boost-dev \
build-base \
curl \
bison \
git \
libevent-dev \
libtool \
openssl-dev
install_miniupnpc
}
install_mac_build_dependencies() {
if ! program_exists "gcc"; then
print_info "When the popup appears, click 'Install' to install the XCode Command Line Tools."
xcode-select --install
fi
if ! program_exists "brew"; then
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
brew install \
--c++11 \
automake \
boost \
libevent \
libtool \
miniupnpc \
openssl \
pkg-config
}
install_freebsd_build_dependencies() {
$SUDO pkg install -y \
autoconf \
automake \
boost-libs \
curl \
bison \
git \
gmake \
libevent2 \
libtool \
openssl \
pkgconf \
wget
install_miniupnpc
}
install_build_dependencies() {
init_system_install
case "$SYSTEM" in
Linux)
if program_exists "apt-get"; then
install_debian_build_dependencies
elif program_exists "dnf"; then
install_fedora_build_dependencies
elif program_exists "yum"; then
install_centos_build_dependencies
elif program_exists "pacman"; then
install_archlinux_build_dependencies
elif program_exists "apk"; then
install_alpine_build_dependencies
else
print_error "\nSorry, your system is not supported by this installer."
exit 1
fi
;;
Darwin)
install_mac_build_dependencies
;;
FreeBSD)
install_freebsd_build_dependencies
;;
*)
print_error "\nSorry, your system is not supported by this installer."
exit 1
;;
esac
}
build_bitcoin_core() {
cd $TARGET_DIR
if [ ! -d "$TARGET_DIR/mateablecoin-24.x" ]; then
print_downloading "\nDownloading MateableCoin Core source files.."
git clone --quiet $REPO_URL
fi
# Tune gcc to use less memory on single board computers.
cxxflags=""
if [ "$SYSTEM" = "Linux" ]; then
ram_kb=$(grep MemTotal /proc/meminfo | awk '{print $2}')
if [ $ram_kb -lt 1500000 ]; then
cxxflags="--param ggc-min-expand=1 --param ggc-min-heapsize=32768"
fi
fi
print_downloading "\nBuilding MateableCoin Core v$VERSION"
print_info "Build output: $TARGET_DIR/mateablecoin-24.x/build.out"
print_downloading "THIS MAY TAKE A WHILE, PLEASE BE PATIENT..."
rm -f build.out
cd mateablecoin-24.x &&
git fetch > build.out 2>&1 &&
git checkout 1>> build.out 2>&1 &&
git clean -f -d -x 1 >> build.out 2>&1 &&
cd depends > build.out 2>&1 &&
$MAKE HOST=x86_64-pc-linux-gnu -j4 >> build.out 2>&1 &&
cd .. && > build.out 2>&1 &&
./autogen.sh 1>> build.out 2>&1 &&
CONFIG_SITE=$TARGET_DIR/mateablecoin-24.x/depends/x86_64-pc-linux-gnu/share/config.site ./configure 1>> build.out 2>&1 &&
$MAKE -j4 1>> build.out 2>&1
cd src 1>> build.out 2>&1
sleep 1
if [ ! -f "mateabled" ]; then
print_error "Build failed. See $TARGET_DIR/mateablecoin-24.x/build.out"
exit 1
fi
sleep 1
./mateabled -? > /dev/null
retcode=$?
}
get_bin_url() {
#url=""
url=""
case "$SYSTEM" in
Linux)
if program_exists "apk"; then
echo ""
elif [ "$ARCH" = "armv7l" ]; then
url=""
echo "$url"
else
url=""
echo "$url"
fi
;;
Darwin)
url=""
echo "$url"
;;
FreeBSD)
echo ""
;;
*)
echo ""
;;
esac
}
download_bin() {
#checksum_url="https://bitcoincore.org/bin/bitcoin-core-$VERSION/SHA256SUMS"
checksum_url=""
cd $TARGET_DIR
rm -f bitcoin-$VERSION.tar.gz checksum.asc
print_info "\nDownloading Bitcoin Core binaries.."
if program_exists "wget"; then
wget -q "$1" -O bitcoin-$VERSION.tar.gz &&
wget -q "$checksum_url" -O checksum.asc &&
mkdir -p bitcoin-$VERSION &&
tar xzf bitcoin-$VERSION.tar.gz -C bitcoin-$VERSION --strip-components=1
elif program_exists "curl"; then
curl -s "$1" -o bitcoin-$VERSION.tar.gz &&
curl -s "$checksum_url" -o checksum.asc &&
mkdir -p bitcoin-$VERSION &&
tar xzf bitcoin-$VERSION.tar.gz -C bitcoin-$VERSION --strip-components=1
else
print_error "\nwget or curl program is required to continue. Please install wget or curl as root and rerun this script as normal user."
exit 1
fi
if program_exists "shasum"; then
checksum=$(shasum -a 256 bitcoin-$VERSION.tar.gz | awk '{ print $1 }')
if grep -q "$checksum" checksum.asc; then
print_success "Checksum passed: bitcoin-$VERSION.tar.gz ($checksum)"
else
print_error "Checksum failed: bitcoin-$VERSION.tar.gz ($checksum). Please rerun this script to download and validate the binaries again."
exit 1
fi
fi
rm -f bitcoin-$VERSION.tar.gz checksum.asc
}
install_bitcoin_core() {
cd $TARGET_DIR
print_info "\nInstalling MateableCoin Core v$VERSION"
if [ ! -d "$TARGET_DIR/bin" ]; then
mkdir -p $TARGET_DIR/bin
fi
if [ ! -d "$TARGET_DIR/.mateable" ]; then
mkdir -p $TARGET_DIR/.mateable
fi
if [ "$SYSTEM" = "Darwin" ]; then
if [ ! -e "/home/$USER/Library/Application Support/Mateable" ]; then
ln -s $TARGET_DIR/.mateable "/home/$USER/Library/Application Support/Mateable"
fi
else
if [ ! -e "/home/$USER/.mateable" ]; then
ln -s $TARGET_DIR/.mateable /home/$USER/.mateable
fi
fi
if [ -f "$TARGET_DIR/mateablecoin-24.x/src/mateabled" ]; then
# Install compiled binaries.
cp "$TARGET_DIR/mateablecoin-24.x/src/mateabled" "$TARGET_DIR/bin/" &&
cp "$TARGET_DIR/mateablecoin-24.x/src/mateable-cli" "$TARGET_DIR/bin/" &&
print_success "MateableCoin Core v$VERSION (compiled) installed successfully!"
elif [ -f "$TARGET_DIR/mateablecoin-24.x/bin/mateabled" ]; then
# Install downloaded binaries.
cp "$TARGET_DIR/mateablecoin-24.x/bin/mateabled" "$TARGET_DIR/bin/" &&
cp "$TARGET_DIR/mateablecoin-24.x/bin/mateable-cli" "$TARGET_DIR/bin/" &&
rm -rf "$TARGET_DIR/mateablecoin-24.x"
print_success "MateableCoin Core v$VERSION (binaries) installed successfully!"
else
print_error "Cannot find files to install."
exit 1
fi
cat > $TARGET_DIR/.mateable/mateable.conf <<EOF
### IPv4/IPv6 mode ###
# This mode requires uPnP feature on your router to allow Bitcoin Core to accept incoming connections.
bind=0.0.0.0
upnp=1
### Tor mode ###
# This mode requires tor (https://www.torproject.org/download/) to be running at the proxy address below.
# No configuration is needed on your router to allow Bitcoin Core to accept incoming connections.
#proxy=127.0.0.1:9050
#bind=127.0.0.1
#onlynet=onion
listen=1
port=$PORT
maxconnections=64
dbcache=64
par=2
checkblocks=24
checklevel=0
disablewallet=1
rpccookiefile=$TARGET_DIR/.mateable/.cookie
rpcbind=127.0.0.1
rpcport=6966
rpcallowip=127.0.0.1
EOF
chmod go-rw $TARGET_DIR/.mateable/mateable.conf
cat > $TARGET_DIR/bin/start.sh <<EOF
#!/bin/sh
if [ -f $TARGET_DIR/bin/mateabled ]; then
$TARGET_DIR/bin/mateabled -conf=$TARGET_DIR/.mateable/mateable.conf -datadir=$TARGET_DIR/.mateable -daemon
fi
EOF
chmod ugo+x $TARGET_DIR/bin/start.sh
cat > $TARGET_DIR/bin/stop.sh <<EOF
#!/bin/sh
if [ -f $TARGET_DIR/.mateable/bitcoind.pid ]; then
kill \$(cat $TARGET_DIR/.mateable/bitcoind.pid)
fi
EOF
chmod ugo+x $TARGET_DIR/bin/stop.sh
}
start_bitcoin_core() {
if [ ! -f $TARGET_DIR/.mateable/bitcoind.pid ]; then
print_info "\nStarting MateableCoin Core.."
cd $TARGET_DIR/bin && ./start.sh
timer=0
until [ -f $TARGET_DIR/.mateable/bitcoind.pid ] || [ $timer -eq 5 ]; do
timer=$((timer + 1))
sleep $timer
done
if [ -f $TARGET_DIR/.mateable/bitcoind.pid ]; then
print_success "MateableCoin Core is running!"
else
print_error "Failed to start MateableCoin Core."
exit 1
fi
fi
}
stop_bitcoin_core() {
if [ -f $TARGET_DIR/.mateable/bitcoind.pid ]; then
print_info "\nStopping MateableCoin Core.."
cd $TARGET_DIR/bin && ./stop.sh
timer=0
until [ ! -f $TARGET_DIR/.mateable/bitcoind.pid ] || [ $timer -eq 120 ]; do
timer=$((timer + 1))
sleep $timer
done
if [ ! -f $TARGET_DIR/.mateable/bitcoind.pid ]; then
print_success "MateableCoin Core stopped."
else
print_error "Failed to stop MateableCoin Core."
exit 1
fi
fi
}
check_bitcoin_core() {
if [ -f $TARGET_DIR/.mateable/bitcoind.pid ]; then
if [ -f $TARGET_DIR/bin/mateable-cli ]; then
print_info "\nChecking MateableCoin Core.."
sleep 5
$TARGET_DIR/bin/mateable-cli -conf=$TARGET_DIR/.mateable/mateable.conf -datadir=$TARGET_DIR/.mateable getnetworkinfo
print_success "MateableCoin Core is accepting incoming connections at port $PORT!"
fi
fi
}
uninstall_bitcoin_core() {
stop_bitcoin_core
if [ -d "$TARGET_DIR" ]; then
print_info "\nUninstalling MateableCoin Core.."
rm -rf $TARGET_DIR
# Remove stale symlink.
if [ "$SYSTEM" = "Darwin" ]; then
if [ -L "/home/$USER/Library/Application Support/Mateable" ] && [ ! -d "/home/$USER/Library/Application Support/Mateable" ]; then
rm "/home/$USER/Library/Application Support/Mateable"
fi
else
if [ -L /home/$USER/.mateable ] && [ ! -d /home/$USER/.mateable ]; then
rm /home/$USER/.mateable
fi
fi
if [ ! -d "$TARGET_DIR" ]; then
print_success "MateableCoin Core uninstalled successfully!"
else
print_error "Uninstallation failed. Is Bitcoin Core still running?"
exit 1
fi
else
print_error "MateableCoin Core not installed."
fi
}
while getopts ":v:t:p:bu" opt
do
case "$opt" in
v)
VERSION=${OPTARG}
;;
t)
TARGET_DIR=${OPTARG}
;;
p)
PORT=${OPTARG}
;;
b)
BUILD=1
;;
u)
UNINSTALL=1
;;
h)
usage
exit 0
;;
?)
usage >& 2
exit 1
;;
esac
done
WELCOME_TEXT=$(cat <<EOF
@@@
%@@///////////////////////@@%
@@///////////////////////////////////@@
@@///////////////////////////////////////////@@
@///////////////////////////////////////////////////@
@@///////////////////////////////////////////////////////@@
@/////////////////////////////////////////////////////////////@
@////////////////////////////////////////////////////////////////(@
@////////// ///// ////// //////////@
#///////// //// //// ////////#,
@//////// ///// //// //// //// ////////@
@/////// ////////////// //// //// ////////////// ////////,
@/////// ///// //////,//// /// /// ////*////// ///// ///////@
@/////// /// ///////////// ///*/// ///////////// /// ///////@
@//////// ///, //////////// //// ///* //////////// ///. ////////@
///////// /// ///////// ////* //// ////////// /// /////////
@/////////// /// ///// ///// //// ///////////
///////////// /////// *//////// /////// ////// /////////////
@////////////// //////// *//////// //////////////@
@///////////////// ./ /////////////////@
@/////////////////// / // // / / / / / ///////////////////@
@////////////////////// / / / / / //// //// / //////////////////////,
@/////////////////////// ///////////////////////@
*(//////////////////////// ////////////////////////&
@////////////////////////// //////////////////////////@
@//////////////////////////// ///////////////////////////&@
@//////////////////////////// ////////////////////////////@
@@///////////////////////////////////////////////////////@#
@///////////////////////////////////////////////////@
@@///////////////////////////////////////////@@
@@///////////////////////////////////@@
@@///////////////////////@@
${PURPLE}____ ____ _ __ __ ______ _
|_ \ / _| / |_ [ | [ | .' ___ | (_)
| \/ | ,--. \`| |-' .---. ,--. | |.--. | | .---. / .' \\_| .--. __ _ .--.
| |\ /| | \`'_\\ : | | / /__\\ \`'_\\ : | '/'\`\\ \\ | | / /__\\ | | / .'\\\` \\ [ | [ \`.-. |
_| |_\\/_| |_ // | |, | |, | \\__., // | |, | \\__/ | | | | \\__., \\ \`.___.'\\ | \\__. | | | | | | |
|_____||_____| \\'-;__/ \\__/ '.__.' \\'-;__/ [__;.__.' [___] '.__.' \`.___ .' '.__.' [___] [___||__]
${RESET}
You are about to install a ${PURPLE} MateableCoin ${RESET} full node based on MateableCoin Core v$VERSION.
All files will be installed under $TARGET_DIR directory.
Your node will be configured to accept incoming connections from other nodes in
the MateableCoin network by using uPnP feature on your router.
For security reason, wallet functionality is not enabled by default.
After the installation, it may take several hours for your node to download a
full copy of the blockchain.
If you wish to uninstall ${PURPLE} MateableCoin core ${RESET} later, you can download this script and
run "sh install-full-node.sh -u".
EOF
)
print_start
if [ $UNINSTALL -eq 1 ]; then
echo
read -p "WARNING: This will stop MateableCoin Core and uninstall it from your system. Uninstall? (y/n) " answer
if [ "$answer" = "y" ]; then
uninstall_bitcoin_core
fi
else
echo "$WELCOME_TEXT"
if [ -t 0 ]; then
# Prompt for confirmation when invoked in tty.
echo
read -p "Install? (y/n) " answer
else
# Continue installation when invoked via pipe, e.g. curl .. | sh
answer="y"
echo
echo "Starting installation in 10 seconds.."
sleep 10
fi
if [ "$answer" = "y" ]; then
if [ "$BUILD" -eq 0 ]; then
bin_url=$(get_bin_url)
else
bin_url=""
fi
stop_bitcoin_core
create_target_dir
if [ "$bin_url" != "" ]; then
download_bin "$bin_url"
else
install_build_dependencies && build_bitcoin_core
fi
install_bitcoin_core && start_bitcoin_core && check_bitcoin_core
print_readme > $TARGET_DIR/README.md
cat $TARGET_DIR/README.md
print_success "If this your first install, MateableCoin Core may take several hours to download a full copy of the blockchain."
print_success "\nInstallation completed!"
fi
fi
print_end