Simplify install.sh script
requirements.txt also simplified
This commit is contained in:
parent
ca382c0f8a
commit
819c96c321
605
install.sh
605
install.sh
|
@ -18,6 +18,121 @@ if [ $# -eq 0 ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
set -x
|
||||||
|
# arg1: sudo or blank
|
||||||
|
function linux_install_deps {
|
||||||
|
$1 apt-get update
|
||||||
|
$1 apt-get install -y build-essential pkg-config bison flex autoconf \
|
||||||
|
automake libtool make git python2.7 python-pip \
|
||||||
|
sqlite3 cmake git
|
||||||
|
}
|
||||||
|
|
||||||
|
function install_py_deps {
|
||||||
|
$1 pip install -r requirements.txt
|
||||||
|
}
|
||||||
|
|
||||||
|
function install_all_libs {
|
||||||
|
echo ""
|
||||||
|
echo "[MATIEC COMPILER]"
|
||||||
|
cd utils/matiec_src
|
||||||
|
autoreconf -i
|
||||||
|
./configure
|
||||||
|
make
|
||||||
|
cp ./iec2c ../../webserver/
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "Error compiling MatIEC"
|
||||||
|
echo "OpenPLC was NOT installed!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
cd ../..
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "[ST OPTIMIZER]"
|
||||||
|
cd utils/st_optimizer_src
|
||||||
|
g++ st_optimizer.cpp -o st_optimizer
|
||||||
|
cp ./st_optimizer ../../webserver/
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "Error compiling ST Optimizer"
|
||||||
|
echo "OpenPLC was NOT installed!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
cd ../..
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "[GLUE GENERATOR]"
|
||||||
|
cd utils/glue_generator_src
|
||||||
|
g++ glue_generator.cpp -o glue_generator
|
||||||
|
cp ./glue_generator ../../webserver/core
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "Error compiling Glue Generator"
|
||||||
|
echo "OpenPLC was NOT installed!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
cd ../..
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "[OPEN DNP3]"
|
||||||
|
cd utils/dnp3_src
|
||||||
|
echo "creating swapfile..."
|
||||||
|
$1 dd if=/dev/zero of=swapfile bs=1M count=1000
|
||||||
|
$1 mkswap swapfile
|
||||||
|
$1 swapon swapfile
|
||||||
|
cmake ../dnp3_src
|
||||||
|
make
|
||||||
|
$1 make install
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "Error installing OpenDNP3"
|
||||||
|
echo "OpenPLC was NOT installed!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
$1 ldconfig
|
||||||
|
echo "removing swapfile..."
|
||||||
|
$1 swapoff swapfile
|
||||||
|
$1 rm -f ./swapfile
|
||||||
|
cd ../..
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "[LIBMODBUS]"
|
||||||
|
cd utils/libmodbus_src
|
||||||
|
./autogen.sh
|
||||||
|
./configure
|
||||||
|
$1 make install
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "Error installing Libmodbus"
|
||||||
|
echo "OpenPLC was NOT installed!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
$1 ldconfig
|
||||||
|
cd ../..
|
||||||
|
|
||||||
|
if [ "$1" == "sudo" ]; then
|
||||||
|
echo ""
|
||||||
|
echo "[OPENPLC SERVICE]"
|
||||||
|
WORKING_DIR=$(pwd)
|
||||||
|
echo -e "[Unit]\n\
|
||||||
|
Description=OpenPLC Service\n\
|
||||||
|
After=network.target\n\
|
||||||
|
\n\
|
||||||
|
[Service]\n\
|
||||||
|
Type=simple\n\
|
||||||
|
Restart=always\n\
|
||||||
|
RestartSec=1\n\
|
||||||
|
User=root\n\
|
||||||
|
Group=root\n\
|
||||||
|
WorkingDirectory=$WORKING_DIR\n\
|
||||||
|
ExecStart=$WORKING_DIR/start_openplc.sh\n\
|
||||||
|
\n\
|
||||||
|
[Install]\n\
|
||||||
|
WantedBy=multi-user.target" >> openplc.service
|
||||||
|
$1 cp -rf ./openplc.service /lib/systemd/system/
|
||||||
|
rm -rf openplc.service
|
||||||
|
$1 "Enabling OpenPLC Service..."
|
||||||
|
$1 systemctl daemon-reload
|
||||||
|
$1 systemctl enable openplc
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if [ "$1" == "win" ]; then
|
if [ "$1" == "win" ]; then
|
||||||
echo "Installing OpenPLC on Windows"
|
echo "Installing OpenPLC on Windows"
|
||||||
cp ./utils/apt-cyg/apt-cyg ./
|
cp ./utils/apt-cyg/apt-cyg ./
|
||||||
|
@ -103,115 +218,14 @@ if [ "$1" == "win" ]; then
|
||||||
cp ./start_openplc.sh ../../
|
cp ./start_openplc.sh ../../
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
elif [ "$1" == "linux" ]; then
|
elif [ "$1" == "linux" ]; then
|
||||||
echo "Installing OpenPLC on Linux"
|
echo "Installing OpenPLC on Linux"
|
||||||
sudo apt-get update
|
linux_install_deps sudo
|
||||||
sudo apt-get install build-essential pkg-config bison flex autoconf automake libtool make git python2.7 python-pip sqlite3 cmake
|
|
||||||
pip install flask
|
install_py_deps
|
||||||
pip install flask-login
|
install_py_deps sudo
|
||||||
pip install pyserial
|
|
||||||
#make sure that packages are also installed for the super user
|
|
||||||
sudo -H pip install flask
|
|
||||||
sudo -H pip install flask-login
|
|
||||||
sudo -H pip install pyserial
|
|
||||||
|
|
||||||
echo ""
|
install_all_libs sudo
|
||||||
echo "[MATIEC COMPILER]"
|
|
||||||
cd utils/matiec_src
|
|
||||||
autoreconf -i
|
|
||||||
./configure
|
|
||||||
make
|
|
||||||
cp ./iec2c ../../webserver/
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "Error compiling MatIEC"
|
|
||||||
echo "OpenPLC was NOT installed!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
cd ../..
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "[ST OPTIMIZER]"
|
|
||||||
cd utils/st_optimizer_src
|
|
||||||
g++ st_optimizer.cpp -o st_optimizer
|
|
||||||
cp ./st_optimizer ../../webserver/
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "Error compiling ST Optimizer"
|
|
||||||
echo "OpenPLC was NOT installed!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
cd ../..
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "[GLUE GENERATOR]"
|
|
||||||
cd utils/glue_generator_src
|
|
||||||
g++ glue_generator.cpp -o glue_generator
|
|
||||||
cp ./glue_generator ../../webserver/core
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "Error compiling Glue Generator"
|
|
||||||
echo "OpenPLC was NOT installed!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
cd ../..
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "[OPEN DNP3]"
|
|
||||||
cd utils/dnp3_src
|
|
||||||
echo "creating swapfile..."
|
|
||||||
sudo dd if=/dev/zero of=swapfile bs=1M count=1000
|
|
||||||
sudo mkswap swapfile
|
|
||||||
sudo swapon swapfile
|
|
||||||
cmake ../dnp3_src
|
|
||||||
make
|
|
||||||
sudo make install
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "Error installing OpenDNP3"
|
|
||||||
echo "OpenPLC was NOT installed!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
sudo ldconfig
|
|
||||||
echo "removing swapfile..."
|
|
||||||
sudo swapoff swapfile
|
|
||||||
sudo rm -f ./swapfile
|
|
||||||
cd ../..
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "[LIBMODBUS]"
|
|
||||||
cd utils/libmodbus_src
|
|
||||||
./autogen.sh
|
|
||||||
./configure
|
|
||||||
sudo make install
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "Error installing Libmodbus"
|
|
||||||
echo "OpenPLC was NOT installed!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
sudo ldconfig
|
|
||||||
cd ../..
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "[OPENPLC SERVICE]"
|
|
||||||
WORKING_DIR=$(pwd)
|
|
||||||
echo -e "[Unit]\n\
|
|
||||||
Description=OpenPLC Service\n\
|
|
||||||
After=network.target\n\
|
|
||||||
\n\
|
|
||||||
[Service]\n\
|
|
||||||
Type=simple\n\
|
|
||||||
Restart=always\n\
|
|
||||||
RestartSec=1\n\
|
|
||||||
User=root\n\
|
|
||||||
Group=root\n\
|
|
||||||
WorkingDirectory=$WORKING_DIR\n\
|
|
||||||
ExecStart=$WORKING_DIR/start_openplc.sh\n\
|
|
||||||
\n\
|
|
||||||
[Install]\n\
|
|
||||||
WantedBy=multi-user.target" >> openplc.service
|
|
||||||
sudo cp -rf ./openplc.service /lib/systemd/system/
|
|
||||||
rm -rf openplc.service
|
|
||||||
echo "Enabling OpenPLC Service..."
|
|
||||||
sudo systemctl daemon-reload
|
|
||||||
sudo systemctl enable openplc
|
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "[FINALIZING]"
|
echo "[FINALIZING]"
|
||||||
|
@ -223,79 +237,9 @@ WantedBy=multi-user.target" >> openplc.service
|
||||||
|
|
||||||
elif [ "$1" == "docker" ]; then
|
elif [ "$1" == "docker" ]; then
|
||||||
echo "Installing OpenPLC on Linux inside Docker"
|
echo "Installing OpenPLC on Linux inside Docker"
|
||||||
|
linux_install_deps
|
||||||
echo ""
|
install_py_deps
|
||||||
echo "[MATIEC COMPILER]"
|
install_all_libs
|
||||||
cd utils/matiec_src
|
|
||||||
autoreconf -i
|
|
||||||
./configure
|
|
||||||
make
|
|
||||||
cp ./iec2c ../../webserver/
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "Error compiling MatIEC"
|
|
||||||
echo "OpenPLC was NOT installed!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
cd ../..
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "[ST OPTIMIZER]"
|
|
||||||
cd utils/st_optimizer_src
|
|
||||||
g++ st_optimizer.cpp -o st_optimizer
|
|
||||||
cp ./st_optimizer ../../webserver/
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "Error compiling ST Optimizer"
|
|
||||||
echo "OpenPLC was NOT installed!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
cd ../..
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "[GLUE GENERATOR]"
|
|
||||||
cd utils/glue_generator_src
|
|
||||||
g++ glue_generator.cpp -o glue_generator
|
|
||||||
cp ./glue_generator ../../webserver/core
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "Error compiling Glue Generator"
|
|
||||||
echo "OpenPLC was NOT installed!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
cd ../..
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "[OPEN DNP3]"
|
|
||||||
cd utils/dnp3_src
|
|
||||||
echo "creating swapfile..."
|
|
||||||
dd if=/dev/zero of=swapfile bs=1M count=1000
|
|
||||||
mkswap swapfile
|
|
||||||
swapon swapfile
|
|
||||||
cmake ../dnp3_src
|
|
||||||
make
|
|
||||||
make install
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "Error installing OpenDNP3"
|
|
||||||
echo "OpenPLC was NOT installed!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
ldconfig
|
|
||||||
echo "removing swapfile..."
|
|
||||||
swapoff swapfile
|
|
||||||
rm -f ./swapfile
|
|
||||||
cd ../..
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "[LIBMODBUS]"
|
|
||||||
cd utils/libmodbus_src
|
|
||||||
./autogen.sh
|
|
||||||
./configure
|
|
||||||
make install
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "Error installing Libmodbus"
|
|
||||||
echo "OpenPLC was NOT installed!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
ldconfig
|
|
||||||
cd ../..
|
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "[FINALIZING]"
|
echo "[FINALIZING]"
|
||||||
|
@ -306,112 +250,13 @@ elif [ "$1" == "docker" ]; then
|
||||||
|
|
||||||
elif [ "$1" == "rpi" ]; then
|
elif [ "$1" == "rpi" ]; then
|
||||||
echo "Installing OpenPLC on Raspberry Pi"
|
echo "Installing OpenPLC on Raspberry Pi"
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install build-essential pkg-config bison flex autoconf automake libtool make git python2.7 python-pip sqlite3 cmake wiringpi
|
linux_install_deps sudo
|
||||||
pip install flask
|
|
||||||
pip install flask-login
|
install_py_deps
|
||||||
pip install pyserial
|
install_py_deps sudo
|
||||||
#make sure that packages are also installed for the super user
|
|
||||||
sudo -H pip install flask
|
|
||||||
sudo -H pip install flask-login
|
|
||||||
sudo -H pip install pyserial
|
|
||||||
|
|
||||||
echo ""
|
install_all_libs sudo
|
||||||
echo "[MATIEC COMPILER]"
|
|
||||||
cd utils/matiec_src
|
|
||||||
autoreconf -i
|
|
||||||
./configure
|
|
||||||
make
|
|
||||||
cp ./iec2c ../../webserver/
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "Error compiling MatIEC"
|
|
||||||
echo "OpenPLC was NOT installed!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
cd ../..
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "[ST OPTIMIZER]"
|
|
||||||
cd utils/st_optimizer_src
|
|
||||||
g++ st_optimizer.cpp -o st_optimizer
|
|
||||||
cp ./st_optimizer ../../webserver/
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "Error compiling ST Optimizer"
|
|
||||||
echo "OpenPLC was NOT installed!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
cd ../..
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "[GLUE GENERATOR]"
|
|
||||||
cd utils/glue_generator_src
|
|
||||||
g++ glue_generator.cpp -o glue_generator
|
|
||||||
cp ./glue_generator ../../webserver/core
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "Error compiling Glue Generator"
|
|
||||||
echo "OpenPLC was NOT installed!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
cd ../..
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "[OPEN DNP3]"
|
|
||||||
cd utils/dnp3_src
|
|
||||||
echo "creating swapfile..."
|
|
||||||
sudo dd if=/dev/zero of=swapfile bs=1M count=1000
|
|
||||||
sudo mkswap swapfile
|
|
||||||
sudo swapon swapfile
|
|
||||||
cmake ../dnp3_src
|
|
||||||
make
|
|
||||||
sudo make install
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "Error installing OpenDNP3"
|
|
||||||
echo "OpenPLC was NOT installed!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
sudo ldconfig
|
|
||||||
echo "removing swapfile..."
|
|
||||||
sudo swapoff swapfile
|
|
||||||
sudo rm -f ./swapfile
|
|
||||||
cd ../..
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "[LIBMODBUS]"
|
|
||||||
cd utils/libmodbus_src
|
|
||||||
./autogen.sh
|
|
||||||
./configure
|
|
||||||
sudo make install
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "Error installing Libmodbus"
|
|
||||||
echo "OpenPLC was NOT installed!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
sudo ldconfig
|
|
||||||
cd ../..
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "[OPENPLC SERVICE]"
|
|
||||||
WORKING_DIR=$(pwd)
|
|
||||||
echo -e "[Unit]\n\
|
|
||||||
Description=OpenPLC Service\n\
|
|
||||||
After=network.target\n\
|
|
||||||
\n\
|
|
||||||
[Service]\n\
|
|
||||||
Type=simple\n\
|
|
||||||
Restart=always\n\
|
|
||||||
RestartSec=1\n\
|
|
||||||
User=root\n\
|
|
||||||
Group=root\n\
|
|
||||||
WorkingDirectory=$WORKING_DIR\n\
|
|
||||||
ExecStart=$WORKING_DIR/start_openplc.sh\n\
|
|
||||||
\n\
|
|
||||||
[Install]\n\
|
|
||||||
WantedBy=multi-user.target" >> openplc.service
|
|
||||||
sudo cp -rf ./openplc.service /lib/systemd/system/
|
|
||||||
rm -rf openplc.service
|
|
||||||
echo "Enabling OpenPLC Service..."
|
|
||||||
sudo systemctl daemon-reload
|
|
||||||
sudo systemctl enable openplc
|
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "[FINALIZING]"
|
echo "[FINALIZING]"
|
||||||
|
@ -424,121 +269,12 @@ WantedBy=multi-user.target" >> openplc.service
|
||||||
|
|
||||||
elif [ "$1" == "neuron" ]; then
|
elif [ "$1" == "neuron" ]; then
|
||||||
echo "Installing OpenPLC on UniPi Neuron PLC"
|
echo "Installing OpenPLC on UniPi Neuron PLC"
|
||||||
sudo apt-get update
|
linux_install_deps sudo
|
||||||
sudo apt-get install build-essential pkg-config bison flex autoconf automake libtool make git python2.7 python-pip sqlite3 cmake
|
|
||||||
pip install flask
|
install_py_deps
|
||||||
pip install flask-login
|
install_py_deps sudo
|
||||||
pip install pyserial
|
|
||||||
#make sure that packages are also installed for the super user
|
|
||||||
sudo -H pip install flask
|
|
||||||
sudo -H pip install flask-login
|
|
||||||
sudo -H pip install pyserial
|
|
||||||
|
|
||||||
echo ""
|
install_all_libs sudo
|
||||||
echo "[MATIEC COMPILER]"
|
|
||||||
cd utils/matiec_src
|
|
||||||
autoreconf -i
|
|
||||||
./configure
|
|
||||||
make
|
|
||||||
cp ./iec2c ../../webserver/
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "Error compiling MatIEC"
|
|
||||||
echo "OpenPLC was NOT installed!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
cd ../..
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "[ST OPTIMIZER]"
|
|
||||||
cd utils/st_optimizer_src
|
|
||||||
g++ st_optimizer.cpp -o st_optimizer
|
|
||||||
cp ./st_optimizer ../../webserver/
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "Error compiling ST Optimizer"
|
|
||||||
echo "OpenPLC was NOT installed!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
cd ../..
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "[GLUE GENERATOR]"
|
|
||||||
cd utils/glue_generator_src
|
|
||||||
g++ glue_generator.cpp -o glue_generator
|
|
||||||
cp ./glue_generator ../../webserver/core
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "Error compiling Glue Generator"
|
|
||||||
echo "OpenPLC was NOT installed!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
cd ../..
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "[OPEN DNP3]"
|
|
||||||
cd utils/dnp3_src
|
|
||||||
echo "creating swapfile..."
|
|
||||||
sudo dd if=/dev/zero of=swapfile bs=1M count=1000
|
|
||||||
sudo mkswap swapfile
|
|
||||||
sudo swapon swapfile
|
|
||||||
cmake ../dnp3_src
|
|
||||||
make
|
|
||||||
sudo make install
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "Error installing OpenDNP3"
|
|
||||||
echo "OpenPLC was NOT installed!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
sudo ldconfig
|
|
||||||
echo "removing swapfile..."
|
|
||||||
sudo swapoff swapfile
|
|
||||||
sudo rm -f ./swapfile
|
|
||||||
cd ../..
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "[LIBMODBUS]"
|
|
||||||
cd utils/libmodbus_src
|
|
||||||
./autogen.sh
|
|
||||||
./configure
|
|
||||||
sudo make install
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "Error installing Libmodbus"
|
|
||||||
echo "OpenPLC was NOT installed!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
sudo ldconfig
|
|
||||||
cd ../..
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "[DISABLING UNIPI SERVICES]"
|
|
||||||
sudo systemctl stop neuronhost.service
|
|
||||||
sudo systemctl disable neuronhost.service
|
|
||||||
sudo systemctl stop neurontcp.service
|
|
||||||
sudo systemctl disable neurontcp.service
|
|
||||||
sudo systemctl stop evok.service
|
|
||||||
sudo systemctl disable evok.service
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "[OPENPLC SERVICE]"
|
|
||||||
WORKING_DIR=$(pwd)
|
|
||||||
echo -e "[Unit]\n\
|
|
||||||
Description=OpenPLC Service\n\
|
|
||||||
After=network.target\n\
|
|
||||||
\n\
|
|
||||||
[Service]\n\
|
|
||||||
Type=simple\n\
|
|
||||||
Restart=always\n\
|
|
||||||
RestartSec=1\n\
|
|
||||||
User=root\n\
|
|
||||||
Group=root\n\
|
|
||||||
WorkingDirectory=$WORKING_DIR\n\
|
|
||||||
ExecStart=$WORKING_DIR/start_openplc.sh\n\
|
|
||||||
\n\
|
|
||||||
[Install]\n\
|
|
||||||
WantedBy=multi-user.target" >> openplc.service
|
|
||||||
sudo cp -rf ./openplc.service /lib/systemd/system/
|
|
||||||
rm -rf openplc.service
|
|
||||||
echo "Enabling OpenPLC Service..."
|
|
||||||
sudo systemctl daemon-reload
|
|
||||||
sudo systemctl enable openplc
|
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "[FINALIZING]"
|
echo "[FINALIZING]"
|
||||||
|
@ -552,78 +288,7 @@ WantedBy=multi-user.target" >> openplc.service
|
||||||
elif [ "$1" == "custom" ]; then
|
elif [ "$1" == "custom" ]; then
|
||||||
echo "Installing OpenPLC on Custom Platform"
|
echo "Installing OpenPLC on Custom Platform"
|
||||||
|
|
||||||
echo ""
|
install_all_libs
|
||||||
echo "[MATIEC COMPILER]"
|
|
||||||
cd utils/matiec_src
|
|
||||||
autoreconf -i
|
|
||||||
./configure
|
|
||||||
make
|
|
||||||
cp ./iec2c ../../webserver/
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "Error compiling MatIEC"
|
|
||||||
echo "OpenPLC was NOT installed!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
cd ../..
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "[ST OPTIMIZER]"
|
|
||||||
cd utils/st_optimizer_src
|
|
||||||
g++ st_optimizer.cpp -o st_optimizer
|
|
||||||
cp ./st_optimizer ../../webserver/
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "Error compiling ST Optimizer"
|
|
||||||
echo "OpenPLC was NOT installed!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
cd ../..
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "[GLUE GENERATOR]"
|
|
||||||
cd utils/glue_generator_src
|
|
||||||
g++ glue_generator.cpp -o glue_generator
|
|
||||||
cp ./glue_generator ../../webserver/core
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "Error compiling Glue Generator"
|
|
||||||
echo "OpenPLC was NOT installed!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
cd ../..
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "[OPEN DNP3]"
|
|
||||||
cd utils/dnp3_src
|
|
||||||
echo "creating swapfile..."
|
|
||||||
sudo dd if=/dev/zero of=swapfile bs=1M count=1000
|
|
||||||
sudo mkswap swapfile
|
|
||||||
sudo swapon swapfile
|
|
||||||
cmake ../dnp3_src -DFULL=ON -DCMAKE_INSTALL_PREFIX=/usr
|
|
||||||
make
|
|
||||||
sudo make install
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "Error installing OpenDNP3"
|
|
||||||
echo "OpenPLC was NOT installed!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
sudo ldconfig
|
|
||||||
echo "removing swapfile..."
|
|
||||||
sudo swapoff swapfile
|
|
||||||
sudo rm -f ./swapfile
|
|
||||||
cd ../..
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "[LIBMODBUS]"
|
|
||||||
cd utils/libmodbus_src
|
|
||||||
./autogen.sh
|
|
||||||
./configure --prefix=/usr
|
|
||||||
sudo make install
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "Error installing Libmodbus"
|
|
||||||
echo "OpenPLC was NOT installed!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
sudo ldconfig
|
|
||||||
cd ../..
|
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "[FINALIZING]"
|
echo "[FINALIZING]"
|
||||||
|
|
|
@ -1,21 +1,4 @@
|
||||||
Click==7.0
|
|
||||||
cryptography==1.7.1
|
|
||||||
enum34==1.1.6
|
|
||||||
Flask==1.0.2
|
Flask==1.0.2
|
||||||
Flask-Login==0.4.1
|
Flask-Login==0.4.1
|
||||||
idna==2.2
|
|
||||||
ipaddress==1.0.17
|
|
||||||
itsdangerous==1.1.0
|
|
||||||
Jinja2==2.10
|
|
||||||
keyring==10.1
|
|
||||||
keyrings.alt==1.3
|
|
||||||
MarkupSafe==1.1.0
|
|
||||||
pyasn1==0.1.9
|
|
||||||
pycrypto==2.6.1
|
|
||||||
pygobject==3.22.0
|
|
||||||
pyserial==3.4
|
pyserial==3.4
|
||||||
pyxdg==0.25
|
|
||||||
SecretStorage==2.3.1
|
|
||||||
six==1.10.0
|
|
||||||
Werkzeug==0.14.1
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue