-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathupdate_node
38 lines (32 loc) · 1.36 KB
/
update_node
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
#! /bin/bash
# based on https://gist.github.com/michalisFr/daa01c7374793a684a3a1f61e4959492
# https://github.com/paritytech/polkadot-sdk/releases/download/v1.1.0/polkadot
# Получение полного пути к директории, в которой находится скрипт
script_dir=$(dirname "$(realpath "$0")")
source ${script_dir}/.env
wget ${BASE_URL}$1/polkadot && \
wget ${BASE_URL}$1/polkadot.sha256 && \
wget ${BASE_URL}$1/polkadot-execute-worker && \
wget ${BASE_URL}$1/polkadot-prepare-worker && \
sed -i 's+./artifacts/polkadot+polkadot+g' polkadot.sha256
if sha256sum -c polkadot.sha256 2>&1 | grep -q 'OK'
then
echo "** SHA256 matches **"
chmod +x polkadot && \
chmod +x polkadot-execute-worker && \
chmod +x polkadot-prepare-worker && \
sudo chown ${USER}:${USER} polkadot && \
sudo chown ${USER}:${USER} polkadot-execute-worker && \
sudo chown ${USER}:${USER} polkadot-prepare-worker && \
sudo systemctl stop ${SERVICE_NAME} && \
mv polkadot ${BIN_DIR} && \
mv polkadot-execute-worker ${BIN_DIR} && \
mv polkadot-prepare-worker ${BIN_DIR} && \
rm polkadot.sha256 && \
sudo systemctl start ${SERVICE_NAME} && \
sudo journalctl -fu ${SERVICE_NAME}
else
echo "** SHA256 doesn't match. Aborting **"
rm polkadot*
fi
echo done!