-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·38 lines (31 loc) · 1.52 KB
/
install.sh
File metadata and controls
executable file
·38 lines (31 loc) · 1.52 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
#!/bin/bash
URL_PREFIX=https://github.com/filswan/go-swan-client/releases/download
BINARY_NAME=swan-client-2.2.0-rc1-linux-amd64
TAG_NAME=v2.2.0-rc1
wget --no-check-certificate ${URL_PREFIX}/${TAG_NAME}/${BINARY_NAME}
wget --no-check-certificate ${URL_PREFIX}/${TAG_NAME}/config.toml.example
wget --no-check-certificate ${URL_PREFIX}/${TAG_NAME}/chain-rpc.json
sudo install -C $(BINARY_NAME) /usr/local/bin/$(BINARY_NAME)
CONF_FILE_DIR=${HOME}/.swan/client
mkdir -p ${CONF_FILE_DIR}
current_create_time=`date +"%Y%m%d%H%M%S"`
if [ -f "${CONF_FILE_DIR}/config.toml" ]; then
# shellcheck disable=SC2154
mv ${CONF_FILE_DIR}/config.toml ${CONF_FILE_DIR}/config.toml.${current_create_time}
echo "The previous configuration files have been backed up: ${CONF_FILE_DIR}/config.toml.${current_create_time}"
cp ./config.toml.example ${CONF_FILE_DIR}/config.toml
echo "${CONF_FILE_DIR}/config.toml created"
else
cp ./config.toml.example ${CONF_FILE_DIR}/config.toml
echo "${CONF_FILE_DIR}/config.toml created"
fi
if [ -f "${CONF_FILE_DIR}/chain-rpc.json" ]; then
mv ${CONF_FILE_DIR}/chain-rpc.json ${CONF_FILE_DIR}/chain-rpc.json.${current_create_time}
echo "The previous configuration files have been backed up: ${CONF_FILE_DIR}/chain-rpc.json.${current_create_time}"
cp ./chain-rpc.json ${CONF_FILE_DIR}/chain-rpc.json
echo "${CONF_FILE_DIR}/chain-rpc.json created"
else
cp ./chain-rpc.json ${CONF_FILE_DIR}/chain-rpc.json
echo "${CONF_FILE_DIR}/chain-rpc.json created"
fi
chmod +x ./${BINARY_NAME}