forked from brunohorta82/easyiot-controller-linux-installer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheasyiot-controller-installer.sh
More file actions
39 lines (38 loc) · 1.44 KB
/
Copy patheasyiot-controller-installer.sh
File metadata and controls
39 lines (38 loc) · 1.44 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
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "Please run this script as root"
exit 1
fi
if java -version | grep -q "java version" ; then
echo "Java is installed."
else
echo "Java is NOT installed! Installing it for you..."
sleep 3
package=default-jdk
apt=`command -v apt-get`
yum=`command -v yum`
if [ -n "$apt" ]; then
apt update
apt -y install $package
elif [ -n "$yum" ]; then
yum -y install $package
else
echo "Erro: Yum e APT não disponíveis" >&2;
exit 1;
fi
echo "Installing EasyIoT..."
systemctl stop easyiot-controller.service
rm -Rf /opt/easyiot-controller
rm -f /etc/systemd/system/easyiot-controller.service
systemctl daemon-reload
mkdir /opt/easyiot-controller
wget https://easyiot.bhonofre.pt/controller/latest-jar -O /opt/easyiot-controller/easyiot-controller.jar
wget https://raw.githubusercontent.com/brunohorta82/easyiot-controller-linux-installer/master/easyiot-controller.sh -O /usr/local/bin/easyiot-controller.sh
chmod +x /usr/local/bin/easyiot-controller.sh
wget https://raw.githubusercontent.com/brunohorta82/easyiot-controller-linux-installer/master/easyiot-controller.service -O /etc/systemd/system/easyiot-controller.service
systemctl daemon-reload
systemctl enable easyiot-controller.service
systemctl start easyiot-controller.service
echo "EasyIoT has been installed, you can access it at the following URL(s):"
ip -o addr show scope global | awk '{gsub(/\/.*/, " "$4); print "http://"$4":8092"}'
echo "Enjoy!"