package/thttpd: fix systemd and sysvinit startup
cover package/thttpd: fix systemd and sysvinit startup
From: Carlos Santos <[email protected]>
- Patch 1 creates the configuration file as /etc/thttpd.conf, as expected by the systemd unit file.
- Patch 2 adds a working sysvinit script instead of installing the FreeBSD script provided by thttpd.
Carlos Santos (2):
package/thttpd: fix systemd startup
package/thttpd: fix init script
package/thttpd/S90thttpd | 54 ++++++++++++++++++++++++++++++++++++++++ package/thttpd/thttpd.mk | 15 +++++------ 2 files changed, 62 insertions(+), 7 deletions(-) create mode 100644 package/thttpd/S90thttpd
Signature · 1 line
2.18.1
PATCH 1/2 package/thttpd: fix systemd startup
From: Carlos Santos <[email protected]>
Create the configuration file as /etc/thttpd.conf, as expected by the systemd unit file.
This matches other web server packages that install configuration files at /etc/lighttpd/, /etc/apache2, etc.
--- package/thttpd/thttpd.mk | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
package/thttpd/thttpd.mk +6 -5
@@ -18,13 +18,14 @@ define THTTPD_INSTALL_TARGET_CMDS $(INSTALL) -D -m 0755 $(@D)/extras/syslogtocern $(TARGET_DIR)/usr/bin/syslogtocern $(INSTALL) -D -m 0755 $(@D)/scripts/thttpd_wrapper $(TARGET_DIR)/usr/sbin/thttpd_wrapper $(SED) 's:/usr/local/sbin:/usr/sbin:g' -e \ - 's:/usr/local/www:/var/www:g' $(TARGET_DIR)/usr/sbin/thttpd_wrapper + 's:/usr/local/www/thttpd_config:/etc/thttpd.conf:g' \ + $(TARGET_DIR)/usr/sbin/thttpd_wrapper $(INSTALL) -d $(TARGET_DIR)/var/www/data $(INSTALL) -d $(TARGET_DIR)/var/www/logs - echo "dir=/var/www/data" > $(TARGET_DIR)/var/www/thttpd_config - echo 'cgipat=**.cgi' >> $(TARGET_DIR)/var/www/thttpd_config - echo "logfile=/var/www/logs/thttpd_log" >> $(TARGET_DIR)/var/www/thttpd_config - echo "pidfile=/var/run/thttpd.pid" >> $(TARGET_DIR)/var/www/thttpd_config + echo "dir=/var/www/data" > $(TARGET_DIR)/etc/thttpd.conf + echo 'cgipat=**.cgi' >> $(TARGET_DIR)/etc/thttpd.conf + echo "logfile=/var/www/logs/thttpd_log" >> $(TARGET_DIR)/etc/thttpd.conf + echo "pidfile=/var/run/thttpd.pid" >> $(TARGET_DIR)/etc/thttpd.conf endef define THTTPD_INSTALL_INIT_SYSV
Signature · 1 line
2.18.1
Thomas Petazzoni
AppliedPATCH 1/2 package/thttpd: fix systemd startup
Quoted 5 lines · On Tue, 27 Aug 2019 23:16:25 -0300 unixmania at gmail.com wrote:
From: Carlos Santos <[email protected]>
Create the configuration file as
/etc/thttpd.conf, as expected by the systemd unit file.
Quoted 7 lines
This matches other web server packages that install configuration files at
/etc/lighttpd/,/etc/apache2, etc.Signed-off-by Carlos Santos <[email protected]>--- package/thttpd/thttpd.mk | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
Applied to master, thanks.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH 1/2 package/thttpd: fix systemd startup
Quoted 13 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Thomas" == Thomas Petazzoni <[email protected]> writes:
Quoted 8 lines · On Tue, 27 Aug 2019 23:16:25 -0300 unixmania at gmail.com wrote:
From: Carlos Santos <[email protected]>
Create the configuration file as
/etc/thttpd.conf, as expected by the systemd unit file.This matches other web server packages that install configuration files at
/etc/lighttpd/,/etc/apache2, etc.
Quoted 6 lines
Quoted 4 lines
Signed-off-by Carlos Santos <[email protected]>---
package/thttpd/thttpd.mk| 11 ++++++-----1 file changed, 6 insertions(+), 5 deletions(-)Applied to master, thanks.
Committed to 2019.02.x, 2019.05.x and 2019.08.x, thanks.
Signature · 1 line
Bye, Peter Korsgaard
PATCH 2/2 package/thttpd: fix init script
In reply to unixmania at gmail.comFrom: Carlos Santos <[email protected]>
The init script provided by thttpd is for FreeBSD. Add a custom one, maade specifically for Buirdroot.
--- package/thttpd/S90thttpd | 54 ++++++++++++++++++++++++++++++++++++++++ package/thttpd/thttpd.mk | 4 +-- 2 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 package/thttpd/S90thttpd
package/thttpd/S90thttpd new file +54 -0
@@ -0,0 +1,54 @@ +#!/bin/sh + +DAEMON="thttpd" +PIDFILE="/var/run/$DAEMON.pid" + +THTTPD_ARGS="-C /etc/thttpd.conf" + +# shellcheck source=/dev/null +[ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON" + +start() { + printf 'Starting %s: ' "$DAEMON" + # shellcheck disable=SC2086 # we need the word splitting + start-stop-daemon -S -q -p "$PIDFILE" -x "/usr/sbin/$DAEMON" \ + -- $THTTPD_ARGS + status=$? + if [ "$status" -eq 0 ]; then + echo "OK" + else + echo "FAIL" + fi + return "$status" +} + +stop() { + printf 'Stopping %s: ' "$DAEMON" + start-stop-daemon -K -q -p "$PIDFILE" + status=$? + if [ "$status" -eq 0 ]; then + # thttpd does not remove the pid file on exit + rm -f "$PIDFILE" + echo "OK" + else + echo "FAIL" + fi + return "$status" +} + +restart() { + stop + sleep 1 + start +} + +case "$1" in + start|stop|restart) + "$1";; + reload) + # Restart, since there is no true "reload" feature. + restart;; + *) + echo "Usage: $0 {start|stop|restart|reload}" + exit 1 +esac
package/thttpd/thttpd.mk +2 -2
@@ -29,8 +29,8 @@ define THTTPD_INSTALL_TARGET_CMDS endef define THTTPD_INSTALL_INIT_SYSV - $(INSTALL) -D -m 0755 $(@D)/scripts/thttpd.sh $(TARGET_DIR)/etc/init.d/S90thttpd - $(SED) 's:/usr/local/sbin:/usr/sbin:g' $(TARGET_DIR)/etc/init.d/S90thttpd + $(INSTALL) -D -m 0755 package/thttpd/S90thttpd \ + $(TARGET_DIR)/etc/init.d/S90thttpd endef define THTTPD_INSTALL_INIT_SYSTEMD
Signature · 1 line
2.18.1