This repository has been archived by the owner on Jul 20, 2024. It is now read-only.
forked from BadWolf42/jMQTT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_apt.sh
executable file
·63 lines (49 loc) · 2.16 KB
/
install_apt.sh
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
#!/bin/bash
######################### INCLUSION LIB ##########################
BASEDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
wget https://raw.githubusercontent.com/NebzHB/dependance.lib/master/dependance.lib -O $BASEDIR/dependance.lib &>/dev/null
PROGRESS_FILENAME=dependancy
PLUGIN=$(basename "$(realpath $BASEDIR/..)")
LANG_DEP=en
. ${BASEDIR}/dependance.lib
##################################################################
pre
INSTALL_MOSQUITTO=1
if [ ! -z $2 ] && [ $2 -eq 1 -o $2 -eq 0 ]; then
INSTALL_MOSQUITTO=$2
fi
echo "== Should install Mosquitto:" ${INSTALL_MOSQUITTO}
step 5 "Synchronize the package index"
try sudo apt-get update
if [ ${INSTALL_MOSQUITTO} -eq 1 ]; then
step 10 "Install Mosquitto"
try sudo DEBIAN_FRONTEND=noninteractive apt-get install -y mosquitto
if [ $(ls /etc/mosquitto/conf.d/*.conf 2>/dev/null | wc -w) -eq 0 ]; then
step 15 "Configure Mosquitto"
#echo "== No *.conf file found in conf.d folder"
#echo "== Create jMQTT Mosquitto configuration file"
echo -e "# jMQTT Mosquitto configuration file\nlistener 1883\nallow_anonymous true" > /etc/mosquitto/conf.d/jMQTT.conf
#echo "== restart Mosquitto service"
try service mosquitto restart
fi
fi
step 20 "Install Composer"
cd "$( dirname "${BASH_SOURCE[0]}" )"
cd ../resources
try wget 'https://getcomposer.org/installer' -O composer-setup.php
try php composer-setup.php
try rm -f composer-setup.php
step 30 "Install JsonPath-PHP library"
try sudo -u www-data php ./composer.phar update --working-dir=./JsonPath-PHP
step 40 "Remove Composer"
silent rm composer.phar
step 50 "Install python3 venv and pip debian packages"
try sudo DEBIAN_FRONTEND=noninteractive apt-get install -y python3-venv python3-pip
step 60 "Create a python3 Virtual Environment"
try sudo -u www-data python3 -m venv $BASEDIR/jmqttd/venv
step 70 "Install required python3 libraries in venv"
try sudo -u www-data $BASEDIR/jmqttd/venv/bin/pip3 install --no-cache-dir -r $BASEDIR/python-requirements/requirements.txt
step 90 "Run post_dependancy_install function"
cd "$( dirname "${BASH_SOURCE[0]}" )"
try sudo -u www-data php -r 'include "../core/class/jMQTT.class.php"; jMQTT::post_dependancy_install();'
post