-
Notifications
You must be signed in to change notification settings - Fork 0
/
prepare
executable file
·73 lines (67 loc) · 2.27 KB
/
prepare
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
64
65
66
67
68
69
70
71
72
73
#!/bin/bash
# +----------------------------------------------------------------------------+
# | MM8D v0.6 * Growing house and irrigation controlling and monitoring system |
# | Copyright (C) 2020-2024 Pozsár Zsolt <pozsarzs@gmail.com> |
# | prepare |
# | Prepare OS |
# +----------------------------------------------------------------------------+
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the European Union Public License 1.2 version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE.
line()
{
for ((i=0; i<${#SWCR}; i++))
do
echo -n "-"
done
echo ""
}
# constants
ARCH=`uname -m`
SWN1="MM8D"
SWN2="mm8d"
SWCR=`cat documents/copyright`
SWV=`cat documents/VERSION`
# installer
echo -e "\n$SWN1 v$SWV prepare OS"
echo "$SWCR"
line
sleep 1
echo "Installing required components..."
sudo apt-get install apache2 \
build-essential \
git \
gnuplot \
libconfig-tiny-perl \
libfreetype6-dev \
libjpeg-dev \
libswitch-perl \
python3-daemon \
python3-dev \
python3-numpy \
python3-openssl \
python3-pip \
python3-requests \
python3-serial \
python3-setuptools \
python3-iniparse \
pip \
sudo \
wget
if [ "$ARCH" = "armhf" ]
then
sudo apt-get install python3-rpi.gpio
else
sudo pip install portio
fi
sudo pip install pymodbus
echo -e "\nSetting Apache2..."
sudo ln --force --symbolic /etc/apache2/mods-available/cgid.load /etc/apache2/mods-enabled/
sudo ln --force --symbolic /etc/apache2/mods-available/cgid.conf /etc/apache2/mods-enabled/
sudo ln --force --symbolic /etc/apache2/conf-available/serve-cgi-bin.conf /etc/apache2/conf-enabled/
sudo /etc/init.d/apache2 restart
echo -e "\nDone."