Add systemd unit for lighttpd
authorMaxime Ripard <maxime.ripard@free-electrons.com>
Sat, 28 Jul 2012 07:21:21 +0000 (09:21 +0200)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Mon, 30 Jul 2012 21:12:17 +0000 (23:12 +0200)
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
package/lighttpd/lighttpd.mk
package/lighttpd/lighttpd.service [new file with mode: 0644]

index 9f554cbc35681bd125fe04e0f587c5265166ee6c..c9decb18554cf0c904545544ad4112785ba19169 100644 (file)
@@ -87,13 +87,22 @@ endef
 
 LIGHTTPD_POST_INSTALL_TARGET_HOOKS += LIGHTTPD_INSTALL_CONFIG
 
-define LIGHTTPD_INSTALL_INIT_SCRIPT
+define LIGHTTPD_INSTALL_INIT_SYSV
        [ -f $(TARGET_DIR)/etc/init.d/S50lighttpd ] || \
                $(INSTALL) -D -m 755 package/lighttpd/S50lighttpd \
                        $(TARGET_DIR)/etc/init.d/S50lighttpd
 endef
 
-LIGHTTPD_POST_INSTALL_TARGET_HOOKS += LIGHTTPD_INSTALL_INIT_SCRIPT
+define LIGHTTPD_INSTALL_INIT_SYSTEMD
+       [ -f $(TARGET_DIR)/etc/systemd/system/lighttpd.service ] || \
+               $(INSTALL) -D -m 755 package/lighttpd/lighttpd.service \
+                       $(TARGET_DIR)/etc/systemd/system/lighttpd.service
+
+       mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants
+
+       ln -fs ../lighttpd.service \
+               $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/lighttpd.service
+endef
 
 define LIGHTTPD_UNINSTALL_TARGET_CMDS
        $(RM) $(TARGET_DIR)/usr/sbin/lighttpd
diff --git a/package/lighttpd/lighttpd.service b/package/lighttpd/lighttpd.service
new file mode 100644 (file)
index 0000000..0ca5357
--- /dev/null
@@ -0,0 +1,10 @@
+[Unit]
+Description=Lighttpd Web Server
+After=network.target
+
+[Service]
+ExecStart=/usr/sbin/lighttpd-angel -f /etc/lighttpd/lighttpd.conf -D
+ExecReload=/bin/kill -HUP $MAINPID
+
+[Install]
+WantedBy=multi-user.target