comparison install.sh @ 23:7bca87ca06e4

Add script to create service, udev and serial-starter entries.
author Daniel O'Connor <darius@dons.net.au>
date Mon, 13 Dec 2021 15:51:41 +1030
parents
children 41eba85c0c84
comparison
equal deleted inserted replaced
22:02ba26698696 23:7bca87ca06e4
1 #!/bin/sh
2
3 root=$(cd $(dirname $0); pwd)
4
5 # Set VE_SERVICE for our serial cable to inform serial-starter about it
6 mkdir -p /etc/udev/rules.d
7 cat >/etc/udev/rules.d/eprodbus.rules <<EOF
8 ACTION=="add", ENV{ID_BUS}=="usb", ENV{ID_MODEL}=="FT232_epro", ENV{VE_SERVICE}="eprodbus"
9 EOF
10
11 # Tell serial starter to run our service
12 mkdir -p /data/conf/serial-starter.d
13 cat >/data/conf/serial-starter.d/eprodbus.conf <<EOF
14 service eprodbus eprodbus
15 EOF
16
17 # Create service template for running and logging
18 # Serial starter copies this to /service and pattern-replaces TTY
19 mkdir -p /opt/victronenergy/eprodbus/service/log /var/log/eprodbus
20 cat >/opt/victronenergy/eprodbus/service/run <<EOF
21 #!/bin/sh
22 exec 2>&1
23 exec /usr/bin/python $root/eprodbus.py TTY
24 EOF
25 cat <<EOF >/opt/victronenergy/eprodbus/service/log/run
26 #!/bin/sh
27 exec 2>&1
28 exec multilog t s25000 n4 /var/log/eprodbus.TTY
29 EOF
30 chmod 755 /opt/victronenergy/eprodbus/service/run /opt/victronenergy/eprodbus/service/log/run