-
Notifications
You must be signed in to change notification settings - Fork 1
/
install_dependencies.sh
114 lines (97 loc) · 3.3 KB
/
install_dependencies.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
#!/bin/bash
# Template: OpenBazaar
#
# install_dependencies.sh - Setup your Cryptonote development environment in one step.
#
# This script will only get better as its tested on more development environments
# if you can't modify it to make it better, please open an issue with a full
# error report at https://github.com/forknote/cryptonote-generator.git/issues/new
#
# Credits: Forknote
#
# Code borrowed from:
# https://github.com/OpenBazaar/OpenBazaar/blob/develop/configure.sh
# https://github.com/Quanttek/install_monero/blob/master/install_monero.sh
#exit on error
set -e
function command_exists {
# this should be a very portable way of checking if something is on the path
# usage: "if command_exists foo; then echo it exists; fi"
type "$1" &> /dev/null
}
function brewDoctor {
if ! brew doctor; then
echo ""
echo "'brew doctor' did not exit cleanly! This may be okay. Read above."
echo ""
read -p "Press [Enter] to continue anyway or [ctrl + c] to exit and do what the doctor says..."
fi
}
function brewUpgrade {
echo "If your homebrew packages are outdated, we recommend upgrading them now. This may take some time."
read -r -p "Do you want to do this? [y/N] " response
if [[ $response =~ ^([yY][eE][sS]|[yY])$ ]]
then
if ! brew upgrade; then
echo ""
echo "There were errors when attempting to 'brew upgrade' and there could be issues with the installation of Cryptonote generator."
echo ""
read -p "Press [Enter] to continue anyway or [ctrl + c] to exit and fix those errors."
fi
fi
}
function installMac {
# print commands (useful for debugging)
# set -x #disabled because the echos and stdout are verbose enough to see progress
# install brew if it is not installed, otherwise upgrade it
if ! command_exists brew ; then
echo "installing brew..."
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
else
echo "updating, upgrading, checking brew..."
brew update
brewDoctor
brewUpgrade
brew prune
fi
# install gpg/sqlite3/python/wget/openssl/zmq if they aren't installed
for dep in cmake boost python
do
if ! command_exists $dep ; then
brew install $dep
fi
done
doneMessage
}
function unsupportedOS {
echo "Unsupported OS. Only MacOSX and Ubuntu are supported."
}
function installUbuntu {
. /etc/lsb-release
# print commands
set -x
if [[ $DISTRIB_ID=Ubuntu && $DISTRIB_RELEASE == 16.04 ]] ; then
sudo apt-get update
sudo apt-get -y install build-essential python-dev gcc-4.9 g++-4.9 git cmake libboost1.58-all-dev librocksdb-dev
export CXXFLAGS="-std=gnu++11"
doneMessage
elif [[ $DISTRIB_ID=Ubuntu && $DISTRIB_RELEASE == 16.10 ]] ; then
sudo apt-get update
sudo apt-get -y install build-essential python-dev gcc-4.9 g++-4.9 git cmake libboost1.61-all-dev librocksdb-dev
export CXXFLAGS="-std=gnu++11"
doneMessage
else
echo "Only Ubuntu 16.04 is supported"
fi
}
function doneMessage {
echo "Cryptonote generator configuration finished."
echo "type 'bash generator.sh [-h] [-f FILE] [-c <string>]' to generate Cryptonote coin."
}
if [[ $OSTYPE == darwin* ]] ; then
installMac
elif [[ $OSTYPE == linux-gnu || $OSTYPE == linux-gnueabihf ]]; then
installUbuntu
else
unsupportedOS
fi