浏览代码

tinyhttpd: systemd support

[Thomas: use relative symlink.]

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

+ 8 - 0
package/tinyhttpd/tinyhttpd.mk

@@ -24,4 +24,12 @@ define TINYHTTPD_INSTALL_INIT_SYSV
 		$(TARGET_DIR)/etc/init.d/S85tinyhttpd
 endef
 
+define TINYHTTPD_INSTALL_INIT_SYSTEMD
+	$(INSTALL) -D -m 644 package/tinyhttpd/tinyhttpd.service \
+		$(TARGET_DIR)/usr/lib/systemd/system/tinyhttpd.service
+	mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants
+	ln -sf ../../../../usr/lib/systemd/system/tinyhttpd.service \
+		$(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/tinyhttpd.service
+endef
+
 $(eval $(generic-package))

+ 10 - 0
package/tinyhttpd/tinyhttpd.service

@@ -0,0 +1,10 @@
+[Unit]
+Description=Tiny HTTP daemon
+After=network.target
+
+[Service]
+ExecStart=/usr/sbin/tinyhttpd
+Restart=always
+
+[Install]
+WantedBy=multi-user.target