Tested with Dockerfile
This commit is contained in:
parent
cf5feaea8a
commit
6a95336a9d
|
@ -1,6 +1,6 @@
|
|||
FROM ubuntu:18.04
|
||||
FROM debian
|
||||
|
||||
RUN apt-get update && apt-get install -y build-essential pkg-config bison flex autoconf automake libtool make git python2.7 python-pip sqlite3 cmake git
|
||||
RUN apt-get update && apt-get install -y build-essential pkg-config bison flex autoconf automake libtool make git python2.7 python-pip sqlite3 cmake git
|
||||
RUN pip install flask flask-login pyserial
|
||||
COPY . /workdir
|
||||
RUN cd /workdir && ./install.sh docker
|
||||
|
|
29
README.md
29
README.md
|
@ -4,21 +4,22 @@ The OpenPLC Project consists of three sub-projects:
|
|||
1. [Runtime](https://github.com/thiagoralves/OpenPLC_v3)
|
||||
2. [Programming editor](http://www.openplcproject.com/plcopen-editor)
|
||||
3. [HMI builder](http://www.openplcproject.com/reference-installing-scadabr)
|
||||
<br/>
|
||||
|
||||
To install:
|
||||
<br/>
|
||||
```bash
|
||||
git clone https://github.com/thiagoralves/OpenPLC_v3.git
|
||||
<br/>
|
||||
cd OpenPLC_v3
|
||||
<br/>
|
||||
./install.sh [platform]
|
||||
<br/>
|
||||
where [platform] can be:
|
||||
<br/>
|
||||
win - Install OpenPLC on Windows over Cygwin
|
||||
<br/>
|
||||
linux - Install OpenPLC on a Debian-based Linux distribution
|
||||
<br/>
|
||||
rpi - Install OpenPLC on a Raspberry Pi
|
||||
<br/>
|
||||
custom - Skip all specific package installation and tries to install OpenPLC assuming your system already has all dependencies met. This option can be useful if you're trying to install OpenPLC on an unsuported Linux platform or had manually installed all the dependency packages before.
|
||||
```
|
||||
|
||||
Where `[platform]` can be:
|
||||
|
||||
`win` - Install OpenPLC on Windows over Cygwin
|
||||
|
||||
`linux` - Install OpenPLC on a Debian-based Linux distribution
|
||||
|
||||
`docker` - Used by the `Dockerfile` (i.e. doesn't invoke `sudo`)
|
||||
|
||||
`rpi` - Install OpenPLC on a Raspberry Pi
|
||||
|
||||
`custom` - Skip all specific package installation and tries to install OpenPLC assuming your system already has all dependencies met. This option can be useful if you're trying to install OpenPLC on an unsuported Linux platform or had manually installed all the dependency packages before.
|
||||
|
|
65
install.sh
65
install.sh
|
@ -6,6 +6,7 @@ if [ $# -eq 0 ]; then
|
|||
echo "Usage: ./install.sh [platform] where [platform] can be"
|
||||
echo " win Install OpenPLC on Windows over Cygwin"
|
||||
echo " linux Install OpenPLC on a Debian-based Linux distribution"
|
||||
echo " docker Install OpenPLC in a Docker container"
|
||||
echo " rpi Install OpenPLC on a Raspberry Pi"
|
||||
echo " neuron Install OpenPLC on a UniPi Neuron PLC"
|
||||
echo " custom Skip all specific package installation and tries to install"
|
||||
|
@ -22,7 +23,7 @@ if [ "$1" == "win" ]; then
|
|||
cp ./utils/apt-cyg/apt-cyg ./
|
||||
cp ./utils/apt-cyg/wget.exe /bin
|
||||
install apt-cyg /bin
|
||||
apt-cyg install lynx
|
||||
apt-cyg install lynx
|
||||
rm -f /bin/wget.exe
|
||||
apt-cyg install wget gcc-core gcc-g++ git pkg-config automake autoconf libtool make python2 python2-pip sqlite3
|
||||
lynx -source https://bootstrap.pypa.io/get-pip.py > get-pip.py
|
||||
|
@ -30,7 +31,7 @@ if [ "$1" == "win" ]; then
|
|||
pip install flask
|
||||
pip install flask-login
|
||||
pip install pyserial
|
||||
|
||||
|
||||
echo ""
|
||||
echo "[MATIEC COMPILER]"
|
||||
cp ./utils/matiec_src/bin_win32/*.* ./webserver/
|
||||
|
@ -39,7 +40,7 @@ if [ "$1" == "win" ]; then
|
|||
echo "OpenPLC was NOT installed!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
echo ""
|
||||
echo "[ST OPTIMIZER]"
|
||||
cd utils/st_optimizer_src
|
||||
|
@ -51,7 +52,7 @@ if [ "$1" == "win" ]; then
|
|||
exit 1
|
||||
fi
|
||||
cd ../..
|
||||
|
||||
|
||||
echo ""
|
||||
echo "[GLUE GENERATOR]"
|
||||
cd utils/glue_generator_src
|
||||
|
@ -63,7 +64,7 @@ if [ "$1" == "win" ]; then
|
|||
exit 1
|
||||
fi
|
||||
cd ../..
|
||||
|
||||
|
||||
echo ""
|
||||
echo "[OPEN DNP3]"
|
||||
cd webserver/core
|
||||
|
@ -80,7 +81,7 @@ if [ "$1" == "win" ]; then
|
|||
exit 1
|
||||
fi
|
||||
cd ../..
|
||||
|
||||
|
||||
echo ""
|
||||
echo "[LIBMODBUS]"
|
||||
cd utils/libmodbus_src
|
||||
|
@ -93,14 +94,14 @@ if [ "$1" == "win" ]; then
|
|||
exit 1
|
||||
fi
|
||||
cd ../..
|
||||
|
||||
|
||||
echo ""
|
||||
echo "[FINALIZING]"
|
||||
cd webserver/scripts
|
||||
./change_hardware_layer.sh blank
|
||||
./compile_program.sh blank_program.st
|
||||
cp ./start_openplc.sh ../../
|
||||
|
||||
|
||||
|
||||
|
||||
elif [ "$1" == "linux" ]; then
|
||||
|
@ -140,7 +141,7 @@ elif [ "$1" == "linux" ]; then
|
|||
exit 1
|
||||
fi
|
||||
cd ../..
|
||||
|
||||
|
||||
echo ""
|
||||
echo "[GLUE GENERATOR]"
|
||||
cd utils/glue_generator_src
|
||||
|
@ -152,7 +153,7 @@ elif [ "$1" == "linux" ]; then
|
|||
exit 1
|
||||
fi
|
||||
cd ../..
|
||||
|
||||
|
||||
echo ""
|
||||
echo "[OPEN DNP3]"
|
||||
cd utils/dnp3_src
|
||||
|
@ -173,7 +174,7 @@ elif [ "$1" == "linux" ]; then
|
|||
sudo swapoff swapfile
|
||||
sudo rm -f ./swapfile
|
||||
cd ../..
|
||||
|
||||
|
||||
echo ""
|
||||
echo "[LIBMODBUS]"
|
||||
cd utils/libmodbus_src
|
||||
|
@ -187,7 +188,7 @@ elif [ "$1" == "linux" ]; then
|
|||
fi
|
||||
sudo ldconfig
|
||||
cd ../..
|
||||
|
||||
|
||||
echo ""
|
||||
echo "[OPENPLC SERVICE]"
|
||||
WORKING_DIR=$(pwd)
|
||||
|
@ -218,8 +219,8 @@ WantedBy=multi-user.target" >> openplc.service
|
|||
./change_hardware_layer.sh blank_linux
|
||||
./compile_program.sh blank_program.st
|
||||
cp ./start_openplc.sh ../../
|
||||
|
||||
|
||||
|
||||
|
||||
elif [ "$1" == "docker" ]; then
|
||||
echo "Installing OpenPLC on Linux inside Docker"
|
||||
|
||||
|
@ -248,7 +249,7 @@ elif [ "$1" == "docker" ]; then
|
|||
exit 1
|
||||
fi
|
||||
cd ../..
|
||||
|
||||
|
||||
echo ""
|
||||
echo "[GLUE GENERATOR]"
|
||||
cd utils/glue_generator_src
|
||||
|
@ -260,7 +261,7 @@ elif [ "$1" == "docker" ]; then
|
|||
exit 1
|
||||
fi
|
||||
cd ../..
|
||||
|
||||
|
||||
echo ""
|
||||
echo "[OPEN DNP3]"
|
||||
cd utils/dnp3_src
|
||||
|
@ -314,7 +315,7 @@ elif [ "$1" == "rpi" ]; then
|
|||
sudo -H pip install flask
|
||||
sudo -H pip install flask-login
|
||||
sudo -H pip install pyserial
|
||||
|
||||
|
||||
echo ""
|
||||
echo "[MATIEC COMPILER]"
|
||||
cd utils/matiec_src
|
||||
|
@ -340,7 +341,7 @@ elif [ "$1" == "rpi" ]; then
|
|||
exit 1
|
||||
fi
|
||||
cd ../..
|
||||
|
||||
|
||||
echo ""
|
||||
echo "[GLUE GENERATOR]"
|
||||
cd utils/glue_generator_src
|
||||
|
@ -352,7 +353,7 @@ elif [ "$1" == "rpi" ]; then
|
|||
exit 1
|
||||
fi
|
||||
cd ../..
|
||||
|
||||
|
||||
echo ""
|
||||
echo "[OPEN DNP3]"
|
||||
cd utils/dnp3_src
|
||||
|
@ -373,7 +374,7 @@ elif [ "$1" == "rpi" ]; then
|
|||
sudo swapoff swapfile
|
||||
sudo rm -f ./swapfile
|
||||
cd ../..
|
||||
|
||||
|
||||
echo ""
|
||||
echo "[LIBMODBUS]"
|
||||
cd utils/libmodbus_src
|
||||
|
@ -387,7 +388,7 @@ elif [ "$1" == "rpi" ]; then
|
|||
fi
|
||||
sudo ldconfig
|
||||
cd ../..
|
||||
|
||||
|
||||
echo ""
|
||||
echo "[OPENPLC SERVICE]"
|
||||
WORKING_DIR=$(pwd)
|
||||
|
@ -458,7 +459,7 @@ elif [ "$1" == "neuron" ]; then
|
|||
exit 1
|
||||
fi
|
||||
cd ../..
|
||||
|
||||
|
||||
echo ""
|
||||
echo "[GLUE GENERATOR]"
|
||||
cd utils/glue_generator_src
|
||||
|
@ -470,7 +471,7 @@ elif [ "$1" == "neuron" ]; then
|
|||
exit 1
|
||||
fi
|
||||
cd ../..
|
||||
|
||||
|
||||
echo ""
|
||||
echo "[OPEN DNP3]"
|
||||
cd utils/dnp3_src
|
||||
|
@ -491,7 +492,7 @@ elif [ "$1" == "neuron" ]; then
|
|||
sudo swapoff swapfile
|
||||
sudo rm -f ./swapfile
|
||||
cd ../..
|
||||
|
||||
|
||||
echo ""
|
||||
echo "[LIBMODBUS]"
|
||||
cd utils/libmodbus_src
|
||||
|
@ -505,16 +506,16 @@ elif [ "$1" == "neuron" ]; then
|
|||
fi
|
||||
sudo ldconfig
|
||||
cd ../..
|
||||
|
||||
|
||||
echo ""
|
||||
echo "[DISABLING UNIPI SERVICES]"
|
||||
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)
|
||||
|
@ -550,7 +551,7 @@ WantedBy=multi-user.target" >> openplc.service
|
|||
|
||||
elif [ "$1" == "custom" ]; then
|
||||
echo "Installing OpenPLC on Custom Platform"
|
||||
|
||||
|
||||
echo ""
|
||||
echo "[MATIEC COMPILER]"
|
||||
cd utils/matiec_src
|
||||
|
@ -576,7 +577,7 @@ elif [ "$1" == "custom" ]; then
|
|||
exit 1
|
||||
fi
|
||||
cd ../..
|
||||
|
||||
|
||||
echo ""
|
||||
echo "[GLUE GENERATOR]"
|
||||
cd utils/glue_generator_src
|
||||
|
@ -588,7 +589,7 @@ elif [ "$1" == "custom" ]; then
|
|||
exit 1
|
||||
fi
|
||||
cd ../..
|
||||
|
||||
|
||||
echo ""
|
||||
echo "[OPEN DNP3]"
|
||||
cd utils/dnp3_src
|
||||
|
@ -609,7 +610,7 @@ elif [ "$1" == "custom" ]; then
|
|||
sudo swapoff swapfile
|
||||
sudo rm -f ./swapfile
|
||||
cd ../..
|
||||
|
||||
|
||||
echo ""
|
||||
echo "[LIBMODBUS]"
|
||||
cd utils/libmodbus_src
|
||||
|
@ -623,7 +624,7 @@ elif [ "$1" == "custom" ]; then
|
|||
fi
|
||||
sudo ldconfig
|
||||
cd ../..
|
||||
|
||||
|
||||
echo ""
|
||||
echo "[FINALIZING]"
|
||||
cd webserver/scripts
|
||||
|
|
Loading…
Reference in New Issue