forked from orisi/orisi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·60 lines (50 loc) · 1.57 KB
/
install.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
#!/bin/bash
tflag=no
set -- $(getopt t "$@")
while [ $# -gt 0 ]
do
case "$1" in
(-t) tflag=yes;;
(--) shift; break;;
(-*) echo "$0: error - unrecognized option $1" 1>&2; exit 1;;
(*) break;;
esac
shift
done
read -p "Do you want to update? [y/N]? " -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
sudo apt-get update
fi
sudo apt-get install python-dev vim screen
sudo pip install -r requirements.txt
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
HOME="$DIR/.."
read -p "Do you need to install bitcoind? [y/N]? " -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
wget --directory-prefix=$HOME https://bitcoin.org/bin/0.9.1/bitcoin-0.9.1-linux.tar.gz &&
tar -C $HOME -zxvf $HOME/bitcoin-0.9.1-linux.tar.gz &&
mv $HOME/bitcoin-0.9.1-linux $HOME/bitcoin &&
rm $HOME/bitcoin-0.9.1-linux.tar.gz &&
echo 'alias bitcoind=~/bitcoin/bin/64/bitcoind' >> $HOME/.bash_aliases &&
source $HOME/.bash_aliases &&
cp $DIR/src/settings_local.py.example $DIR/src/settings_local.py
fi
if [ "$tflag" == "yes" ]
then
echo BITCOIND_TEST_MODE=True >> $DIR/src/settings_local.py
fi
mkdir -p $HOME/.bitcoin/
# this is harmless even if the file exists
touch $HOME/.bitcoin/bitcoin.conf
BTCRPC=`openssl rand -hex 32`
echo rpcuser=bitrpc >> $HOME/.bitcoin/bitcoin.conf
echo rpcpassword=$BTCRPC >> $HOME/.bitcoin/bitcoin.conf
if [ "$tflag" == "yes" ]
then
echo connect=127.0.0.1:8333 >> $HOME/.bitcoin/bitcoin.conf
fi
echo BITCOIND_RPC_PASSWORD = \"$BTCRPC\" >> $DIR/src/settings_local.py