forked from blacknet-ninja/blackcoin-old
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlinux.sh
117 lines (92 loc) · 2.02 KB
/
linux.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
#!/bin/bash
set -o errexit # Exit on error
set -o nounset # Trigger error when expanding unset variables
function realpath
{
[[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"
}
SCRIPT_PATH="$(realpath ""$0"")"
PATCH_PATH="${SCRIPT_PATH/sh/patch}"
BASE_DIR="$HOME/src"
function force
{
echo "Check failed: $1"
if [[ -z "$DO_FORCE" ]]
then
echo "Use --force to ignore checks"
exit 1
fi
}
function check
{
[[ $(cat /etc/debian_version) == 7.* ]] || force "Debian 7 (wheezy) required"
[[ -x "$(which git)" ]] || force "git not found. Please check that it is istalled and in PATH"
#[[ -f "$PATCH_PATH" ]] || force "Patch file not found"
}
function reset
{
sudo apt-get update || force "apt-get update failed"
sudo apt-get -y install build-essential libssl-dev libdb++-dev libboost-all-dev libqrencode-dev libminiupnpc-dev || force "apt-get install failed"
rm -rf "$BASE_DIR"
mkdir -p "$BASE_DIR"
cd "$BASE_DIR"
git clone https://github.com/rat4/blackcoin
cd blackcoin
# use general branch or last known commit
#git checkout watchonly
git checkout 65d88bc4e1b89fdc7eb60d059eaf85ff2fc8c369
#git am "$PATCH_PATH"
}
function build
{
cd "$HOME/src/blackcoin/src"
make STATIC=1 USE_UPNP=1 -f makefile.unix
strip blackcoind
}
function help
{
echo "Use:"
echo "$0 [ --help ] [ --force ] [ --reset ] [ --build ]"
}
DO_HELP=
DO_FORCE=
DO_RESET=
DO_BUILD=
for arg in "$@"
do
if [[ "$arg" == "--help" ]]
then
DO_HELP=1
elif [[ "$arg" == "--force" ]]
then
DO_FORCE=1
elif [[ "$arg" == "--reset" ]]
then
DO_RESET=1
elif [[ "$arg" == "--build" ]]
then
DO_BUILD=1
else
echo "Unknown argument: $arg"
help
exit 1
fi
done
if [[ -z "$DO_RESET" && -z "$DO_BUILD" || -n "$DO_HELP" ]]
then
help
exit 0
fi
check
if [[ -n "$DO_RESET" ]]
then
reset
fi
if [[ -n "$DO_BUILD" ]]
then
build
fi
if [[ -z "$DO_FORCE" ]]
then
echo "Success!"
fi