posaune
[projects.git] / debian / eibd.postinst
1 #!/bin/bash
2 set -e
3
4 # On Raspberry if a tpuart works on /dev/ttyAMA0, some services have to be deactivated
5 # see: https://busware.de/tiki-index.php?page=ROT_Installation
6 if [ -e /dev/ttyAMA0 ]
7 then
8         if grep ttyAMA0 /etc/inittab
9         then
10                 grep -v ttyAMA0 /etc/inittab >/etc/inittab.tmp
11                 mv /etc/inittab.tmp /etc/inittab
12         fi
13         if grep ttyAMA0 /etc/inittab
14         then
15                 grep -v ttyAMA0 /boot/cmdline.txt >/boot/cmdline.txt.tmp
16                 mv /boot/cmdline.txt.tmp /boot/cmdline.txt
17                 echo "--------------------- reboot system! ---------------------------"
18         fi
19         systemctl stop serial-getty@ttyAMA0.service
20         systemctl disable serial-getty@ttyAMA0.service
21         systemctl mask serial-getty@ttyAMA0.service
22 fi
23
24 systemctl enable eibd || true
25 systemctl start eibd || true
26