diff --git a/debian/arduino-router/DEBIAN/postinst b/debian/arduino-router/DEBIAN/postinst index cba8391..513bb85 100755 --- a/debian/arduino-router/DEBIAN/postinst +++ b/debian/arduino-router/DEBIAN/postinst @@ -1,5 +1,6 @@ #!/bin/sh -systemctl enable arduino-router -systemctl enable arduino-router-serial +systemctl enable arduino-router.service +systemctl enable arduino-router-serial.service +systemctl enable arduino-router-serial.path diff --git a/debian/arduino-router/DEBIAN/prerm b/debian/arduino-router/DEBIAN/prerm index 193d5be..4525de0 100755 --- a/debian/arduino-router/DEBIAN/prerm +++ b/debian/arduino-router/DEBIAN/prerm @@ -1,5 +1,6 @@ #!/bin/sh -systemctl disable arduino-router -systemctl disable arduino-router-serial +systemctl disable arduino-router.service +systemctl disable arduino-router-serial.service +systemctl disable arduino-router-serial.path diff --git a/debian/arduino-router/etc/systemd/system/arduino-router-serial.path b/debian/arduino-router/etc/systemd/system/arduino-router-serial.path new file mode 100644 index 0000000..e49ee7e --- /dev/null +++ b/debian/arduino-router/etc/systemd/system/arduino-router-serial.path @@ -0,0 +1,8 @@ +[Unit] +Description=Watch for /dev/ttyGS0 to start arduino-router-serial + +[Path] +PathExists=/dev/ttyGS0 + +[Install] +WantedBy=multi-user.target diff --git a/debian/arduino-router/etc/systemd/system/arduino-router-serial.service b/debian/arduino-router/etc/systemd/system/arduino-router-serial.service index 59b127b..2895335 100644 --- a/debian/arduino-router/etc/systemd/system/arduino-router-serial.service +++ b/debian/arduino-router/etc/systemd/system/arduino-router-serial.service @@ -1,8 +1,9 @@ [Unit] Description=Proxy for the Arduino Router Monitor to ttyGS0 serial -After=network-online.target arduino-router.service -Wants=network-online.target arduino-router.service +After=network.target arduino-router.service +Wants=network.target arduino-router.service Requires=arduino-router.service +ConditionPathExists=/dev/ttyGS0 [Service] ExecStart=/usr/bin/socat file:/dev/ttyGS0,raw,echo=0,b9600,crtscts=0 tcp:127.0.0.1:7500