-
Notifications
You must be signed in to change notification settings - Fork 2
/
init.sh
executable file
·64 lines (51 loc) · 1.79 KB
/
init.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
#!/bin/bash
# check if .env exists
if [ ! -f .env ]; then
echo ".env file not found, please create one!";
echo "creating .env file...";
cp env.example .env;
# ask user for SOURCE_RPC_URL and replace it in .env
if [ -z "$SOURCE_RPC_URL" ]; then
echo "Enter SOURCE_RPC_URL: ";
read SOURCE_RPC_URL;
sed -i'.backup' "s#<source-rpc-url>#$SOURCE_RPC_URL#" .env
fi
# ask user for SIGNER_ACCOUNT_ADDRESS and replace it in .env
if [ -z "$SIGNER_ACCOUNT_ADDRESS" ]; then
echo "Enter SIGNER_ACCOUNT_ADDRESS: ";
read SIGNER_ACCOUNT_ADDRESS;
sed -i'.backup' "s#<signer-account-address>#$SIGNER_ACCOUNT_ADDRESS#" .env
fi
# ask user for SIGNER_ACCOUNT_PRIVATE_KEY and replace it in .env
if [ -z "$SIGNER_ACCOUNT_PRIVATE_KEY" ]; then
echo "Enter SIGNER_ACCOUNT_PRIVATE_KEY: ";
read SIGNER_ACCOUNT_PRIVATE_KEY;
sed -i'.backup' "s#<signer-account-private-key>#$SIGNER_ACCOUNT_PRIVATE_KEY#" .env
fi
# ask user for SLOT_ID and replace it in .env
if [ -z "$SLOT_ID" ]; then
echo "Enter Your SLOT_ID (NFT_ID): ";
read SLOT_ID;
sed -i'.backup' "s#<slot-id>#$SLOT_ID#" .env
fi
fi
source .env
echo "Killing old processes..."
pkill -f snapshotter
# only works for debian based systems
# setting up git submodules
git submodule update --init --recursive
./snapshotter_autofill.sh || exit 1
# check python3 is present
if ! [ -x "$(command -v python3)" ]; then
echo 'Error: python3 is not installed.' >&2
exit 1
fi
# check git
if ! [ -x "$(command -v git)" ]; then
echo 'Error: git is not installed.' >&2
exit 1
fi
# install python dependencies
pip3 install -r requirements.txt
python3 -m snapshotter.gunicorn_core_launcher & python3 -m snapshotter.system_event_detector &