From: Michael Wagner Date: Fri, 18 Jun 2021 21:05:59 +0000 (+0200) Subject: cpp-d1064d X-Git-Tag: eibd_0.0.5-1~1 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=ee527d876d2fc53161a1957830ea0d3cb0877350;p=projects.git cpp-d1064d --- diff --git a/debian/eibd.cp b/debian/eibd.cp index 786b51e..c6798a5 100755 --- a/debian/eibd.cp +++ b/debian/eibd.cp @@ -13,3 +13,13 @@ rsync -a ../build/debian/tmp/ debian/tmp/ cp ../build/bcusdk-0.0.5/debian/changelog debian/ cp ../build/bcusdk-0.0.5/debian/copyright debian/ +mkdir -p $1/etc +cp eibd/eibd.env $1/etc/eibd +echo "/etc/eibd" > $1/DEBIAN/conffiles + +mkdir -p $1/lib/systemd/system +cp eibd/eibd.service $1/lib/systemd/system/ + +mkdir -p $1/usr/sbin +cp eibd/start-eibd $1/usr/sbin/ + diff --git a/debian/eibd.postinst b/debian/eibd.postinst new file mode 100755 index 0000000..6f5684d --- /dev/null +++ b/debian/eibd.postinst @@ -0,0 +1,25 @@ +#!/bin/bash +set -e + +# On Raspberry if a tpuart works on /dev/ttyAMA0, some services have to be deactivated +# see: https://busware.de/tiki-index.php?page=ROT_Installation +if [ -e /dev/ttyAMA0 ] +then + if grep ttyAMA0 /etc/inittab + then + grep -v ttyAMA0 /etc/inittab >/etc/inittab.tmp + mv /etc/inittab.tmp /etc/inittab + fi + if grep ttyAMA0 /etc/inittab + then + grep -v ttyAMA0 /boot/cmdline.txt >/boot/cmdline.txt.tmp + mv /boot/cmdline.txt.tmp /boot/cmdline.txt + echo "--------------------- reboot system! ---------------------------" + fi + systemctl stop serial-getty@ttyAMA0.service + systemctl disable serial-getty@ttyAMA0.service +fi + +systemctl enable eibd || true +systemctl start eibd || true + diff --git a/eibd/eibd.env b/eibd/eibd.env new file mode 100644 index 0000000..4d9bf2d --- /dev/null +++ b/eibd/eibd.env @@ -0,0 +1,6 @@ +# individual address of eibd tunnelling instance +IND_ADDR="1.1.251" + +# additional eibd params +ADD_PARAM= + diff --git a/eibd/eibd.service b/eibd/eibd.service index 4aee24c..21b86ec 100644 --- a/eibd/eibd.service +++ b/eibd/eibd.service @@ -4,14 +4,10 @@ After=network.target syslog.service [Service] EnvironmentFile=/etc/eibd -#ExecStart=/usr/bin/eibd -iDTS -e $IND_ADDR tpuarts:$EIB_DEV -ExecStart=/home/debian10/tmp/start +ExecStart=/usr/sbin/start-eibd KillMode=process -#Restart=on-failure -RestartPreventExitStatus=255 -Type=simple +Type=forking -#[Install] -#WantedBy=multi-user.target -#Alias=sshd.service +[Install] +WantedBy=multiuser.target diff --git a/eibd/start-eibd b/eibd/start-eibd new file mode 100755 index 0000000..fc30bf0 --- /dev/null +++ b/eibd/start-eibd @@ -0,0 +1,26 @@ +#!/bin/bash +set -e + +if [ -e /dev/ttyAMA0 ] +then + EIB_URL="tpuarts:/dev/ttyAMA0" + # ttyAMA0 interferes with others. Check if everything is deactivated + if [ -f /etc/inittab ] + then + if grep ttyAMA0 /etc/inittab + then + echo "ttyAMA0 not deactivated. Run dpkg eibd --reconfigure." + exit 10 + fi + fi +elif [ -e /dev/ttyACM0 ] +then + EIB_URL="tpuarts:/dev/ttyACM0" +else + EIB_URL="ipt:127.0.0.1" +fi + +echo "running under $IND_ADDR" +echo "connect with $EIB_URL" +/usr/bin/eibd -i -DTS -e $IND_ADDR $ADD_PARAM $EIB_URL & +