From bc5c64571ac6f7503f1a9f97a75f258a33e66ed4 Mon Sep 17 00:00:00 2001 From: Javier Viguera Date: Tue, 7 May 2019 18:09:17 +0200 Subject: [PATCH] busybox http: add systemd service Currently in a systemd based init, the httpd server is not launched. A systemd service is needed, so add it. Also install a CGI script that allows to use the device for the NetworkManager connectivity check. https://jira.digi.com/browse/DEL-6577 Signed-off-by: Javier Viguera --- .../busybox/busybox/busybox-httpd.service.in | 12 ++++++++++++ meta-digi-dey/recipes-core/busybox/busybox/nm | 6 ++++++ .../recipes-core/busybox/busybox_1.29.%.bbappend | 14 ++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 meta-digi-dey/recipes-core/busybox/busybox/busybox-httpd.service.in create mode 100644 meta-digi-dey/recipes-core/busybox/busybox/nm diff --git a/meta-digi-dey/recipes-core/busybox/busybox/busybox-httpd.service.in b/meta-digi-dey/recipes-core/busybox/busybox/busybox-httpd.service.in new file mode 100644 index 000000000..33593fc7b --- /dev/null +++ b/meta-digi-dey/recipes-core/busybox/busybox/busybox-httpd.service.in @@ -0,0 +1,12 @@ +[Unit] +Description=Busybox HTTP daemon +After=network.target + +[Service] +Type=forking +ExecStart=@sbindir@/httpd -h /srv/www +Restart=always +RestartSec=5 + +[Install] +WantedBy=multi-user.target diff --git a/meta-digi-dey/recipes-core/busybox/busybox/nm b/meta-digi-dey/recipes-core/busybox/busybox/nm new file mode 100644 index 000000000..10f8c1053 --- /dev/null +++ b/meta-digi-dey/recipes-core/busybox/busybox/nm @@ -0,0 +1,6 @@ +#!/bin/sh + +printf "Content-Type: text/plain; charset=utf-8\r\n" +printf "X-NetworkManager-Status: online\r\n" +printf "\r\n" +printf "NetworkManager is online\r\n" diff --git a/meta-digi-dey/recipes-core/busybox/busybox_1.29.%.bbappend b/meta-digi-dey/recipes-core/busybox/busybox_1.29.%.bbappend index 680b46a97..b1aabfeb7 100644 --- a/meta-digi-dey/recipes-core/busybox/busybox_1.29.%.bbappend +++ b/meta-digi-dey/recipes-core/busybox/busybox_1.29.%.bbappend @@ -8,6 +8,8 @@ SRC_URI += "file://standby \ file://busybox-ntpd \ file://index.html \ file://digi-logo.png \ + file://busybox-httpd.service.in \ + file://nm \ file://busybox-acpid \ file://acpid.map \ file://pswitch-standby \ @@ -22,6 +24,11 @@ INITSCRIPT_PARAMS_${PN}-hwclock = "start 20 S . stop 20 0 6 ." FILES_${PN}_append = " ${systemd_unitdir}/system-sleep/" +# HTTPD package +FILES_${PN}-httpd_append = " ${systemd_unitdir}/system/busybox-httpd.service" +SYSTEMD_PACKAGES += "${PN}-httpd" +SYSTEMD_SERVICE_${PN}-httpd = "busybox-httpd.service" + # NTPD package PACKAGES =+ "${PN}-ntpd" FILES_${PN}-ntpd = "${sysconfdir}/init.d/busybox-ntpd" @@ -46,8 +53,15 @@ do_install_append() { install -m 0755 ${WORKDIR}/busybox-ntpd ${D}${sysconfdir}/init.d/ fi if grep "CONFIG_HTTPD=y" ${WORKDIR}/defconfig; then + install -d ${D}/srv/www/cgi-bin install -m 0644 ${WORKDIR}/index.html ${D}/srv/www/ install -m 0644 ${WORKDIR}/digi-logo.png ${D}/srv/www/ + install -m 0755 ${WORKDIR}/nm ${D}/srv/www/cgi-bin/ + if ${HAS_SYSTEMD}; then + install -d ${D}${systemd_unitdir}/system + sed 's,@sbindir@,${sbindir},g' < ${WORKDIR}/busybox-httpd.service.in \ + > ${D}${systemd_unitdir}/system/busybox-httpd.service + fi fi # Install one standby script or another depending on having systemd or not if ${HAS_SYSTEMD}; then