forked from ethernity-cloud/mvp-pox-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpox-do
executable file
·85 lines (77 loc) · 1.82 KB
/
pox-do
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
#!/bin/bash
BASEPATH=`dirname "$0"`
source "${BASEPATH}/config"
if [ ! -e .init-done ]
then
echo "$0 was not initialized yet"
echo "Requirements fot the $0 are the following:
1. ipfs daemon running and listening on localhost:5000
2. python3 with pip
3. ipfshttpclient python module
4. web3 python module"
while [ 1 == 1 ]
do
echo -en "Proceed with automated initalization [Y/n]: "
read -r RESPONSE
case $RESPONSE in
"")
echo -en "Initializing... "
if [ "$IPFS_GATEWAY_URL" == "" ]
then
src/init/init_ipfs_python.sh 2>&1 >> /dev/null
else
src/init/init_python.sh 2>&1 >> /dev/null
fi
break
;;
y)
echo -en "Initializing... "
if [ "$IPFS_GATEWAY_URL" == "" ]
then
src/init/init_ipfs_python.sh 2>&1 >> /dev/null
else
src/init/init_python.sh 2>&1 >> /dev/null
fi
INIT=$?
break
;;
n)
exit
;;
*)
echo "Please specify 'y' or 'n' for yes or no."
continue
;;
esac
done
case "$INIT" in
1)
echo "failed"
echo "$0 requires python3 installed. Please install it using your system's package manager"
exit
;;
2)
echo "failed"
echo "$0 requires python3-pip installed. Please install it using your system's package manager."
exit
;;
0)
echo "done"
;;
*)
esac
else
echo -en "Cleaning up IPFS..."
src/init/clean.sh 2>&1 >> /dev/null
echo " done"
fi
if [ "$OS" == "Windows_NT" ]
then
PYTHON_BIN="python"
else
PYTHON_BIN="python3"
fi
if [ ! -z "$IPFS_GATEWAY_URL" ]; then set -- "$@" -g $IPFS_GATEWAY_URL; fi
if [ ! -z "$IPFS_GATEWAY_PASSWORD" ]; then set -- "$@" -u $IPFS_GATEWAY_USERNAME; fi
if [ ! -z "$IFS_GATEWAY_PASSWORD" ]; then set -- "$@" -p $IPFS_GATEWAY_PASSWORD; fi
${PYTHON_BIN} src/do.py -a $ADDRESS -k $PRIVATE_KEY $@