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/
+
--- /dev/null
+#!/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
+
--- /dev/null
+# individual address of eibd tunnelling instance
+IND_ADDR="1.1.251"
+
+# additional eibd params
+ADD_PARAM=
+
[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
--- /dev/null
+#!/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 &
+