diff --git a/Dockerfile b/Dockerfile index 0b153d5..a512683 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,7 +11,7 @@ LABEL org.label-schema.build-date=$BUILD_DATE \ org.label-schema.vcs-ref=$VCS_REF #version -ENV HILSCHERNETPI_CODESYS_BASIS_VERSION 1.3.4 +ENV HILSCHERNETPI_CODESYS_BASIS_VERSION 1.3.5 #execute all commands as root USER root diff --git a/init.d/entrypoint.sh b/init.d/entrypoint.sh index b048ad8..a4cbc68 100755 --- a/init.d/entrypoint.sh +++ b/init.d/entrypoint.sh @@ -27,6 +27,12 @@ fi # SIGNAL-handler term_handler() { + #remove cifx0 interface from system if created by the container + if ps -A | grep -q "cifx0daemon" ; then + killall cifx0deamon + ip link delete cifx0 + fi + if [ -f /etc/init.d/edgegateway ] then echo "Terminating CODESYS Edge Gateway ..." @@ -58,22 +64,26 @@ fi #check presence of device spi0.0 and net device register if [[ -e "/dev/spidev0.0" ]]&& [[ -e "/dev/net/tun" ]]; then - echo "cifx0 hardware support (TCP/IP over RTE LAN ports) configured." + #check if cifx0 interface is not running already + if ! ip addr show | grep -q "cifx0" ; then - #pre-configure GPIO 24 to serve as interrupt pin between netX chip and BCM CPU - if [[ ! -e "/sys/class/gpio/gpio24" ]]; then - echo 24 > /sys/class/gpio/export - fi - echo rising > /sys/class/gpio/gpio24/edge - echo in > /sys/class/gpio/gpio24/direction - echo 1 > /sys/class/gpio/gpio24/active_low + echo "cifx0 hardware support (TCP/IP over RTE LAN ports) configured." + + #pre-configure GPIO 24 to serve as interrupt pin between netX chip and BCM CPU + if [[ ! -e "/sys/class/gpio/gpio24" ]]; then + echo 24 > /sys/class/gpio/export + fi + echo rising > /sys/class/gpio/gpio24/edge + echo in > /sys/class/gpio/gpio24/direction + echo 1 > /sys/class/gpio/gpio24/active_low - # create netx "cifx0" ethernet network interface - /opt/cifx/cifx0daemon + # create netx "cifx0" ethernet network interface + /opt/cifx/cifx0daemon - # bring interface up first of all - ip link set cifx0 up + # bring interface up first of all + ip link set cifx0 up + fi else echo "cifx0 hardware support (TCP/IP over RTE LAN ports) not configured." fi