26 lines
1.0 KiB
Bash
26 lines
1.0 KiB
Bash
#!/usr/bin/env bash
|
|
mac=`cat /sys/class/net/$(ip route get 8.8.8.8 | sed -n 's/.* dev \([^ ]*\).*/\1/p')/address`
|
|
arch=`uname -m`
|
|
|
|
### installing bsh gateway
|
|
echo -e "\033[36m Installing BSH Gateway.\033[0m"
|
|
|
|
if [ -d "/opt/Mqtt2ThingBoardGateWay" ]; then
|
|
systemctl stop Mqtt2ThingBoardGateWay.service
|
|
cp Mqtt2ThingBoardGateWay.py /opt/Mqtt2ThingBoardGateWay/
|
|
cp example-key.pem /opt/Mqtt2ThingBoardGateWay/
|
|
cp example-cert.pem /opt/Mqtt2ThingBoardGateWay/
|
|
else
|
|
mkdir /opt/Mqtt2ThingBoardGateWay
|
|
cp Mqtt2ThingBoardGateWay.py /opt/Mqtt2ThingBoardGateWay/
|
|
cp example-key.pem /opt/Mqtt2ThingBoardGateWay/
|
|
cp example-cert.pem /opt/Mqtt2ThingBoardGateWay/
|
|
fi
|
|
|
|
cp Mqtt2ThingBoardGateWay.service /lib/systemd/system/
|
|
chmod 644 /lib/systemd/system/Mqtt2ThingBoardGateWay.service
|
|
systemctl daemon-reload
|
|
systemctl enable Mqtt2ThingBoardGateWay.service
|
|
systemctl start Mqtt2ThingBoardGateWay.service
|
|
|
|
echo -e "\033[32m Installation completed. Mqtt2ThingBoardGateWay is now up and running.\033[0m" |