-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·215 lines (171 loc) · 4.91 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·215 lines (171 loc) · 4.91 KB
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
#!/usr/bin/env bash
DESTDIR="massa_acheta"
function rollback {
sudo systemctl stop massa_acheta.service &> /dev/null
sudo systemctl disable massa_acheta.service &> /dev/null
cd ~
rm -rf ~/massa_acheta &> /dev/null
sudo rm /etc/systemd/system/massa_acheta.service &> /dev/null
sudo systemctl daemon-reload &> /dev/null
}
# Check OS distro
hostnamectl | grep -i "ubuntu" > /dev/null
if [[ $? -ne 0 ]]
then
echo
echo "Error: this installation uses Ubuntu-compatible commands and cannot be used in other Linux distros."
echo "You can try to install service manually using this scenario: https://github.com/dex2code/massa_acheta/"
exit 1
fi
cd ~
clear
echo
echo "::::::::::::::::::::::::::::::::::::::::::::::::::::::::"
echo "::'##::::'##::::'###:::::'######:::'######:::::'###:::::"
echo ":::###::'###:::'## ##:::'##... ##:'##... ##:::'## ##::::"
echo ":::####'####::'##:. ##:: ##:::..:: ##:::..:::'##:. ##:::"
echo ":::## ### ##:'##:::. ##:. ######::. ######::'##:::. ##::"
echo ":::##. #: ##: #########::..... ##::..... ##: #########::"
echo ":::##:.:: ##: ##.... ##:'##::: ##:'##::: ##: ##.... ##::"
echo ":::##:::: ##: ##:::: ##:. ######::. ######:: ##:::: ##::"
echo "::..:::::..::..:::::..:::......::::......:::..:::::..:::"
echo "::::::::::::::::::::::::::::::::::::::::::::::::::::::::"
echo
echo "[ MASSA 🦗 Acheta Telebot ] -- https://github.com/dex2code/massa_acheta/"
echo
echo "This script will configure your system and install all neccessary software:"
echo " - python3"
echo " - python3-venv"
echo " - python3-pip"
echo " - git"
echo
echo "New Python virtual environment will be deployed in '$HOME/$DESTDIR' and new systemd unit 'massa_acheta.service' will be created."
echo -n "If you are ok with this please hit Enter, otherwise Ctrl+C to quit the installation... "
read _
sudo echo
echo -n " → Ready to update your repository and install all packages. Press Enter to continue... "
read _
echo
sudo apt-get update
if [[ $? -eq 0 ]]
then
echo "✅ Updating finished!"
echo
else
echo
echo "‼ Some error occured. Please check your settings."
exit 1
fi
sudo apt-get -y install git python3 python3-venv python3-pip
if [[ $? -eq 0 ]]
then
echo "✅ All dependecies installed!"
echo
else
echo
echo "‼ Some error occured. Please check your settings."
exit 1
fi
echo -n " → Ready to clone repo to download service software. Press Enter to continue... "
read _
echo
git clone https://github.com/dex2code/massa_acheta.git
if [[ $? -eq 0 ]]
then
echo "✅ Repo cloned successfully!"
echo
else
echo
echo "‼ Some error occured. Please check your settings."
rollback
exit 1
fi
echo -n " → Ready to create and configure Python virtual environment. Press Enter to continue... "
read _
echo
echo -n "Creating Python venv in $HOME/$DESTDIR... "
cd $DESTDIR && python3 -m venv .
if [[ $? -eq 0 ]]
then
echo "Done!"
else
echo
echo "‼ Some error occured. Please check your settings."
rollback
exit 1
fi
source ./bin/activate && ./bin/pip3 install pip --upgrade && ./bin/pip3 install -r ./requirements.txt
if [[ $? -eq 0 ]]
then
echo "✅ Python virtual environment created and configured successfully!"
echo
else
echo
echo "‼ Some error occured. Please check your settings."
rollback
exit 1
fi
echo -n " → Ready to create systemd unit. Press Enter to continue... "
read _
echo
./service.sh
if [[ $? -eq 0 ]]
then
echo "✅ Service daemon configured successfully!"
echo
else
echo
echo "‼ Some error occured. Please check your settings."
rollback
exit 1
fi
echo -n " → Ready to configure your Telegram bot. Press Enter to continue... "
read _
echo
./setkey.sh
if [[ $? -eq 0 ]]
then
echo "✅ Telegram bot configured successfully!"
echo
else
echo
echo "‼ Some error occured. Please check your settings."
rollback
exit 1
fi
echo -n " → Ready to start and enable the service. Press Enter to continue... "
read _
sudo systemctl start massa_acheta.service
if [[ $? -eq 0 ]]
then
echo "✅ Service started successfully!"
else
echo
echo "‼ Some error occured. Please check your settings."
rollback
exit 1
fi
sudo systemctl enable massa_acheta.service
if [[ $? -eq 0 ]]
then
echo "✅ Service enabled successfully!"
echo
else
echo
echo "‼ Some error occured. Please check your settings."
rollback
exit 1
fi
echo "✅ Installation done!"
echo
echo -n "Press Enter to continue... "
read _
clear
echo
echo
echo "Please note if you watch remote MASSA node you MUST open firewall on your MASSA node host."
echo "You can do it with command 'sudo ufw allow 33035/tcp'. If your firewall is closed for 33035/tcp port - your node will be unavailable for monitoring service."
echo "You don't need to open firewall if you watch localhost (127.0.0.1)."
echo
echo "More information here: https://github.com/dex2code/massa_acheta/"
echo