浏览代码

ptpd2: systemd support

Following package and sysv initscript naming scheme,
the service is "ptpd2" instead of just "ptpd" version 2.

[Thomas:
  - use relative symlink instead of an absolute symlink
  - remove the -s option, which redirects stdout, since systemd will
    take care of it
  - add the -g option, to be consistent with what the init script is
    using.]

Signed-off-by: Alex Suykov <alex.suykov@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Alex Suykov 10 年之前
父节点
当前提交
6e060b9c83
共有 2 个文件被更改,包括 18 次插入0 次删除
  1. 8 0
      package/ptpd2/ptpd2.mk
  2. 10 0
      package/ptpd2/ptpd2.service

+ 8 - 0
package/ptpd2/ptpd2.mk

@@ -29,4 +29,12 @@ define PTPD2_INSTALL_INIT_SYSV
 		$(TARGET_DIR)/etc/init.d/S65ptpd2
 endef
 
+define PTPD2_INSTALL_INIT_SYSTEMD
+	$(INSTALL) -D -m 644 package/ptpd2/ptpd2.service \
+		$(TARGET_DIR)/usr/lib/systemd/system/ptpd2.service
+	mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants
+	ln -sf ../../../../usr/lib/systemd/system/ptpd2.service \
+		$(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/ptpd2.service
+endef
+
 $(eval $(autotools-package))

+ 10 - 0
package/ptpd2/ptpd2.service

@@ -0,0 +1,10 @@
+[Unit]
+Description=Precision Time Protocol daemon
+After=syslog.target network.target
+
+[Service]
+ExecStart=/usr/sbin/ptpd2 -C -g
+Restart=always
+
+[Install]
+WantedBy=multi-user.target