Skip to content

Commit cf17688

Browse files
committed
create cifx0 LAN if not existing already
1 parent d7379b6 commit cf17688

File tree

2 files changed

+23
-16
lines changed

2 files changed

+23
-16
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ LABEL org.label-schema.build-date=$BUILD_DATE \
1111
org.label-schema.vcs-ref=$VCS_REF
1212

1313
#version
14-
ENV HILSCHERNETPI_NETX_TCPIP_NETWORK_INTERFACE_VERSION 1.1.2
14+
ENV HILSCHERNETPI_NETX_TCPIP_NETWORK_INTERFACE_VERSION 1.1.3
1515

1616
#labeling
1717
LABEL maintainer="[email protected]" \

init.d/entrypoint.sh

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@ fi
2323
# SIGNAL-handler
2424
term_handler() {
2525

26-
#remove cifx0 interface from system
27-
killall cifx0deamon
28-
ip link delete cifx0
26+
#remove cifx0 interface from system if created by the container
27+
if ps -A | grep -q "cifx0daemon" ; then
28+
killall cifx0deamon
29+
ip link delete cifx0
30+
fi
2931

3032
exit 143; # 128 + 15 -- SIGTERM
3133
}
@@ -36,21 +38,26 @@ trap 'kill ${!}; term_handler' SIGINT SIGKILL SIGTERM SIGQUIT SIGTSTP SIGSTOP SI
3638
#check presence of device spi0.0 and net device register
3739
if [[ -e "/dev/spidev0.0" ]]&& [[ -e "/dev/net/tun" ]]; then
3840

39-
echo "Provisioning 'cifx0' interface now."
4041

41-
#pre-configure GPIO 24 to serve as interrupt pin between netX chip and BCM CPU
42-
if [[ ! -e "/sys/class/gpio/gpio24" ]]; then
43-
echo 24 > /sys/class/gpio/export
44-
fi
45-
echo rising > /sys/class/gpio/gpio24/edge
46-
echo in > /sys/class/gpio/gpio24/direction
47-
echo 1 > /sys/class/gpio/gpio24/active_low
42+
#check if cifx0 interface is not running already
43+
if ! ip addr show | grep -q "cifx0" ; then
44+
45+
echo "Provisioning 'cifx0' interface now."
4846

49-
# create netx "cifx0" ethernet network interface
50-
/opt/cifx/cifx0daemon
47+
#pre-configure GPIO 24 to serve as interrupt pin between netX chip and BCM CPU
48+
if [[ ! -e "/sys/class/gpio/gpio24" ]]; then
49+
echo 24 > /sys/class/gpio/export
50+
fi
51+
echo rising > /sys/class/gpio/gpio24/edge
52+
echo in > /sys/class/gpio/gpio24/direction
53+
echo 1 > /sys/class/gpio/gpio24/active_low
54+
55+
# create netx "cifx0" ethernet network interface
56+
/opt/cifx/cifx0daemon
5157

52-
# bring interface up now
53-
ip link set cifx0 up
58+
# bring interface up now
59+
ip link set cifx0 up
60+
fi
5461

5562
else
5663
echo "'cifx0' interface cannot be provisioned."

0 commit comments

Comments
 (0)