changeset 186:db4b3a07a3dc

run pigpiod
author drewp@bigasterisk.com
date Fri, 07 Apr 2023 17:23:20 -0700
parents 781919a97c90
children 466108f0a509
files package_lists.py packages.py templates/pigpiod.service.j2
diffstat 3 files changed, 18 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/package_lists.py	Mon Mar 27 17:15:33 2023 -0700
+++ b/package_lists.py	Fri Apr 07 17:23:20 2023 -0700
@@ -18,6 +18,7 @@
     'apt-utils',
     'dirmngr',
     'gnupg2',
+    'pigpiod',
 ]
 general = [
     'apt-listchanges',
--- a/packages.py	Mon Mar 27 17:15:33 2023 -0700
+++ b/packages.py	Fri Apr 07 17:23:20 2023 -0700
@@ -1,6 +1,6 @@
 from pyinfra import host
 from pyinfra.facts.server import LinuxDistribution
-from pyinfra.operations import apt, files, server
+from pyinfra.operations import apt, files, server, systemd
 import package_lists
 
 is_pi = host.get_fact(LinuxDistribution)['name'] in ['Debian', 'Raspbian GNU/Linux']
@@ -80,4 +80,8 @@
 if not is_pi:
     apt.packages(packages=package_lists.non_pi, **kw)
     if host.name != 'prime': # couldn't get prime to install a newer version than 18.7.0
-        nodejs()
\ No newline at end of file
+        nodejs()
+else:
+    # move to another file?
+    files.template(src="templates/pigpiod.service.j2", dest=f"/etc/systemd/system/pigpiod.service")
+    systemd.service(service='pigpiod', daemon_reload=True, enabled=True)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/pigpiod.service.j2	Fri Apr 07 17:23:20 2023 -0700
@@ -0,0 +1,11 @@
+# written by pyinfra
+
+[Unit]
+Description=Daemon required to control GPIO pins via pigpio
+
+[Service]
+Type=simple
+ExecStart=/usr/bin/pigpiod -g -p 8888
+
+[Install]
+WantedBy=multi-user.target