ptpd: systemd support
authorAlex Suykov <alex.suykov@gmail.com>
Sat, 23 May 2015 10:06:21 +0000 (13:06 +0300)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Tue, 14 Jul 2015 09:58:28 +0000 (11:58 +0200)
[Thomas:
   - use relative symbolic link instead of absolute one
   - remove the -S option, since redirecting stdout is not needed,
     it's already taken care of by systemd. Suggested by Maxime
     Hadjinlian.]

Signed-off-by: Alex Suykov <alex.suykov@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
package/ptpd/ptpd.mk
package/ptpd/ptpd.service [new file with mode: 0644]

index ac9ab985cadabf8250c8c6670e721124357a23dd..dad8ccfe10a553fb9f764165b9e49c8f75240a2c 100644 (file)
@@ -22,4 +22,12 @@ define PTPD_INSTALL_INIT_SYSV
                $(TARGET_DIR)/etc/init.d/S65ptpd
 endef
 
+define PTPD_INSTALL_INIT_SYSTEMD
+       $(INSTALL) -D -m 644 package/ptpd/ptpd.service \
+               $(TARGET_DIR)/usr/lib/systemd/system/ptpd.service
+       mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants
+       ln -sf ../../../../usr/lib/systemd/system/ptpd.service \
+               $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/ptpd.service
+endef
+
 $(eval $(generic-package))
diff --git a/package/ptpd/ptpd.service b/package/ptpd/ptpd.service
new file mode 100644 (file)
index 0000000..c9da3f4
--- /dev/null
@@ -0,0 +1,10 @@
+[Unit]
+Description=Precision Time Protocol daemon
+After=syslog.target network.target
+
+[Service]
+ExecStart=/usr/sbin/ptpd -c
+Restart=always
+
+[Install]
+WantedBy=multi-user.target